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