Allegati e modifica moduli da frontend

This commit is contained in:
2025-01-06 19:59:56 +01:00
parent b300cf2d54
commit 1b81b34df9
46 changed files with 1137 additions and 35 deletions

View File

@ -159,7 +159,9 @@ $baseImagePath = Uri::root(false) . "media/templates/site/joomla-italia-theme/im
?>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentAfterDisplay"?>
<?php echo $this->item->event->afterDisplayContent; ?>
<div class="allegati">
<?php echo $this->item->event->afterDisplayContent; ?>
</div>
</article>
<?= JHtml::_('content.prepare', '{loadposition bottom}'); ?>

View File

@ -33,16 +33,5 @@ if ($value == '') {
$baseImagePath = Uri::root(false) . "media/templates/site/joomla-italia-theme/images/";
?>
<?php echo $value; ?>
<div class="col-12 col-lg-6 mb-4">
<div class="card card-documento card-bg card-icon rounded h-100">
<div class="card-body">
<svg class="icon">
<use xlink:href="<?= $baseImagePath ?>sprites.svg#it-file-pdf"></use>
</svg>
<div class="card-icon-content">
<strong><?php echo $value; ?></strong>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,58 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ModuleHelper;
$app = Factory::getApplication();
$form = $displayData->getForm();
$input = $app->getInput();
$fields = $displayData->get('fields') ?: [
['parent', 'parent_id'],
['published', 'state', 'enabled'],
['category', 'catid'],
'featured',
'sticky',
'access',
'language',
'tags',
'note',
'version_note',
];
$hiddenFields = $displayData->get('hidden_fields') ?: [];
if (!ModuleHelper::isAdminMultilang()) {
$hiddenFields[] = 'language';
$form->setFieldAttribute('language', 'default', '*');
}
$html = [];
$html[] = '<fieldset class="form-vertical">';
foreach ($fields as $field) {
foreach ((array) $field as $f) {
if ($form->getField($f)) {
if (in_array($f, $hiddenFields)) {
$form->setFieldAttribute($f, 'type', 'hidden');
}
$html[] = $form->renderField($f);
break;
}
}
}
$html[] = '</fieldset>';
echo implode('', $html);

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
$form = $displayData->getForm();
$options = [
'formControl' => $form->getFormControl(),
'hidden' => (int) ($form->getValue('language', null, '*') === '*'),
];
// Load JavaScript message titles
Text::script('ERROR');
Text::script('WARNING');
Text::script('NOTICE');
Text::script('MESSAGE');
Text::script('JGLOBAL_ASSOC_NOT_POSSIBLE');
Text::script('JGLOBAL_ASSOCIATIONS_RESET_WARNING');
/** @var \Joomla\CMS\Document\HtmlDocument $doc */
$doc = Factory::getApplication()->getDocument();
$wa = $doc->getWebAssetManager();
$wa->getRegistry()->addExtensionRegistryFile('com_associations');
$wa->useScript('com_associations.associations-edit');
$doc->addScriptOptions('system.associations.edit', $options);
// JLayout for standard handling of associations fields in the administrator items edit screens.
echo $form->renderFieldset('item_associations');

View File

@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
$app = Factory::getApplication();
$form = $displayData->getForm();
$name = $displayData->get('fieldset');
$fieldSet = $form->getFieldset($name);
if (empty($fieldSet)) {
return;
}
$ignoreFields = $displayData->get('ignore_fields') ? : [];
$extraFields = $displayData->get('extra_fields') ? : [];
if (!empty($displayData->showOptions) || $displayData->get('show_options', 1)) {
if (isset($extraFields[$name])) {
foreach ($extraFields[$name] as $f) {
if (in_array($f, $ignoreFields)) {
continue;
}
if ($form->getField($f)) {
$fieldSet[] = $form->getField($f);
}
}
}
$html = [];
foreach ($fieldSet as $field) {
$html[] = $field->renderField();
}
echo implode('', $html);
} else {
$html = [];
$html[] = '<div class="hidden">';
foreach ($fieldSet as $field) {
$html[] = $field->input;
}
$html[] = '</div>';
echo implode('', $html);
}

View File

@ -0,0 +1,68 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
// JLayout for standard handling of the edit modules:
$moduleHtml = &$displayData['moduleHtml'];
$mod = $displayData['module'];
$position = $displayData['position'];
$menusEditing = $displayData['menusediting'];
$parameters = ComponentHelper::getParams('com_modules');
$redirectUri = '&return=' . urlencode(base64_encode(Uri::getInstance()->toString()));
$target = '_blank';
$itemid = Factory::getApplication()->getInput()->get('Itemid', '0', 'int');
$editUrl = Uri::base() . 'administrator/index.php?option=com_modules&task=module.edit&id=' . (int) $mod->id;
// If Module editing site
if ($parameters->get('redirect_edit', 'site') === 'site') {
$editUrl = Uri::base() . 'index.php?option=com_config&view=modules&id=' . (int) $mod->id . '&Itemid=' . $itemid . $redirectUri;
$target = '_self';
}
// Add link for editing the module
$count = 0;
$moduleHtml = preg_replace(
// Trova il primo tag del modulo
'/^(\s*<(?:div|span|nav|ul|ol|h\d|section|aside|address|article|form) [^>]*>)/',
// Crea e aggiungi il link di modifica e il tooltip
'\\1 <a class="btn btn-link jmodedit" href="' . $editUrl . '" target="' . $target . '" data-bs-toggle="tooltip" data-bs-placement="top" title="' . htmlspecialchars(Text::_('JLIB_HTML_EDIT_MODULE') . '<br>' . htmlspecialchars($mod->title, ENT_COMPAT, 'UTF-8') . '<br>' . sprintf(Text::_('JLIB_HTML_EDIT_MODULE_IN_POSITION'), htmlspecialchars($position, ENT_COMPAT, 'UTF-8')), ENT_QUOTES, 'UTF-8') . '">
<span class="icon-edit" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('JGLOBAL_EDIT') . '</span></a>',
$moduleHtml,
1,
$count
);
// If menu editing is enabled and allowed and it's a menu module add link for editing
if ($menusEditing && $mod->module === 'mod_menu') {
// find the menu item id
$regex = '/\bitem-(\d+)\b/';
preg_match_all($regex, $moduleHtml, $menuItemids);
if ($menuItemids) {
foreach ($menuItemids[1] as $menuItemid) {
$menuitemEditUrl = Uri::base() . 'administrator/index.php?option=com_menus&view=item&client_id=0&layout=edit&id=' . (int) $menuItemid;
$moduleHtml = preg_replace(
// Find the link
'/(<li.*?\bitem-' . $menuItemid . '.*?>)/',
// Create and add the edit link
'\\1 <a class="jmenuedit small" href="' . $menuitemEditUrl . '" target="' . $target . '" title="' . Text::_('JLIB_HTML_EDIT_MENU_ITEM') . ' ' . sprintf(Text::_('JLIB_HTML_EDIT_MENU_ITEM_ID'), (int) $menuItemid) . '">
<span class="icon-edit" aria-hidden="true"></span></a>',
$moduleHtml
);
}
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Language\Text;
$app = Factory::getApplication();
$form = $displayData->getForm();
$input = $app->getInput();
$component = $input->getCmd('option', 'com_content');
if ($component === 'com_categories') {
$extension = $input->getCmd('extension', 'com_content');
$parts = explode('.', $extension);
$component = $parts[0];
}
$saveHistory = ComponentHelper::getParams($component)->get('save_history', 0);
$fields = $displayData->get('fields') ?: [
'transition',
['parent', 'parent_id'],
['published', 'state', 'enabled'],
['category', 'catid'],
'featured',
'sticky',
'access',
'language',
'tags',
'note',
'version_note',
];
$hiddenFields = $displayData->get('hidden_fields') ?: [];
if (!$saveHistory) {
$hiddenFields[] = 'version_note';
}
if (!Multilanguage::isEnabled()) {
$hiddenFields[] = 'language';
$form->setFieldAttribute('language', 'default', '*');
}
$html = [];
$html[] = '<fieldset class="form-vertical">';
$html[] = '<legend class="visually-hidden">' . Text::_('JGLOBAL_FIELDSET_GLOBAL') . '</legend>';
foreach ($fields as $field) {
foreach ((array) $field as $f) {
if ($form->getField($f)) {
if (in_array($f, $hiddenFields)) {
$form->setFieldAttribute($f, 'type', 'hidden');
}
$html[] = $form->renderField($f);
break;
}
}
}
$html[] = '</fieldset>';
echo implode('', $html);

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
$form = $displayData->getForm();
// JLayout for standard handling of metadata fields in the administrator content edit screens.
$fieldSets = $form->getFieldsets('metadata');
?>
<?php foreach ($fieldSets as $name => $fieldSet) : ?>
<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo $this->escape(Text::_($fieldSet->description)); ?>
</div>
<?php endif; ?>
<?php
// Include the real fields in this panel.
if ($name === 'jmetadata') {
echo $form->renderField('metadesc');
echo $form->renderField('metakey');
}
foreach ($form->getFieldset($name) as $field) {
if ($field->name !== 'jform[metadata][tags][]') {
echo $field->renderField();
}
} ?>
<?php endforeach; ?>

View File

@ -0,0 +1,188 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
$app = Factory::getApplication();
$form = $displayData->getForm();
$fieldSets = $form->getFieldsets();
$helper = $displayData->get('useCoreUI', false) ? 'uitab' : 'bootstrap';
if (empty($fieldSets)) {
return;
}
$ignoreFieldsets = $displayData->get('ignore_fieldsets') ?: [];
$outputFieldsets = $displayData->get('output_fieldsets') ?: [];
$ignoreFieldsetFields = $displayData->get('ignore_fieldset_fields') ?: [];
$ignoreFields = $displayData->get('ignore_fields') ?: [];
$extraFields = $displayData->get('extra_fields') ?: [];
$tabName = $displayData->get('tab_name') ?: 'myTab';
// These are required to preserve data on save when fields are not displayed.
$hiddenFieldsets = $displayData->get('hiddenFieldsets') ?: [];
// These are required to configure showing and hiding fields in the editor.
$configFieldsets = $displayData->get('configFieldsets') ?: [];
// Handle the hidden fieldsets when show_options is set false
if (!$displayData->get('show_options', 1)) {
// The HTML buffer
$html = [];
// Loop over the fieldsets
foreach ($fieldSets as $name => $fieldSet) {
// Check if the fieldset should be ignored
if (in_array($name, $ignoreFieldsets, true)) {
continue;
}
// If it is a hidden fieldset, render the inputs
if (in_array($name, $hiddenFieldsets)) {
// Loop over the fields
foreach ($form->getFieldset($name) as $field) {
// Add only the input on the buffer
$html[] = $field->input;
}
// Make sure the fieldset is not rendered twice
$ignoreFieldsets[] = $name;
}
// Check if it is the correct fieldset to ignore
if (strpos($name, 'basic') === 0) {
// Ignore only the fieldsets which are defined by the options not the custom fields ones
$ignoreFieldsets[] = $name;
}
}
// Echo the hidden fieldsets
echo implode('', $html);
}
$opentab = false;
$xml = $form->getXml();
// Loop again over the fieldsets
foreach ($fieldSets as $name => $fieldSet) {
// Ensure any fieldsets we don't want to show are skipped (including repeating formfield fieldsets)
if (
(isset($fieldSet->repeat) && $fieldSet->repeat === true)
|| in_array($name, $ignoreFieldsets)
|| (!empty($configFieldsets) && in_array($name, $configFieldsets, true))
|| (!empty($hiddenFieldsets) && in_array($name, $hiddenFieldsets, true))
) {
continue;
}
// Determine the label
if (!empty($fieldSet->label)) {
$label = Text::_($fieldSet->label);
} else {
$label = strtoupper('JGLOBAL_FIELDSET_' . $name);
if (Text::_($label) === $label) {
$label = strtoupper($app->getInput()->get('option') . '_' . $name . '_FIELDSET_LABEL');
}
$label = Text::_($label);
}
$hasChildren = $xml->xpath('//fieldset[@name="' . $name . '"]//fieldset[not(ancestor::field/form/*)]');
$hasParent = $xml->xpath('//fieldset//fieldset[@name="' . $name . '"]');
$isGrandchild = $xml->xpath('//fieldset//fieldset//fieldset[@name="' . $name . '"]');
if (!$isGrandchild && $hasParent) {
echo '<fieldset id="fieldset-' . $name . '" class="options-form ' . (!empty($fieldSet->class) ? $fieldSet->class : '') . '">';
echo '<legend>' . $label . '</legend>';
// Include the description when available
if (!empty($fieldSet->description)) {
echo '<div class="alert alert-info">';
echo '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('INFO') . '</span> ';
echo Text::_($fieldSet->description);
echo '</div>';
}
echo '<div class="form-grid">';
} elseif (!$hasParent) {
// Tabs
if ($opentab) {
if ($opentab > 1) {
echo '</div>';
echo '</fieldset>';
}
// End previous tab
echo HTMLHelper::_($helper . '.endTab');
}
// Start the tab
echo HTMLHelper::_($helper . '.addTab', $tabName, 'attrib-' . $name, $label);
$opentab = 1;
// Directly add a fieldset if we have no children
if (!$hasChildren) {
echo '<fieldset id="fieldset-' . $name . '" class="options-form ' . (!empty($fieldSet->class) ? $fieldSet->class : '') . '">';
echo '<legend>' . $label . '</legend>';
// Include the description when available
if (!empty($fieldSet->description)) {
echo '<div class="alert alert-info">';
echo '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('INFO') . '</span> ';
echo Text::_($fieldSet->description);
echo '</div>';
}
echo '<div class="form-grid">';
$opentab = 2;
} elseif (!empty($fieldSet->description)) {
// Include the description when available
echo '<div class="alert alert-info alert-parent">';
echo '<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden">' . Text::_('INFO') . '</span> ';
echo Text::_($fieldSet->description);
echo '</div>';
}
}
// We're on the deepest level => output fields
if (!$hasChildren) {
// The name of the fieldset to render
$displayData->fieldset = $name;
// Force to show the options
$displayData->showOptions = true;
// Render the fieldset
echo LayoutHelper::render('joomla.edit.fieldset', $displayData);
}
// Close open fieldset
if (!$isGrandchild && $hasParent) {
echo '</div>';
echo '</fieldset>';
}
}
if ($opentab) {
if ($opentab > 1) {
echo '</div>';
echo '</fieldset>';
}
// End previous tab
echo HTMLHelper::_($helper . '.endTab');
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$form = $displayData->getForm();
$fields = $displayData->get('fields') ?: [
'publish_up',
'publish_down',
'featured_up',
'featured_down',
['created', 'created_time'],
['created_by', 'created_user_id'],
'created_by_alias',
['modified', 'modified_time'],
['modified_by', 'modified_user_id'],
'version',
'hits',
'id'
];
$hiddenFields = $displayData->get('hidden_fields') ?: [];
foreach ($fields as $field) {
foreach ((array) $field as $f) {
if ($form->getField($f)) {
if (in_array($f, $hiddenFields)) {
$form->setFieldAttribute($f, 'type', 'hidden');
}
echo $form->renderField($f);
break;
}
}
}

View File

@ -0,0 +1,25 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$form = $displayData->getForm();
$title = $form->getField('title') ? 'title' : ($form->getField('name') ? 'name' : '');
?>
<div class="row title-alias form-vertical mb-3">
<div class="col-12 col-md-6">
<?php echo $title ? $form->renderField($title) : ''; ?>
</div>
<div class="col-12 col-md-6">
<?php echo $form->renderField('alias'); ?>
</div>
</div>

View File

@ -71,8 +71,8 @@ $wa->useScript('com_finder.finder');
?>
<span class="d-none d-md-block fw-semibold">Cerca</span>
<button class="search-link rounded-icon" aria-label="Cerca nel sito" href="#" type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#searchmodal" data-element="search-modal-button">
<span class="d-none d-md-block fw-semibold pe-3"><?= Text::_('CERCA'); ?></span>
<button class="search-link rounded-icon" aria-label="<?= Text::_('CERCANELSITO'); ?>" href="#" type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#searchmodal" data-element="search-modal-button">
<svg class="icon icon-sm">
<use href="<?= $baseImagePath ?>sprites.svg#it-search"></use>
</svg>

View File

@ -140,25 +140,24 @@ $wa->usePreset('template.joomla-italia-theme')
</a>
</div>
<div class="it-right-zone <?php if ($this->countModules('cerca')): ?>normalizeflex<?php endif; ?>">
<jdoc:include type="modules" name="cerca" style="none" />
<?php if ($this->params->get('showSocial')) : ?>
<div class="it-socials d-none d-md-flex">
<span>Seguici su</span>
<?php $fieldValues = $this->params->get('showSocialTouchFields'); ?>
<ul>
<span><?= Text::_('SEGUICISU'); ?></span>
<?php $fieldValues = $this->params->get('showSocialTouchFields'); ?>
<ul>
<?php foreach ($fieldValues as $value): ?>
<li>
<a href="<?= $value->touchsuburl ?>" aria-label="<?= $value->touchsubname ?>" target="_blank">
<svg class="icon"><use href="<?=$baseImagePath?>sprites.svg#<?=$value->touchsubicon?>">
</use>
</svg>
</a>
</li>
<li>
<a href="<?= $value->touchsuburl ?>" aria-label="<?= $value->touchsubname ?>" target="_blank">
<svg class="icon">
<use href="<?=$baseImagePath?>sprites.svg#<?=$value->touchsubicon?>"></use>
</svg>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</ul>
</div>
<?php endif; ?>
<jdoc:include type="modules" name="cerca" style="none" />
<jdoc:include type="modules" name="bottonecerca" style="none" />
</div>
</div>