forked from ZwiiCMS-Team/ZwiiCampus
Renomme i18nContent en classesContent
This commit is contained in:
parent
19c70eec4c
commit
df31319e1e
@ -913,7 +913,7 @@ class layout extends common
|
|||||||
if (is_dir(self::DATA_DIR . $key)) {
|
if (is_dir(self::DATA_DIR . $key)) {
|
||||||
$c++;
|
$c++;
|
||||||
$location = helper::baseUrl() . 'language/content/' . $key;
|
$location = helper::baseUrl() . 'language/content/' . $key;
|
||||||
$leftItem .= '<option name="' . $key . '" value="' . $location . '" ' . ($key === self::$i18nContent ? 'selected' : '') . '>' . $value . '</option>';
|
$leftItem .= '<option name="' . $key . '" value="' . $location . '" ' . ($key === self::$classesContent ? 'selected' : '') . '>' . $value . '</option>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($c > 1) {
|
if ($c > 1) {
|
||||||
|
@ -611,10 +611,10 @@ class core extends common
|
|||||||
$inlineScript[] = $this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']);
|
$inlineScript[] = $this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']);
|
||||||
|
|
||||||
// Importe le contenu, le CSS et le script des barres
|
// Importe le contenu, le CSS et le script des barres
|
||||||
$contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$i18nContent) : '';
|
$contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$classesContent) : '';
|
||||||
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']);
|
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']);
|
||||||
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']);
|
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']);
|
||||||
$contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$i18nContent) : '';
|
$contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$classesContent) : '';
|
||||||
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']);
|
$inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']);
|
||||||
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']);
|
$inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']);
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ class core extends common
|
|||||||
|
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'content' => $this->getPage($this->getUrl(0), self::$i18nContent),
|
'content' => $this->getPage($this->getUrl(0), self::$classesContent),
|
||||||
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
||||||
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
||||||
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
||||||
@ -658,7 +658,7 @@ class core extends common
|
|||||||
: $this->getData(['page', $this->getUrl(0), 'metaDescription']);
|
: $this->getData(['page', $this->getUrl(0), 'metaDescription']);
|
||||||
|
|
||||||
// Importe le CSS de la page principale
|
// Importe le CSS de la page principale
|
||||||
$pageContent = $this->getPage($this->getUrl(0), self::$i18nContent);
|
$pageContent = $this->getPage($this->getUrl(0), self::$classesContent);
|
||||||
|
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
@ -170,7 +170,7 @@ class common
|
|||||||
// Langue de l'interface sélectionnée
|
// Langue de l'interface sélectionnée
|
||||||
public static $i18nUI = 'fr_FR';
|
public static $i18nUI = 'fr_FR';
|
||||||
// Langues de contenu
|
// Langues de contenu
|
||||||
public static $i18nContent = 'fr_FR';
|
public static $classesContent = 'fr_FR';
|
||||||
public static $languages = [
|
public static $languages = [
|
||||||
'az_AZ' => 'Azərbaycan dili',
|
'az_AZ' => 'Azərbaycan dili',
|
||||||
'bg_BG' => 'български език',
|
'bg_BG' => 'български език',
|
||||||
@ -333,30 +333,30 @@ class common
|
|||||||
// Déterminer la langue du contenu du site
|
// Déterminer la langue du contenu du site
|
||||||
if (isset($_SESSION['ZWII_CONTENT'])) {
|
if (isset($_SESSION['ZWII_CONTENT'])) {
|
||||||
// Déterminé par la session présente
|
// Déterminé par la session présente
|
||||||
self::$i18nContent = $_SESSION['ZWII_CONTENT'];
|
self::$classesContent = $_SESSION['ZWII_CONTENT'];
|
||||||
} else {
|
} else {
|
||||||
// Détermine la langue par défaut
|
// Détermine la langue par défaut
|
||||||
foreach (self::$languages as $key => $value) {
|
foreach (self::$languages as $key => $value) {
|
||||||
if (file_exists(self::DATA_DIR . $key . '/.default')) {
|
if (file_exists(self::DATA_DIR . $key . '/.default')) {
|
||||||
self::$i18nContent = $key;
|
self::$classesContent = $key;
|
||||||
$_SESSION['ZWII_CONTENT'] = $key;
|
$_SESSION['ZWII_CONTENT'] = $key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\setlocale(LC_ALL, self::$i18nContent . '.UTF8');
|
\setlocale(LC_ALL, self::$classesContent . '.UTF8');
|
||||||
|
|
||||||
// Instanciation de la classe des entrées / sorties
|
// Instanciation de la classe des entrées / sorties
|
||||||
$this->jsonDB(self::$i18nContent);
|
$this->jsonDB(self::$classesContent);
|
||||||
|
|
||||||
// Installation fraîche, initialisation des modules
|
// Installation fraîche, initialisation des modules
|
||||||
if ($this->user === []) {
|
if ($this->user === []) {
|
||||||
foreach ($this->dataFiles as $stageId => $item) {
|
foreach ($this->dataFiles as $stageId => $item) {
|
||||||
$folder = $this->dataPath($stageId, self::$i18nContent);
|
$folder = $this->dataPath($stageId, self::$classesContent);
|
||||||
if (
|
if (
|
||||||
file_exists($folder . $stageId . '.json') === false
|
file_exists($folder . $stageId . '.json') === false
|
||||||
) {
|
) {
|
||||||
$this->initData($stageId, self::$i18nContent);
|
$this->initData($stageId, self::$classesContent);
|
||||||
common::$coreNotices[] = $stageId;
|
common::$coreNotices[] = $stageId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html prefix="og: http://ogp.me/ns#" lang="<?php echo substr(self::$i18nContent, 0, 2); ?>">
|
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html prefix="og: http://ogp.me/ns#" lang="<?php echo substr(self::$i18nContent, 0, 2); ?>">
|
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo substr(self::$i18nContent, 0, 2);?>">
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html prefix="og: http://ogp.me/ns#" lang="<?php echo substr(self::$i18nContent, 0, 2); ?>">
|
<html prefix="og: http://ogp.me/ns#" lang="fr_FR">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
@ -41,8 +41,6 @@ class language extends common
|
|||||||
public static $translateOptions = [];
|
public static $translateOptions = [];
|
||||||
|
|
||||||
// Page pour la configuration dans la langue
|
// Page pour la configuration dans la langue
|
||||||
public static $pagesList = [];
|
|
||||||
public static $orphansList = [];
|
|
||||||
public static $pages = '';
|
public static $pages = '';
|
||||||
|
|
||||||
// Liste des langues installées
|
// Liste des langues installées
|
||||||
@ -183,52 +181,6 @@ class language extends common
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
// Langues du site
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
foreach (self::$languages as $key => $value) {
|
|
||||||
// tableau des langues installées
|
|
||||||
if (is_dir(self::DATA_DIR . $key)) {
|
|
||||||
if (
|
|
||||||
file_exists(self::DATA_DIR . $key . '/page.json') &&
|
|
||||||
file_exists(self::DATA_DIR . $key . '/module.json') &&
|
|
||||||
file_exists(self::DATA_DIR . $key . '/locale.json')
|
|
||||||
) {
|
|
||||||
if (file_exists(self::DATA_DIR . $key . '/.default')) {
|
|
||||||
$messageLocale = helper::translate('Langue par défaut');
|
|
||||||
} elseif (isset($_SESSION['ZWII_CONTENT']) && $_SESSION['ZWII_CONTENT'] === $key) {
|
|
||||||
$messageLocale = helper::translate('Langue du site sélectionnée');
|
|
||||||
} else {
|
|
||||||
$messageLocale = '';
|
|
||||||
}
|
|
||||||
self::$languagesInstalled[] = [
|
|
||||||
template::flag($key, '20 %') . ' ' . $value . ' (' . $key . ')',
|
|
||||||
$messageLocale,
|
|
||||||
template::button('translateContentLanguageLocaleEdit' . $key, [
|
|
||||||
'class' => file_exists(self::DATA_DIR . $key . '/locale.json') ? '' : ' disabled',
|
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/locale/' . $key,
|
|
||||||
'value' => template::ico('pencil'),
|
|
||||||
'help' => 'Éditer'
|
|
||||||
]),
|
|
||||||
template::button('translateContentLanguageLocaleDelete' . $key, [
|
|
||||||
'class' => 'translateDelete buttonRed' . ($messageLocale ? ' disabled' : ''),
|
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/locale/' . $key,
|
|
||||||
'value' => template::ico('trash'),
|
|
||||||
'help' => 'Supprimer',
|
|
||||||
])
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// Activation du bouton de copie
|
|
||||||
self::$siteCopy = count(self::$languagesInstalled) > 1 ? false : true;
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
// Langues de l'UI
|
|
||||||
// --------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Langues attachées à des utilisateurs non effaçables
|
// Langues attachées à des utilisateurs non effaçables
|
||||||
$usersUI = [];
|
$usersUI = [];
|
||||||
$users = $this->getData(['user']);
|
$users = $this->getData(['user']);
|
||||||
@ -305,7 +257,7 @@ class language extends common
|
|||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => helper::translate('Langues'),
|
'title' => helper::translate('Langues de l\'interface'),
|
||||||
'view' => 'index'
|
'view' => 'index'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -361,113 +313,6 @@ class language extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Edition des paramètres de la langue de contenu
|
|
||||||
*/
|
|
||||||
public function locale()
|
|
||||||
{
|
|
||||||
// Action interdite ou URl avec le code langue incorrecte
|
|
||||||
$lang = $this->getUrl(2);
|
|
||||||
if (
|
|
||||||
array_key_exists($lang, self::$languages) === false
|
|
||||||
) {
|
|
||||||
// Valeurs en sortie
|
|
||||||
$this->addOutput([
|
|
||||||
'redirect' => helper::baseUrl() . 'language',
|
|
||||||
'state' => false,
|
|
||||||
'notification' => helper::translate('Action interdite')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Soumission du formulaire
|
|
||||||
if (
|
|
||||||
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
|
|
||||||
$this->isPost()
|
|
||||||
) {
|
|
||||||
|
|
||||||
// Sauvegarder les locales
|
|
||||||
$data = [
|
|
||||||
'config' => [
|
|
||||||
'homePageId' => $this->getInput('localeHomePageId', helper::FILTER_ID, true),
|
|
||||||
'page404' => $this->getInput('localePage404'),
|
|
||||||
'page403' => $this->getInput('localePage403'),
|
|
||||||
'page302' => $this->getInput('localePage302'),
|
|
||||||
'legalPageId' => $this->getInput('localeLegalPageId'),
|
|
||||||
'searchPageId' => $this->getInput('localeSearchPageId'),
|
|
||||||
'poweredPageLabel' => empty($this->getInput('localePoweredPageLabel', helper::FILTER_STRING_SHORT)) ? 'Motorisé par' : $this->getInput('localePoweredPageLabel', helper::FILTER_STRING_SHORT),
|
|
||||||
'searchPageLabel' => empty($this->getInput('localeSearchPageLabel', helper::FILTER_STRING_SHORT)) ? 'Rechercher' : $this->getInput('localeSearchPageLabel', helper::FILTER_STRING_SHORT),
|
|
||||||
'legalPageLabel' => empty($this->getInput('localeLegalPageLabel', helper::FILTER_STRING_SHORT)) ? 'Mentions légales' : $this->getInput('localeLegalPageLabel', helper::FILTER_STRING_SHORT),
|
|
||||||
'sitemapPageLabel' => empty($this->getInput('localeSitemapPageLabel', helper::FILTER_STRING_SHORT)) ? 'Plan du site' : $this->getInput('localeSitemapPageLabel', helper::FILTER_STRING_SHORT),
|
|
||||||
'metaDescription' => $this->getInput('localeMetaDescription', helper::FILTER_STRING_LONG, true),
|
|
||||||
'title' => $this->getInput('localeTitle', helper::FILTER_STRING_SHORT, true),
|
|
||||||
'cookies' => [
|
|
||||||
// Les champs sont obligatoires si l'option consentement des cookies est active
|
|
||||||
'mainLabel' => $this->getInput('localeCookiesZwiiText', helper::FILTER_STRING_LONG, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
|
||||||
'titleLabel' => $this->getInput('localeCookiesTitleText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
|
||||||
'linkLegalLabel' => $this->getInput('localeCookiesLinkMlText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
|
||||||
'cookiesFooterText' => $this->getInput('localeCookiesFooterText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN)),
|
|
||||||
'buttonValidLabel' => $this->getInput('localeCookiesButtonText', helper::FILTER_STRING_SHORT, $this->getInput('configCookieConsent', helper::FILTER_BOOLEAN))
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// Sauvegarde hors méthodes si la langue n'est pas celle de l'UI
|
|
||||||
if ($lang === self::$i18nContent) {
|
|
||||||
// Enregistrer les données par lecture directe du formulaire
|
|
||||||
$this->setData(['config', $data['config']]);
|
|
||||||
} else {
|
|
||||||
// Sauver sur le disque
|
|
||||||
file_put_contents(self::DATA_DIR . $lang . '/locale.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Valeurs en sortie
|
|
||||||
$this->addOutput([
|
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
|
||||||
'notification' => helper::translate('Modifications enregistrées'),
|
|
||||||
'state' => true
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Préparation de l'affichage du formulaire
|
|
||||||
//-----------------------------------------
|
|
||||||
|
|
||||||
// La locale est-elle celle de la langue de l'UI ?
|
|
||||||
if ($lang === self::$i18nContent) {
|
|
||||||
self::$locales[$lang]['config'] = $this->getData(['config']);
|
|
||||||
} else {
|
|
||||||
// Lire les locales sans passer par les méthodes
|
|
||||||
self::$locales[$lang] = json_decode(file_get_contents(self::DATA_DIR . $lang . '/locale.json'), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Générer la liste des pages disponibles
|
|
||||||
self::$pagesList = $this->getData(['page']);
|
|
||||||
foreach (self::$pagesList as $page => $pageId) {
|
|
||||||
if (
|
|
||||||
$this->getData(['page', $page, 'block']) === 'bar' ||
|
|
||||||
$this->getData(['page', $page, 'disable']) === true
|
|
||||||
) {
|
|
||||||
unset(self::$pagesList[$page]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$orphansList = $this->getData(['page']);
|
|
||||||
foreach (self::$orphansList as $page => $pageId) {
|
|
||||||
if (
|
|
||||||
$this->getData(['page', $page, 'block']) === 'bar' ||
|
|
||||||
$this->getData(['page', $page, 'disable']) === true ||
|
|
||||||
$this->getdata(['page', $page, 'position']) !== 0
|
|
||||||
) {
|
|
||||||
unset(self::$orphansList[$page]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Valeurs en sortie
|
|
||||||
$this->addOutput([
|
|
||||||
'title' => helper::translate('Paramètres de la localisation') . ' ' . template::flag($lang, '20 %'),
|
|
||||||
'view' => 'config'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edition de la langue de l'interface
|
* Edition de la langue de l'interface
|
||||||
*/
|
*/
|
||||||
|
@ -12,77 +12,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function () {
|
||||||
var translateLayout = getCookie("translateLayout");
|
|
||||||
if (translateLayout == null) {
|
|
||||||
translateLayout = "content";
|
|
||||||
setCookie("translateLayout", "content");
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
$("#contentContainer").hide();
|
* Confirmation de suppression
|
||||||
$("#uiContainer").hide();
|
*/
|
||||||
$("#" + translateLayout + "Container").show();
|
$(".translateDelete").on("click", function () {
|
||||||
$("#translate" + capitalizeFirstLetter(translateLayout) + "Button").addClass("activeButton");
|
var _this = $(this);
|
||||||
|
var message_delete = "<?php echo helper::translate('Confirmer la suppression de cette langue'); ?>";
|
||||||
|
return core.confirm(message_delete, function () {
|
||||||
});
|
$(location).attr("href", _this.attr("href"));
|
||||||
|
});
|
||||||
// Sélecteur de fonctions
|
|
||||||
|
|
||||||
$("#translateUiButton").on("click", function() {
|
|
||||||
$("#contentContainer").hide();
|
|
||||||
$("#uiContainer").show();
|
|
||||||
$(this).addClass("activeButton");
|
|
||||||
$("#translateContentButton").removeClass("activeButton");
|
|
||||||
setCookie("translateLayout", "ui");
|
|
||||||
|
|
||||||
});
|
|
||||||
$("#translateContentButton").on("click", function() {
|
|
||||||
$("#uiContainer").hide();
|
|
||||||
$("#contentContainer").show();
|
|
||||||
$(this).addClass("activeButton");
|
|
||||||
$("#translateUiButton").removeClass("activeButton");
|
|
||||||
setCookie("translateLayout", "content");
|
|
||||||
// Afficher les boutons liés au contenu
|
|
||||||
$(".contentButtonContainer").show();
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Confirmation de suppression
|
|
||||||
*/
|
|
||||||
$(".translateDelete").on("click", function() {
|
|
||||||
var _this = $(this);
|
|
||||||
var message_delete = "<?php echo helper::translate('Confirmer la suppression de cette langue'); ?>";
|
|
||||||
return core.confirm(message_delete, function() {
|
|
||||||
$(location).attr("href", _this.attr("href"));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Fonctions
|
|
||||||
function setCookie(name, value, days) {
|
|
||||||
var expires = "";
|
|
||||||
if (days) {
|
|
||||||
var date = new Date();
|
|
||||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
||||||
expires = "; expires=" + date.toUTCString();
|
|
||||||
}
|
|
||||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCookie(name) {
|
|
||||||
var nameEQ = name + "=";
|
|
||||||
var ca = document.cookie.split(';');
|
|
||||||
for (var i = 0; i < ca.length; i++) {
|
|
||||||
var c = ca[i];
|
|
||||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
||||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define function to capitalize the first letter of a string
|
|
||||||
function capitalizeFirstLetter(string) {
|
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
||||||
}
|
|
@ -9,90 +9,38 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col1">
|
<div class="col1">
|
||||||
<?php /**echo template::button('translateHelp', [
|
<?php /**echo template::button('translateHelp', [
|
||||||
'href' => 'https://doc.zwiicms.fr/prise-en-charge-des-langues-etrangeres',
|
'href' => 'https://doc.zwiicms.fr/prise-en-charge-des-langues-etrangeres',
|
||||||
'target' => '_blank',
|
'target' => '_blank',
|
||||||
'value' => template::ico('help'),
|
'value' => template::ico('help'),
|
||||||
'class' => 'buttonHelp',
|
'class' => 'buttonHelp',
|
||||||
'help' => 'Consulter l\'aide en ligne'
|
'help' => 'Consulter l\'aide en ligne'
|
||||||
]);*/?>
|
]);*/?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<div class="block">
|
||||||
|
<h4>
|
||||||
|
<?php echo helper::translate('Langues installées'); ?>
|
||||||
|
</h4>
|
||||||
|
<?php if ($module::$languagesUiInstalled): ?>
|
||||||
|
<?php echo template::table([2, 1, 1, 5, 1, 1], $module::$languagesUiInstalled, ['Langues', 'Version', 'Date', '', '', '']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col12">
|
||||||
|
<div class="block">
|
||||||
|
<h4>
|
||||||
|
<?php echo helper::translate('Catalogue'); ?>
|
||||||
|
</h4>
|
||||||
|
<?php if ($module::$languagesStore): ?>
|
||||||
|
<?php echo template::table([2, 1, 2, 6, 1], $module::$languagesStore, ['Langues', 'Version', 'Date', '', '']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab">
|
|
||||||
<?php echo template::button('translateUiButton', [
|
|
||||||
'value' => 'Interface',
|
|
||||||
'class' => 'buttonTab'
|
|
||||||
]); ?>
|
|
||||||
<?php echo template::button('translateContentButton', [
|
|
||||||
'value' => 'Site',
|
|
||||||
'class' => 'buttonTab'
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="uiContainer" class="tabContent">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<div class="block">
|
|
||||||
<h4>
|
|
||||||
<?php echo helper::translate('Langues installées'); ?>
|
|
||||||
</h4>
|
|
||||||
<?php if ($module::$languagesUiInstalled): ?>
|
|
||||||
<?php echo template::table([2, 1, 1, 5, 1, 1], $module::$languagesUiInstalled, ['Langues', 'Version', 'Date', '', '', '']); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<div class="block">
|
|
||||||
<h4>
|
|
||||||
<?php echo helper::translate('Catalogue'); ?>
|
|
||||||
</h4>
|
|
||||||
<?php if ($module::$languagesStore): ?>
|
|
||||||
<?php echo template::table([2, 1, 2, 6, 1], $module::$languagesStore, ['Langues', 'Version', 'Date', '', '']); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="contentContainer" class="tabContent">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<div class="block">
|
|
||||||
<h4>
|
|
||||||
<?php echo helper::translate('Paramètres'); ?>
|
|
||||||
</h4>
|
|
||||||
<div class="col4 offset2">
|
|
||||||
<?php echo template::button('translateButtonCopyContent', [
|
|
||||||
'href' => helper::baseUrl() . 'language/copy',
|
|
||||||
'ico' => 'docs',
|
|
||||||
'disabled' => $module::$siteCopy,
|
|
||||||
'value' => 'Copie de contenus localisés'
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col4">
|
|
||||||
<?php echo template::button('translateButtonAddContent', [
|
|
||||||
'href' => helper::baseUrl() . 'language/add',
|
|
||||||
'ico' => 'plus',
|
|
||||||
'class' => 'buttonGreen',
|
|
||||||
'value' => 'Nouveau contenu localisé'
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<div class="block">
|
|
||||||
<h4>
|
|
||||||
<?php echo helper::translate('Langues installées'); ?>
|
|
||||||
</h4>
|
|
||||||
<?php if ($module::$languagesInstalled): ?>
|
|
||||||
<?php echo template::table([2, 6, 1, 1], $module::$languagesInstalled, ['Langues', '', '', '']); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
@ -41,7 +41,7 @@ class maintenance extends common
|
|||||||
? ''
|
? ''
|
||||||
: $this->getData(['page', $this->getData(['config', 'page302']), 'title']),
|
: $this->getData(['page', $this->getData(['config', 'page302']), 'title']),
|
||||||
//'content' => $this->getdata(['page',$this->getData(['config','page302']),'content']),
|
//'content' => $this->getdata(['page',$this->getData(['config','page302']),'content']),
|
||||||
'content' => $this->getPage($this->getData(['config', 'page302']), self::$i18nContent),
|
'content' => $this->getPage($this->getData(['config', 'page302']), self::$classesContent),
|
||||||
'view' => 'index'
|
'view' => 'index'
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -174,11 +174,11 @@ class page extends common
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Creation du contenu de la page
|
// Creation du contenu de la page
|
||||||
if (!is_dir(self::DATA_DIR . self::$i18nContent . '/content')) {
|
if (!is_dir(self::DATA_DIR . self::$classesContent . '/content')) {
|
||||||
mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755);
|
mkdir(self::DATA_DIR . self::$classesContent . '/content', 0755);
|
||||||
}
|
}
|
||||||
//file_put_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $pageId . '.html', '<p>Contenu de votre nouvelle page.</p>');
|
//file_put_contents(self::DATA_DIR . self::$classesContent . '/content/' . $pageId . '.html', '<p>Contenu de votre nouvelle page.</p>');
|
||||||
$this->setPage($pageId, '<p>Contenu de votre nouvelle page.</p>', self::$i18nContent);
|
$this->setPage($pageId, '<p>Contenu de votre nouvelle page.</p>', self::$classesContent);
|
||||||
|
|
||||||
// Met à jour le sitemap
|
// Met à jour le sitemap
|
||||||
$this->updateSitemap();
|
$this->updateSitemap();
|
||||||
@ -279,8 +279,8 @@ class page extends common
|
|||||||
}
|
}
|
||||||
// Effacer la page
|
// Effacer la page
|
||||||
$this->deleteData(['page', $page]);
|
$this->deleteData(['page', $page]);
|
||||||
if (file_exists(self::DATA_DIR . self::$i18nContent . '/content/' . $page . '.html')) {
|
if (file_exists(self::DATA_DIR . self::$classesContent . '/content/' . $page . '.html')) {
|
||||||
unlink(self::DATA_DIR . self::$i18nContent . '/content/' . $page . '.html');
|
unlink(self::DATA_DIR . self::$classesContent . '/content/' . $page . '.html');
|
||||||
}
|
}
|
||||||
$this->deleteData(['module', $page]);
|
$this->deleteData(['module', $page]);
|
||||||
|
|
||||||
@ -369,8 +369,8 @@ class page extends common
|
|||||||
// Supprime l'ancienne page si l'id a changée
|
// Supprime l'ancienne page si l'id a changée
|
||||||
if ($pageId !== $this->getUrl(2)) {
|
if ($pageId !== $this->getUrl(2)) {
|
||||||
$this->deleteData(['page', $this->getUrl(2)]);
|
$this->deleteData(['page', $this->getUrl(2)]);
|
||||||
if (file_exists(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html')) {
|
if (file_exists(self::DATA_DIR . self::$classesContent . '/content/' . $this->getUrl(2) . '.html')) {
|
||||||
unlink(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getUrl(2) . '.html');
|
unlink(self::DATA_DIR . self::$classesContent . '/content/' . $this->getUrl(2) . '.html');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Traitement des pages spéciales affectées dans la config :
|
// Traitement des pages spéciales affectées dans la config :
|
||||||
@ -508,11 +508,11 @@ class page extends common
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Creation du contenu de la page
|
// Creation du contenu de la page
|
||||||
if (!is_dir(self::DATA_DIR . self::$i18nContent . '/content')) {
|
if (!is_dir(self::DATA_DIR . self::$classesContent . '/content')) {
|
||||||
mkdir(self::DATA_DIR . self::$i18nContent . '/content', 0755);
|
mkdir(self::DATA_DIR . self::$classesContent . '/content', 0755);
|
||||||
}
|
}
|
||||||
$content = empty($this->getInput('pageEditContent', null)) ? '<p></p>' : str_replace('<p></p>', '<p> </p>', $this->getInput('pageEditContent', null));
|
$content = empty($this->getInput('pageEditContent', null)) ? '<p></p>' : str_replace('<p></p>', '<p> </p>', $this->getInput('pageEditContent', null));
|
||||||
$this->setPage($pageId, $content, self::$i18nContent);
|
$this->setPage($pageId, $content, self::$classesContent);
|
||||||
|
|
||||||
// Met à jour le sitemap
|
// Met à jour le sitemap
|
||||||
$this->updateSitemap();
|
$this->updateSitemap();
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::textarea('pageEditContent', [
|
<?php echo template::textarea('pageEditContent', [
|
||||||
'class' => 'editorWysiwyg',
|
'class' => 'editorWysiwyg',
|
||||||
'value' => $this->getPage($this->getUrl(2), self::$i18nContent)
|
'value' => $this->getPage($this->getUrl(2), self::$classesContent)
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -537,19 +537,19 @@ class plugin extends common
|
|||||||
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]['version'],
|
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]['version'],
|
||||||
template::flag($keyi18n, '20px') . ' <a href ="' . helper::baseUrl() . $keyPage . '" target="_blank">' . $pagesInfos[$keyi18n][$keyPage]['title'] . ' (' . $keyPage . ')</a>',
|
template::flag($keyi18n, '20px') . ' <a href ="' . helper::baseUrl() . $keyPage . '" target="_blank">' . $pagesInfos[$keyi18n][$keyPage]['title'] . ' (' . $keyPage . ')</a>',
|
||||||
template::button('dataExport' . $keyPage, [
|
template::button('dataExport' . $keyPage, [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/filemanager/' . self::$i18nContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/filemanager/' . self::$classesContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
|
||||||
// appel de fonction vaut exécution, utiliser un paramètre
|
// appel de fonction vaut exécution, utiliser un paramètre
|
||||||
'value' => template::ico('download-cloud'),
|
'value' => template::ico('download-cloud'),
|
||||||
'help' => 'Sauvegarder les données du module dans le gestionnaire de fichiers'
|
'help' => 'Sauvegarder les données du module dans le gestionnaire de fichiers'
|
||||||
]),
|
]),
|
||||||
template::button('dataExport' . $keyPage, [
|
template::button('dataExport' . $keyPage, [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/download/' . self::$i18nContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/download/' . self::$classesContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
|
||||||
// appel de fonction vaut exécution, utiliser un paramètre
|
// appel de fonction vaut exécution, utiliser un paramètre
|
||||||
'value' => template::ico('download'),
|
'value' => template::ico('download'),
|
||||||
'help' => 'Sauvegarder et télécharger les données du module'
|
'help' => 'Sauvegarder et télécharger les données du module'
|
||||||
]),
|
]),
|
||||||
template::button('dataDelete' . $keyPage, [
|
template::button('dataDelete' . $keyPage, [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . self::$i18nContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . self::$classesContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage,
|
||||||
// appel de fonction vaut exécution, utiliser un paramètre
|
// appel de fonction vaut exécution, utiliser un paramètre
|
||||||
'value' => template::ico('trash'),
|
'value' => template::ico('trash'),
|
||||||
'class' => 'buttonRed dataDelete',
|
'class' => 'buttonRed dataDelete',
|
||||||
|
@ -213,8 +213,8 @@ class search extends common
|
|||||||
) {
|
) {
|
||||||
$url = $parentId;
|
$url = $parentId;
|
||||||
$titre = $this->getData(['page', $parentId, 'title']);
|
$titre = $this->getData(['page', $parentId, 'title']);
|
||||||
//$content = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $parentId, 'content']));
|
//$content = file_get_contents(self::DATA_DIR . self::$classesContent . '/content/' . $this->getData(['page', $parentId, 'content']));
|
||||||
$content = $this->getPage($parentId, self::$i18nContent);
|
$content = $this->getPage($parentId, self::$classesContent);
|
||||||
$content = $titre . ' ' . $content;
|
$content = $titre . ' ' . $content;
|
||||||
// Pages sauf pages filles et articles de blog
|
// Pages sauf pages filles et articles de blog
|
||||||
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
|
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
|
||||||
@ -232,8 +232,8 @@ class search extends common
|
|||||||
) {
|
) {
|
||||||
$url = $childId;
|
$url = $childId;
|
||||||
$titre = $this->getData(['page', $childId, 'title']);
|
$titre = $this->getData(['page', $childId, 'title']);
|
||||||
//$content = file_get_contents(self::DATA_DIR . self::$i18nContent . '/content/' . $this->getData(['page', $childId, 'content']));
|
//$content = file_get_contents(self::DATA_DIR . self::$classesContent . '/content/' . $this->getData(['page', $childId, 'content']));
|
||||||
$content = $this->getPage($childId, self::$i18nContent);
|
$content = $this->getPage($childId, self::$classesContent);
|
||||||
$content = $titre . ' ' . $content;
|
$content = $titre . ' ' . $content;
|
||||||
//Pages filles
|
//Pages filles
|
||||||
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
|
$tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);
|
||||||
|
Loading…
Reference in New Issue
Block a user