Finish watermark admin UI with repeat and profile activation

This commit is contained in:
Terranom674
2026-08-15 14:44:32 +02:00
parent 781ba200c2
commit 9ea7e1a75e

View File

@@ -1,116 +1,59 @@
<div class="titrePage">
<h2>Bratonien Tools</h2>
</div>
<div class="titrePage"><h2>Bratonien Tools</h2></div>
{foreach from=$BRATONIEN_MESSAGES item=message}
<div class="infos"><p>{$message|escape:html}</p></div>
{/foreach}
{foreach from=$BRATONIEN_ERRORS item=error}
<div class="errors"><p>{$error|escape:html}</p></div>
{/foreach}
{foreach from=$BRATONIEN_MESSAGES item=message}<div class="infos"><p>{$message|escape:html}</p></div>{/foreach}
{foreach from=$BRATONIEN_ERRORS item=error}<div class="errors"><p>{$error|escape:html}</p></div>{/foreach}
<fieldset>
<legend>Bildcache</legend>
<p>Loescht alle von Piwigo erzeugten Bildderivate. Originalbilder bleiben erhalten.</p>
<p>Loescht alle erzeugten Piwigo- und Bratonien-Bildderivate. Originalbilder bleiben erhalten.</p>
<form method="post">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="image_cache_clear">
<button class="buttonLike" type="submit" onclick="return confirm('Wirklich den gesamten Bildcache leeren?');">Bildcache leeren</button>
<button class="buttonLike" type="submit" name="bratonien_tool" value="image_cache_clear" onclick="return confirm('Wirklich den gesamten Bildcache leeren?');">Bildcache leeren</button>
</form>
</fieldset>
<fieldset>
<legend>Bratonien-Wasserzeichenverwaltung</legend>
<p>Ist die Verwaltung aktiv, wird Piwigos bisherige Wasserzeichen-Nutzung gesichert und unterdrueckt. Beim Deaktivieren wird sie wiederhergestellt.</p>
<p>Bei Aktivierung wird Piwigos bisherige Wasserzeichen-Nutzung gesichert und unterdrueckt. Beim Deaktivieren wird der gesicherte Zustand wiederhergestellt.</p>
<form method="post">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_engine">
<label>
<input type="checkbox" name="engine_enabled" value="1" {if $WATERMARK_ENGINE.enabled}checked{/if}>
Bratonien-Wasserzeichenverwaltung aktivieren
</label>
<p><button class="buttonLike" type="submit">Status speichern</button></p>
<label><input type="checkbox" name="engine_enabled" value="1" {if $WATERMARK_ENGINE.enabled}checked{/if}> Bratonien-Wasserzeichenverwaltung aktivieren</label>
<p><button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_engine">Status speichern</button></p>
</form>
</fieldset>
<fieldset>
<legend>Wasserzeichendateien</legend>
<p>PNG-Dateien werden im Piwigo-Wasserzeichenordner gespeichert und stehen danach auch den Profilen zur Verfuegung.</p>
<p>PNG-Dateien liegen im normalen Piwigo-Wasserzeichenordner und koennen sowohl von Piwigo als auch von Bratonien-Profilen verwendet werden.</p>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_save">
<p>
<label>Datei:
<select name="watermark_file">
{foreach from=$WATERMARK.files key=file item=name}
<option value="{$file|escape:html}" {if $file == $WATERMARK.file}selected{/if}>{$name|escape:html}</option>
{/foreach}
</select>
</label>
<label> Neues PNG: <input type="file" name="watermark_upload" accept="image/png"></label>
</p>
<p>
X <input type="number" name="watermark_xpos" value="{$WATERMARK.xpos}" min="0" max="100" size="4">
Y <input type="number" name="watermark_ypos" value="{$WATERMARK.ypos}" min="0" max="100" size="4">
Deckkraft <input type="number" name="watermark_opacity" value="{$WATERMARK.opacity}" min="1" max="100" size="4"> %
</p>
<p>
Mindestgroesse <input type="number" name="watermark_minw" value="{$WATERMARK.minw}" min="0" size="5"> x
<input type="number" name="watermark_minh" value="{$WATERMARK.minh}" min="0" size="5">
<label><input type="checkbox" name="watermark_clear_cache" value="1"> Bildcache danach leeren</label>
</p>
<button class="buttonLike" type="submit">Wasserzeichendatei speichern</button>
<p><label>Datei <select name="watermark_file">{foreach from=$WATERMARK.files key=file item=name}<option value="{$file|escape:html}" {if $file == $WATERMARK.file}selected{/if}>{$name|escape:html}</option>{/foreach}</select></label> <label>Neues PNG <input type="file" name="watermark_upload" accept="image/png"></label></p>
<p>X <input type="number" name="watermark_xpos" value="{$WATERMARK.xpos}" min="0" max="100" size="4"> Y <input type="number" name="watermark_ypos" value="{$WATERMARK.ypos}" min="0" max="100" size="4"> Deckkraft <input type="number" name="watermark_opacity" value="{$WATERMARK.opacity}" min="1" max="100" size="4">%</p>
<p>Mindestgroesse <input type="number" name="watermark_minw" value="{$WATERMARK.minw}" min="0" size="5"> x <input type="number" name="watermark_minh" value="{$WATERMARK.minh}" min="0" size="5"> <label><input type="checkbox" name="watermark_clear_cache" value="1"> Bildcache danach leeren</label></p>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_save">Wasserzeichendatei speichern</button>
</form>
</fieldset>
<fieldset>
<legend>Wasserzeichenprofile</legend>
<p>Profile definieren Datei, Position, Deckkraft und Mindestgroesse. Sie koennen global oder pro Album zugewiesen werden.</p>
<p>Profile definieren Datei, Position, Wiederholung, Deckkraft und Mindestgroesse. Inaktive Profile bleiben gespeichert, werden aber nicht angewendet.</p>
<table class="table2">
<thead>
<tr><th>Name</th><th>Datei</th><th>Position</th><th>Deckkraft</th><th>Mindestgroesse</th><th>Aktionen</th></tr>
</thead>
<thead><tr><th>Profil</th></tr></thead>
<tbody>
{foreach from=$WATERMARK_PROFILES item=profile}
<tr>
<tr><td>
<form method="post">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_profile_save">
<input type="hidden" name="profile_id" value="{$profile.id}">
<td><input name="profile_name" value="{$profile.name|escape:html}" size="20"></td>
<td>
<select name="profile_file">
<option value="">Keine Datei</option>
{foreach from=$WATERMARK.files key=file item=name}
<option value="{$file|escape:html}" {if $file == $profile.watermark_file}selected{/if}>{$name|escape:html}</option>
{/foreach}
</select>
</td>
<td>X <input name="profile_xpos" value="{$profile.xpos}" size="3"> Y <input name="profile_ypos" value="{$profile.ypos}" size="3"></td>
<td><input name="profile_opacity" value="{$profile.opacity}" size="3">%</td>
<td><input name="profile_min_width" value="{$profile.min_width}" size="4"> x <input name="profile_min_height" value="{$profile.min_height}" size="4"></td>
<td><button class="buttonLike" type="submit">Speichern</button></td>
<p><strong>Name</strong> <input name="profile_name" value="{$profile.name|escape:html}" size="24"> <label><input type="checkbox" name="profile_active" value="1" {if $profile.active}checked{/if}> aktiv</label></p>
<p><strong>Datei</strong> <select name="profile_file"><option value="">Keine Datei</option>{foreach from=$WATERMARK.files key=file item=name}<option value="{$file|escape:html}" {if $file == $profile.watermark_file}selected{/if}>{$name|escape:html}</option>{/foreach}</select></p>
<p><strong>Position</strong> X <input type="number" name="profile_xpos" value="{$profile.xpos}" min="0" max="100" size="3"> Y <input type="number" name="profile_ypos" value="{$profile.ypos}" min="0" max="100" size="3"> &nbsp; <strong>Wiederholen</strong> X <input type="number" name="profile_xrepeat" value="{$profile.xrepeat}" min="0" max="20" size="3"> Y <input type="number" name="profile_yrepeat" value="{$profile.yrepeat}" min="0" max="20" size="3"></p>
<p><strong>Deckkraft</strong> <input type="number" name="profile_opacity" value="{$profile.opacity}" min="1" max="100" size="3">% &nbsp; <strong>Mindestgroesse</strong> <input type="number" name="profile_min_width" value="{$profile.min_width}" min="0" size="4"> x <input type="number" name="profile_min_height" value="{$profile.min_height}" min="0" size="4"></p>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_profile_save">Speichern</button>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_profile_duplicate">Duplizieren</button>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_profile_delete" onclick="return confirm('Profil wirklich loeschen?');">Loeschen</button>
</form>
</tr>
<tr>
<td colspan="6">
<form method="post" style="display:inline-block;margin-right:.5em;">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_profile_duplicate">
<input type="hidden" name="profile_id" value="{$profile.id}">
<button class="buttonLike" type="submit">Duplizieren</button>
</form>
<form method="post" style="display:inline-block;">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_profile_delete">
<input type="hidden" name="profile_id" value="{$profile.id}">
<button class="buttonLike" type="submit" onclick="return confirm('Profil wirklich loeschen?');">Loeschen</button>
</form>
</td>
</tr>
</td></tr>
{/foreach}
</tbody>
</table>
@@ -118,82 +61,43 @@
<h3>Neues Profil</h3>
<form method="post">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_profile_save">
<p>Name <input name="profile_name" value="" size="24"></p>
<p>
Datei
<select name="profile_file">
<option value="">Keine Datei</option>
{foreach from=$WATERMARK.files key=file item=name}
<option value="{$file|escape:html}">{$name|escape:html}</option>
{/foreach}
</select>
</p>
<p>X <input name="profile_xpos" value="90" size="3"> Y <input name="profile_ypos" value="90" size="3"> Deckkraft <input name="profile_opacity" value="35" size="3">%</p>
<p>Mindestgroesse <input name="profile_min_width" value="10" size="4"> x <input name="profile_min_height" value="10" size="4"></p>
<button class="buttonLike" type="submit">Profil anlegen</button>
<p><strong>Name</strong> <input name="profile_name" size="24"> <label><input type="checkbox" name="profile_active" value="1" checked> aktiv</label></p>
<p><strong>Datei</strong> <select name="profile_file"><option value="">Keine Datei</option>{foreach from=$WATERMARK.files key=file item=name}<option value="{$file|escape:html}">{$name|escape:html}</option>{/foreach}</select></p>
<p><strong>Position</strong> X <input type="number" name="profile_xpos" value="90" min="0" max="100" size="3"> Y <input type="number" name="profile_ypos" value="90" min="0" max="100" size="3"> &nbsp; <strong>Wiederholen</strong> X <input type="number" name="profile_xrepeat" value="0" min="0" max="20" size="3"> Y <input type="number" name="profile_yrepeat" value="0" min="0" max="20" size="3"></p>
<p><strong>Deckkraft</strong> <input type="number" name="profile_opacity" value="35" min="1" max="100" size="3">% &nbsp; <strong>Mindestgroesse</strong> <input type="number" name="profile_min_width" value="10" min="0" size="4"> x <input type="number" name="profile_min_height" value="10" min="0" size="4"></p>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_profile_save">Profil anlegen</button>
</form>
</fieldset>
<fieldset>
<legend>Globale Standardregeln</legend>
<p>Diese Regeln greifen, wenn kein Album und kein uebergeordnetes Album eine eigene Regel vorgibt.</p>
<p>Sie greifen, wenn weder das Album noch ein uebergeordnetes Album eine eigene Regel besitzt. Kein ausgewaehltes Profil bedeutet kein Wasserzeichen.</p>
<form method="post">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_defaults">
<p>
Oeffentliche Alben:
<select name="public_profile">
<option value="">Kein Wasserzeichen</option>
{foreach from=$WATERMARK_PROFILES item=profile}
<option value="{$profile.id}" {if $WATERMARK_DEFAULTS.public_profile == $profile.id}selected{/if}>{$profile.name|escape:html}</option>
{/foreach}
</select>
</p>
<p>
Private Alben:
<select name="private_profile">
<option value="">Kein Wasserzeichen</option>
{foreach from=$WATERMARK_PROFILES item=profile}
<option value="{$profile.id}" {if $WATERMARK_DEFAULTS.private_profile == $profile.id}selected{/if}>{$profile.name|escape:html}</option>
{/foreach}
</select>
</p>
<button class="buttonLike" type="submit">Globale Regeln speichern</button>
<p>Oeffentliche Alben <select name="public_profile"><option value="">Kein Wasserzeichen</option>{foreach from=$WATERMARK_PROFILES item=profile}{if $profile.active}<option value="{$profile.id}" {if $WATERMARK_DEFAULTS.public_profile == $profile.id}selected{/if}>{$profile.name|escape:html}</option>{/if}{/foreach}</select></p>
<p>Private Alben <select name="private_profile"><option value="">Kein Wasserzeichen</option>{foreach from=$WATERMARK_PROFILES item=profile}{if $profile.active}<option value="{$profile.id}" {if $WATERMARK_DEFAULTS.private_profile == $profile.id}selected{/if}>{$profile.name|escape:html}</option>{/if}{/foreach}</select></p>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_defaults">Globale Regeln speichern</button>
</form>
</fieldset>
<fieldset>
<legend>Albumregeln</legend>
<p>Ein Album kann die globale Regel erben, ein bestimmtes Profil erzwingen oder Wasserzeichen ausschalten. Unteralben erben die naechste explizite Regel ihrer Eltern.</p>
<p>Erben verwendet die naechste explizite Regel eines Elternalbums und danach den globalen Standard. Ein Album kann stattdessen ein Profil erzwingen oder Wasserzeichen komplett deaktivieren.</p>
<table class="table2">
<thead><tr><th>Album</th><th>Sichtbarkeit</th><th>Aktuelle Regel</th><th>Wirksam</th><th>Speichern</th></tr></thead>
<thead><tr><th>Albumregeln</th></tr></thead>
<tbody>
{foreach from=$WATERMARK_CATEGORIES item=category}
<tr>
<tr><td>
<form method="post">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN|escape:html}">
<input type="hidden" name="bratonien_tool" value="watermark_rule">
<input type="hidden" name="category_id" value="{$category.id}">
<td>{$category.display_name|escape:html}</td>
<td>{$category.status|escape:html}</td>
<td>
<select name="rule_mode">
<option value="inherit" {if $category.rule.mode == 'inherit'}selected{/if}>Erben</option>
<option value="disabled" {if $category.rule.mode == 'disabled'}selected{/if}>Kein Wasserzeichen</option>
<option value="profile" {if $category.rule.mode == 'profile'}selected{/if}>Profil verwenden</option>
</select>
<select name="rule_profile">
<option value="">Profil waehlen</option>
{foreach from=$WATERMARK_PROFILES item=profile}
<option value="{$profile.id}" {if $category.rule.profile_id == $profile.id}selected{/if}>{$profile.name|escape:html}</option>
{/foreach}
</select>
</td>
<td>{$category.effective_label|escape:html} ({$category.effective.source|escape:html})</td>
<td><button class="buttonLike" type="submit">Speichern</button></td>
<strong>{$category.display_name|escape:html}</strong> <small>({$category.status|escape:html})</small><br>
<select name="rule_mode"><option value="inherit" {if $category.rule.mode == 'inherit'}selected{/if}>Erben</option><option value="disabled" {if $category.rule.mode == 'disabled'}selected{/if}>Kein Wasserzeichen</option><option value="profile" {if $category.rule.mode == 'profile'}selected{/if}>Profil verwenden</option></select>
<select name="rule_profile"><option value="">Profil waehlen</option>{foreach from=$WATERMARK_PROFILES item=profile}{if $profile.active}<option value="{$profile.id}" {if $category.rule.profile_id == $profile.id}selected{/if}>{$profile.name|escape:html}</option>{/if}{/foreach}</select>
<span>Wirksam: <strong>{$category.effective_label|escape:html}</strong> ({$category.effective.source|escape:html})</span>
<button class="buttonLike" type="submit" name="bratonien_tool" value="watermark_rule">Speichern</button>
</form>
</tr>
</td></tr>
{/foreach}
</tbody>
</table>