Aggiunta campi per Allegato e titolo

This commit is contained in:
2025-09-10 17:51:59 +02:00
parent a4475ee6a5
commit a05b127a0e
5 changed files with 59 additions and 4 deletions

View File

@ -20,6 +20,14 @@
filter="safehtml" buttons="true" />
<field name="attachment" type="media" label="COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT"
directory="documents/circolari" preview="false" upload="true" />
<field
name="allegato_titolo"
type="text"
label="Titolo allegato"
description="Nome leggibile mostrato accanto al file allegato"
filter="string"
/>
<field name="image" type="media" label="COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE"
directory="images" preview="true" upload="true" />

View File

@ -0,0 +1,3 @@
ALTER TABLE `#__circolari`
ADD COLUMN `allegato_titolo` VARCHAR(190) DEFAULT NULL
AFTER `attachment`;

View File

@ -39,6 +39,7 @@ HTMLHelper::_('bootstrap.tooltip');
<?php echo $this->form->renderField('categoria_id'); ?>
<?php echo $this->form->renderField('description'); ?>
<?php echo $this->form->renderField('attachment'); ?>
<?php echo $this->form->renderField('allegato_titolo'); ?>
<?php echo $this->form->renderField('image'); ?>
<?php echo $this->form->renderField('firma_obbligatoria'); ?>
<?php echo $this->form->renderField('usergroup_ids'); ?>

View File

@ -7,7 +7,7 @@
<author>Tommaso Cippitelli</author>
<authorEmail>tommaso.cippitelli@protocollicreativi.it</authorEmail>
<authorUrl>http://</authorUrl>
<version>1.2.0</version>
<version>1.2.1</version>
<description></description>
<namespace path="src">Pcrt\Component\Circolari</namespace>

View File

@ -58,7 +58,8 @@ if ($canAdmin) {
<div class="col-md-9 col-12">
<h1 class="h2 mb-1"><?= $this->escape($item->title); ?></h1>
</div>
<?php //Condividi ?>
<?php //Condividi
?>
<div class="col-md-3 col-12 text-md-end mt-2 mt-md-0">
<a class="toggle-actions small text-decoration-none text-uppercase fw-bold d-flex justify-content-end align-items-center" style="color: #003274" href="#" title="Vedi azioni" data-bs-toggle="modal" data-bs-target="#modalaction" data-focus-mouse="false">
<span class="me-1">Condividi</span>
@ -143,7 +144,7 @@ if ($canAdmin) {
</div>
</div>
</div>
<?php if ($item->firma_obbligatoria && $this->getModel()->userCanFirmare($item->id, $this->getModel()->currentUser->id) && !empty($buttons)) : ?>
<div class="mt-4">
<div class="d-flex flex-wrap gap-2" data-sign-group="circolare-<?php echo (int)$item->id; ?>">
@ -187,10 +188,52 @@ if ($canAdmin) {
</div>
<?php endif; ?>
<div class="article-body mt-3">
<?php echo $item->description ; ?>
<?php echo $item->description; ?>
</div>
<h6>Allegati</h6>
<?php
$href = htmlspecialchars((string)($item->attachment ?? ''), ENT_QUOTES, 'UTF-8');
$label = htmlspecialchars((string)($item->allegato_titolo ?: 'Allegato'), ENT_QUOTES, 'UTF-8');
$title = 'Scarica ' . $label;
?>
<div class="row g-3 mb-2">
<div class="col-12 col-lg-6">
<div class="card card-documento card-bg card-icon rounded shadow-sm h-100">
<div class="card-body d-flex align-items-center">
<svg class="icon" aria-hidden="true" focusable="false" style="fill:#d1344c;">
<use xlink:href="/media/templates/site/tpl_istituzionale/images/sprites.svg#it-file-pdf"></use>
</svg>
<div class="card-icon-content">
<p class="mb-0">
<a
class="text-decoration-none"
href="<?php echo $href; ?>"
download
title="<?php echo htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?>"
data-focus-mouse="false"
>
<strong><?php echo $label; ?></strong>
<span class="visually-hidden"> (file PDF)</span>
</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
.card.card-icon .icon {
width: 34px;
height: 34px;
flex-shrink: 0;
margin: 0 8px 0 0;
}
</style>
<?php if ($canAdmin): ?>
<div class="card mt-4">