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.
This commit is contained in:
2026-11-25 12:02:54 +01:00
parent 151ac9df4c
commit 9d192c2141
22 changed files with 677 additions and 378 deletions
@@ -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" aria-label="Back to forms" title="Back to forms"> <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 mb-6 border border-base-300/60 bg-base-100 shadow-sm"> <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-primary" aria-hidden="true"></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>
<div class="form-control w-full max-w-2xl gap-1">
<label class="label" for="form-name"> <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 id="form-name" type="text" name="name" value="<?= phpb_e($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 mb-6 border border-base-300/60 bg-base-100 shadow-sm"> <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-primary" aria-hidden="true"></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="rounded-box border-2 border-dashed border-base-300 px-4 py-8 text-center"> <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>
<button type="button" @click="addField()" class="btn btn-sm btn-primary mt-2">Add your first field</button> <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,10 +163,10 @@ $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="mb-2 flex flex-col gap-2 sm:flex-row sm:items-center"> <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" aria-label="Drag to move field"> <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="w-full flex-1"> <div class="w-full flex-1">
@@ -179,10 +191,10 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
</div> </div>
</div> </div>
<!-- Validation errors --> <!-- Validation errors -->
<div x-show="getValidationErrors(field, index).length > 0" x-transition class="mb-2 rounded border border-error/30 bg-error/10 p-2 text-xs text-error" role="alert" aria-live="polite"> <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>
@@ -204,11 +216,11 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<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 border-l-2 border-primary/30 pl-3 sm:ml-2 sm:pl-4"> <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>
<button type="button" @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
</button> </button>
</div> </div>
@@ -229,35 +241,39 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
</template> </template>
</div> </div>
<div class="mt-4"> <div class="border-t border-base-300 pt-4">
<button type="button" @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
</button> </button>
</div> </div>
</div> </div>
</div> </section>
<div class="card mb-6 border border-base-300/60 bg-base-100 shadow-sm"> <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-primary" aria-hidden="true"></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="rounded-box border-2 border-dashed border-base-300 px-4 py-8 text-center"> <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>
<button type="button" @click="addFinisher()" class="btn btn-sm btn-primary mt-2">Add your first action</button> <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 min-w-40 flex-1" :aria-label="'Action ' + (index + 1) + ' type'"> <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">
@@ -265,10 +281,10 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
</template> </template>
</select> </select>
<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)"> <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" :for="'finisher-' + index + '-' + setting.name"><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>
@@ -296,27 +312,27 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<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">
<button type="button" @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
</button> </button>
</div> </div>
</div> </div>
</div> </section>
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end"> <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 sm:min-w-28"> <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 sm:min-w-28"> <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,13 +1,16 @@
<section class="card border border-base-300/60 bg-base-100 shadow-sm" aria-labelledby="form-extension-settings-title"> <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-start gap-3 border-b border-base-300/60 pb-4"> <div class="flex items-start gap-3 border-b border-base-300 pb-5">
<i class="ph-duotone ph-gear mt-1 text-2xl text-primary" aria-hidden="true"></i> <span class="grid size-11 shrink-0 place-items-center rounded-2xl bg-primary/10 text-primary">
<i class="text-2xl ph-duotone ph-gear" aria-hidden="true"></i>
</span>
<div> <div>
<h2 class="card-title text-lg" id="form-extension-settings-title">Settings</h2> <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> <p class="mt-1 text-sm text-base-content/60">Configure the global settings for the Form extension.</p>
</div> </div>
</div> </div>
<div class="space-y-5 pt-2"> <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,33 +13,36 @@ $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" aria-label="Back to forms" title="Back to forms"> <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 border border-base-300/60 bg-base-100 shadow-sm"> <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 border border-base-300/60 bg-base-100 shadow-sm"> <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): ?>
@@ -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-end"> <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') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> submission <?= phpb_e($entry['id']) ?>"> <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,36 +6,38 @@ $forms = $formsRepository->getAll();
?> ?>
<div class="mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"> <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 border border-base-300/60 bg-base-100 shadow-sm"> <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 border border-base-300/60 bg-base-100 shadow-sm"> <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-40 text-right"><?= phpb_trans('website-manager.actions') ?></th> <th class="w-40 text-right"><?= phpb_trans('website-manager.actions') ?></th>
@@ -43,21 +45,21 @@ $forms = $formsRepository->getAll();
</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-end 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" aria-label="View entries for <?= phpb_e($form['name']) ?>"> <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') ?>" aria-label="<?= phpb_trans('website-manager.edit') ?> <?= phpb_e($form['name']) ?>"> <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') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> <?= phpb_e($form['name']) ?>"> <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>
+2 -2
View File
@@ -34,14 +34,14 @@ if (isset($_GET['action']) && array_key_exists($_GET['action'], $modules)) $acti
if ($modules[$activeModule]['showTabs'] === true): if ($modules[$activeModule]['showTabs'] === true):
?> ?>
<nav class="mb-6 overflow-x-auto" aria-label="Form extension navigation"> <nav class="mb-6 overflow-x-auto" aria-label="Form extension navigation">
<div class="tabs tabs-boxed w-max min-w-full bg-base-200/50"> <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' : '' ?>" <?= $name === $activeModule ? 'aria-current="page"' : '' ?> 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
+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,18 +1,25 @@
<!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"> <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 class="min-h-screen bg-base-200 text-base-content"> <body class="min-h-screen bg-base-200 text-base-content antialiased">
<main class="flex min-h-screen flex-col items-center justify-center gap-8 px-4 py-10"> <main class="relative flex min-h-screen flex-col items-center justify-center gap-7 overflow-hidden px-4 py-10">
<section class="card w-full max-w-md bg-base-100 shadow-xl"> <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>
<div class="card-body"> <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> </div>
</section> </section>
@@ -1,5 +1,6 @@
<div class="mb-2 text-center"> <div class="space-y-1 text-center">
<h2 class="text-2xl font-semibold text-base-content"><?= 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 flex w-full flex-col gap-4" 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']) ?>">
@@ -7,9 +8,9 @@
<?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') ?> w-full" role="alert"> <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
@@ -18,12 +19,15 @@
<label class="form-control w-full gap-2"> <label class="form-control w-full gap-2">
<span class="label-text font-medium"><?= phpb_trans('auth.username') ?></span> <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> <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>
<label class="form-control w-full gap-2"> <label class="form-control w-full gap-2">
<span class="label-text font-medium"><?= phpb_trans('auth.password') ?></span> <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> <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> </label>
<button class="btn btn-primary mt-2 w-full" 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;
}
@@ -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"> <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 class="min-h-screen bg-base-200 text-base-content"> <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 min-h-screen 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 min-h-screen min-w-0 flex-col"> <div class="drawer-content flex min-h-screen min-w-0 flex-col">
<div class="navbar sticky top-0 z-30 border-b border-base-300 bg-base-100 px-2 lg:hidden"> <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-start"> <div class="navbar-start gap-3">
<label for="my-drawer-2" class="btn btn-square btn-ghost drawer-button" aria-label="Open navigation"> <label for="admin-navigation-drawer" class="btn btn-square btn-ghost drawer-button lg:hidden" aria-label="Open navigation" title="Open navigation">
<i class="text-lg ph-bold ph-list"></i> <i class="text-xl ph-bold ph-list" aria-hidden="true"></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-base font-semibold text-primary sm:text-lg">
<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" aria-label="<?= phpb_e(phpb_trans('website-manager.logout')) ?>"> <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="mt-auto px-4 py-8 text-center text-sm text-base-content/60"> <footer class="mt-auto px-4 py-6 text-center text-sm text-base-content/60 sm:px-6">
<p>Powered by <a class="link link-hover" href="https://github.com/deepDiverPaul/plugi" target="_blank" rel="noopener noreferrer">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 z-40"> <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 min-h-full w-72 gap-1 bg-base-100 p-4 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">
<li class="menu-title px-3 py-4"> <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">
<span class="text-lg font-semibold text-primary"> <span class="grid size-11 shrink-0 place-items-center rounded-2xl bg-primary text-primary-content shadow-sm">
<i class="inline-block ph-bold ph-brackets-square rotate-90"></i> <?= phpb_trans('website-manager.title') ?> <i class="text-2xl ph-bold ph-brackets-square rotate-90" aria-hidden="true"></i>
</span> </span>
</li> <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> <li>
<a class="<?= phpb_e($slug === $activeSlug ? 'menu-active' : '' ) ?>" href="?tab=<?= phpb_e($slug) ?>" <?= $slug === $activeSlug ? 'aria-current="page"' : '' ?>> <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="mt-auto hidden border-t border-base-300 pt-2 lg:flex"> <div class="mt-auto border-t border-base-300 pt-4">
<a href="<?= phpb_url('auth', ['action' => 'logout']) ?>"> <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,17 +5,23 @@ if (isset($page)) {
} }
?> ?>
<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"> <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">
<header class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"> <header class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<h1 class="text-2xl font-semibold text-base-content sm:text-3xl"><?= phpb_trans('website-manager.title') ?></h1> <div class="space-y-1">
<a href="<?= phpb_url('website_manager') ?>" class="btn btn-ghost btn-sm"> <p class="text-xs font-semibold uppercase tracking-[0.18em] text-base-content/50">Page builder maintenance</p>
<h1 class="text-2xl font-bold tracking-tight text-base-content sm:text-3xl"><?= phpb_trans('website-manager.title') ?></h1>
</div>
<a href="<?= phpb_url('website_manager') ?>" class="btn btn-ghost btn-sm self-start sm:self-auto">
<i class="ph ph-arrow-left" aria-hidden="true"></i> <?= phpb_trans('website-manager.back') ?> <i class="ph ph-arrow-left" aria-hidden="true"></i> <?= phpb_trans('website-manager.back') ?>
</a> </a>
</header> </header>
<section class="card min-w-0 border border-base-300 bg-base-100 shadow-sm"> <section class="card min-w-0 border border-base-300 bg-base-100 shadow-sm">
<div class="card-body min-w-0 gap-4 p-4 sm:p-6"> <div class="card-body min-w-0 gap-5 p-4 sm:p-6">
<h2 class="text-lg font-semibold"><?= phpb_trans('website-manager.render-thumbs') ?></h2> <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> <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> </div>
</section> </section>
@@ -1,24 +1,28 @@
<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"> <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">
<header> <header class="flex items-center gap-4">
<h1 class="text-2xl font-semibold text-base-content sm:text-3xl"> <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> </h1>
</div>
</header> </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') ?>" role="alert"> <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;
?> ?>
<section class="card min-w-0 border border-base-300 bg-base-100 shadow-sm"> <section class="min-w-0">
<div class="card-body min-w-0 gap-4 p-4 sm:p-6">
<?php include $tabs[$activeSlug]['include']; ?> <?php include $tabs[$activeSlug]['include']; ?>
</div>
</section> </section>
</main> </main>
@@ -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,11 +24,14 @@ $javascriptValue = static function (string $value): string {
?> ?>
<section class="card w-full border border-base-300 bg-base-100 p-4 shadow-sm sm:p-8"> <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">
<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 ?>"> <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(); ?>
<header class="border-b border-base-300 pb-4"> <header class="space-y-2 border-b border-base-300 pb-5">
<h1 class="text-2xl font-semibold text-base-content sm:text-3xl"> <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');
@@ -36,6 +40,7 @@ $javascriptValue = static function (string $value): string {
endif; endif;
?> ?>
</h1> </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> </header>
<?php if (! empty($errorMessage)): ?> <?php if (! empty($errorMessage)): ?>
@@ -44,16 +49,15 @@ $javascriptValue = static function (string $value): string {
</div> </div>
<?php endif; ?> <?php endif; ?>
<div class="mx-auto w-full max-w-3xl space-y-5" 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') ?>}">
<section class="grid gap-4 rounded-box border border-base-300 bg-base-200/50 p-4 sm:grid-cols-2 sm:p-5">
<div class="form-control w-full"> <div class="form-control w-full">
<label class="label" for="name"> <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"> <div class="form-control w-full">
@@ -75,6 +79,7 @@ $javascriptValue = static function (string $value): string {
?> ?>
</select> </select>
</div> </div>
</section>
<div class="form-control w-full" x-show="type !== 'redirect'"> <div class="form-control w-full" x-show="type !== 'redirect'">
<label class="label" for="layout"> <label class="label" for="layout">
@@ -95,13 +100,25 @@ $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 border border-base-300 bg-base-100" <?= 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-lg font-semibold sm:text-xl"><?= 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 space-y-4"> <span><?= phpb_trans('languages.' . $languageCode) ?></span>
<span class="badge badge-ghost ml-3"><?= phpb_e($languageCode) ?></span>
</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="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"> <div class="form-control w-full">
<label class="label" for="<?= phpb_e($languageCode) ?>-page-title"> <label class="label" for="<?= phpb_e($languageCode) ?>-page-title">
@@ -111,19 +128,21 @@ $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" 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" 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" 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">
@@ -137,9 +156,9 @@ $javascriptValue = static function (string $value): string {
<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'" aria-label="<?= phpb_e(phpb_trans('website-manager.edit')) ?>" title="<?= phpb_e(phpb_trans('website-manager.edit')) ?>"> <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" aria-hidden="true"></i> <i class="ph ph-pencil" x-show="disabled" aria-hidden="true"></i>
<i class="ph ph-pencil-slash" x-show="!disabled" aria-hidden="true"></i> <i class="ph ph-pencil-slash" x-show="!disabled" aria-hidden="true"></i>
</button> </button>
@@ -153,12 +172,13 @@ $javascriptValue = static function (string $value): string {
$firstLang = false; $firstLang = false;
endforeach; endforeach;
?> ?>
</section>
<div class="flex flex-col-reverse justify-end gap-3 border-t border-base-300 pt-6 sm:flex-row"> <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-ghost btn-sm"> <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 type="submit" 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');
@@ -173,4 +193,6 @@ $javascriptValue = static function (string $value): string {
</form> </form>
</div>
</section> </section>
</main>
@@ -1,26 +1,40 @@
<section class="card border border-base-300 bg-base-100 shadow-sm"> <section class="card border border-base-300 bg-base-100 shadow-sm">
<div class="card-body gap-6 p-4 sm:p-6"> <div class="card-body gap-6 p-4 sm:p-6 lg:p-8">
<div class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between"> <div class="flex flex-col gap-5 border-b border-base-300 pb-5 sm:flex-row sm:items-end sm:justify-between">
<label class="form-control w-full max-w-md gap-2"> <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 font-medium">Upload a file</span>
<input type="file" id="fileupload" class="file-input file-input-bordered file-input-primary w-full" name="fileupload" onchange="uploadFile()" onselect="uploadFile()" /> <span class="label-text-alt">Choose a file</span>
</label> </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>
<?php if (count($files) === 0) : ?> <?php if (count($files) === 0) : ?>
<div class="alert alert-info" role="status"> <div class="rounded-box border border-dashed border-base-300 bg-base-200/50 px-5 py-12 text-center" role="status">
<span>No files uploaded yet.</span> <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>
</span>
<h3 class="font-semibold text-base-content">No files yet</h3>
<p class="mt-1 text-sm text-base-content/60">Your uploaded files will appear here as a visual library.</p>
</div> </div>
<?php else : ?> <?php else : ?>
<ul class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"> <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) : ?> <?php foreach ($files as $file) : ?>
<li class="card overflow-hidden border border-base-300 bg-base-100 shadow-sm"> <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"> <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"> <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" aria-label="<?= phpb_e(phpb_trans('website-manager.remove')) ?> <?= phpb_e($file->public_id) ?>" title="<?= phpb_e(phpb_trans('website-manager.remove')) ?>"> <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> <i class="ph-duotone ph-trash" aria-hidden="true"></i>
</button> </button>
</figure> </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>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
@@ -3,17 +3,20 @@
use Plugi\Setting; use Plugi\Setting;
?> ?>
<section class="card border border-base-300 bg-base-100 shadow-sm"> <section class="space-y-5">
<div class="card-body p-0"> <header class="space-y-1">
<div class="overflow-x-auto"> <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]"> <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(); ?>
@@ -26,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;
@@ -46,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;
@@ -57,11 +61,15 @@ use Plugi\Setting;
endforeach; endforeach;
if ($actionNeeded) : if ($actionNeeded) :
?> ?>
<button class="btn btn-primary" 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 class="alert alert-success" role="status"> <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> <span>Database is up-to-date. <span class="hidden md:inline text-base-content/60">(<?= $phpb_db->getDBDefinitionHash() ?>)</span></span>
</div> </div>
<?php <?php
@@ -72,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 class="list-disc space-y-1 pl-5"> <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 type="button" @click="show = !show" class="btn btn-xs btn-outline" :aria-expanded="show" 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 max-h-96 overflow-auto rounded-box bg-base-200 p-4 text-xs" 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 type="button" @click="show = !show" class="btn btn-xs btn-outline" :aria-expanded="show" 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 max-h-96 overflow-auto rounded-box bg-base-200 p-4 text-xs" 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 type="button" @click="show = !show" class="btn btn-xs btn-outline" :aria-expanded="show" 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 max-h-96 overflow-auto rounded-box bg-base-200 p-4 text-xs" 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']
@@ -121,5 +130,4 @@ print_r([
</tbody> </tbody>
</table> </table>
</div> </div>
</div>
</section> </section>
@@ -12,19 +12,33 @@ $pages = $pageRepository->getAll();
<div class="space-y-6" 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="flex justify-end"> <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-6"> <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">
<section class="card border border-base-300 bg-base-100 shadow-sm"> <section class="card border border-base-300 bg-base-100 shadow-sm">
<div class="card-body gap-4 p-4 sm:p-6"> <div class="card-body gap-5 p-4 sm:p-6">
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between" x-data="{ edit: false }"> <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 }">
<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')) ?>"> <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')) ?>">
<h2 class="text-xl font-semibold text-base-content sm:text-2xl" x-text="menu.name" x-show="!edit"></h2> <h3 class="text-lg font-bold text-base-content sm:text-xl" x-text="menu.name" x-show="!edit"></h3>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<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')) ?>"> <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')) ?>">
<i class="text-xl ph ph-pencil-line" aria-hidden="true"></i> <i class="text-xl ph ph-pencil-line" aria-hidden="true"></i>
@@ -32,11 +46,11 @@ $pages = $pageRepository->getAll();
<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')) ?>"> <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')) ?>">
<i class="text-xl ph ph-trash" aria-hidden="true"></i> <i class="text-xl ph ph-trash" aria-hidden="true"></i>
</button> </button>
<div class="dropdown dropdown-end" x-show="(menu.pages.length < pages.length)"> <details class="dropdown dropdown-end" x-show="(menu.pages.length < pages.length)">
<button type="button" tabindex="0" class="btn btn-ghost btn-square btn-sm" aria-label="Add pages to menu" title="Add pages to menu"> <summary class="btn btn-ghost btn-square btn-sm list-none" aria-label="Add pages to menu" title="Add pages to menu">
<i class="text-xl ph ph-list-plus" aria-hidden="true"></i> <i class="text-xl ph ph-list-plus" aria-hidden="true"></i>
</button> </summary>
<ul tabindex="0" class="dropdown-content menu z-10 w-52 rounded-box bg-base-100 p-2 shadow"> <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)">
@@ -46,10 +60,14 @@ $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(',')">
<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"> <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]"> <table class="table table-zebra w-full min-w-[42rem]">
<thead> <thead>
@@ -89,8 +107,9 @@ $pages = $pageRepository->getAll();
</template> </template>
</div> </div>
<div class="flex justify-end"> <div class="flex justify-end border-t border-base-300 pt-5">
<button type="submit" 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,5 +1,15 @@
<div class="space-y-6"> <div class="space-y-5">
<div class="overflow-x-auto rounded-box border border-base-300"> <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]"> <table class="table table-zebra w-full min-w-[48rem]">
<thead> <thead>
<tr> <tr>
@@ -12,7 +22,13 @@
<tbody> <tbody>
<?php if (empty($pages)): ?> <?php if (empty($pages)): ?>
<tr> <tr>
<td colspan="4" class="py-10 text-center text-base-content/60">No pages yet. Add a page to get started.</td> <td colspan="4" class="py-12 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-files" aria-hidden="true"></i>
</span>
<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>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php foreach ($pages as $page): ?> <?php foreach ($pages as $page): ?>
@@ -27,10 +43,10 @@
</td> </td>
<td> <td>
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<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' : '' ?>"> <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> <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 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')) ?>"> <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" aria-hidden="true"></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') ?>" aria-label="<?= phpb_e(phpb_trans('website-manager.settings')) ?>" class="btn btn-ghost btn-square btn-sm"> <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">
@@ -47,9 +63,4 @@
</table> </table>
</div> </div>
<div class="flex justify-end">
<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> </div>
@@ -8,22 +8,27 @@ $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="space-y-6" 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 max-w-full gap-1 overflow-x-auto border-b border-base-300" role="tablist"> <header class="space-y-1">
<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">
<button type="button" class="tab tab-lifted" 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> <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> </div>
<div id="settings-panel-0" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-0" 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 id="settings-panel-1" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-1" 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">
<section class="space-y-4 rounded-box border border-base-300 p-4 sm:p-6"> <section class="space-y-4 rounded-box border border-base-300 bg-base-100 p-4 sm:p-6">
<h2 class="text-lg font-semibold"><?= phpb_trans('website-manager.website-languages') ?></h2> <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"> <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="flex cursor-pointer items-center justify-between gap-4 rounded-box border border-base-300 px-4 py-3"> <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 +38,7 @@ $settingIns = phpb_instance('setting');
?> ?>
</div> </div>
</section> </section>
<section class="max-w-2xl rounded-box border border-base-300 p-4 sm:p-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"> <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>
@@ -51,8 +56,8 @@ $settingIns = phpb_instance('setting');
</div> </div>
</section> </section>
</div> </div>
<div id="settings-panel-2" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-2" 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">
<section class="max-w-2xl rounded-box border border-base-300 p-4 sm:p-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"> <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>
@@ -70,7 +75,7 @@ $settingIns = phpb_instance('setting');
</div> </div>
</section> </section>
</div> </div>
<div id="settings-panel-3" class="space-y-6" role="tabpanel" aria-labelledby="settings-tab-3" 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-4"> <div class="flex flex-col gap-4">
<?php <?php
foreach (Extensions::getConfigs() as $extKey => $config): foreach (Extensions::getConfigs() as $extKey => $config):
@@ -78,7 +83,7 @@ $settingIns = phpb_instance('setting');
continue; continue;
} }
?> ?>
<details class="collapse collapse-plus border border-base-300 bg-base-100"> <details class="collapse collapse-arrow border border-base-300 bg-base-100">
<summary class="collapse-title text-lg font-semibold"><?= 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="space-y-4"> <div class="space-y-4">
@@ -121,6 +126,7 @@ $settingIns = phpb_instance('setting');
</div> </div>
<div class="flex justify-end border-t border-base-300 pt-6"> <div class="flex justify-end border-t border-base-300 pt-6">
<button type="submit" 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,11 +1,16 @@
<main id="welcome-page" class="mx-auto flex min-h-full w-full max-w-4xl flex-1 items-center px-4 py-10 sm:px-6"> <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 border border-base-300 bg-base-100 shadow-sm"> <section class="card w-full overflow-hidden border border-base-300 bg-base-100 shadow-xl shadow-base-content/5">
<div class="card-body items-center gap-6 p-8 text-center sm:p-12"> <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">
<span class="grid size-20 place-items-center rounded-[1.75rem] bg-primary text-primary-content shadow-lg shadow-primary/20">
<i class="text-4xl ph-bold ph-brackets-square rotate-90" aria-hidden="true"></i>
</span>
<div class="space-y-2"> <div class="space-y-2">
<h1 class="text-3xl font-semibold text-base-content">Welcome to Plugi Page Builder</h1> <p class="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Your site workspace</p>
<p class="text-base-content/70">Manage your pages, menus, and files from one place.</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="flex flex-col gap-3 sm:flex-row"> <div class="card-actions flex-col gap-3 sm:flex-row">
<a class="btn btn-primary" href="<?= phpb_url('website_manager') ?>">Get started</a> <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"> <a class="btn btn-outline" href="https://github.com/deepDiverPaul/plugi" target="_blank" rel="noopener noreferrer">
Visit GitHub Visit GitHub