Récupération extra

This commit is contained in:
Fred Tempez 2022-02-18 12:43:48 +01:00
parent 1f202ed38b
commit b49c7b5bf5
54 changed files with 1294 additions and 1015 deletions

View File

@ -19,15 +19,17 @@ class template {
'name' => $nameId, 'name' => $nameId,
'target' => '', 'target' => '',
'uniqueSubmission' => false, 'uniqueSubmission' => false,
'value' => 'Bouton' 'value' => 'Bouton',
'help' => ''
], $attributes); ], $attributes);
// Retourne le html // Retourne le html
return sprintf( return sprintf(
'<a %s class="button %s %s %s">%s</a>', '<a %s class="button %s %s %s" %s>%s</a>',
helper::sprintAttributes($attributes, ['class', 'disabled', 'ico', 'value']), helper::sprintAttributes($attributes, ['class', 'disabled', 'ico', 'value']),
$attributes['disabled'] ? 'disabled' : '', $attributes['disabled'] ? 'disabled' : '',
$attributes['class'], $attributes['class'],
$attributes['uniqueSubmission'] ? 'uniqueSubmission' : '', $attributes['uniqueSubmission'] ? 'uniqueSubmission' : '',
$attributes['help'] ? ' title="' . $attributes['help'] . '" ': '',
($attributes['ico'] ? template::ico($attributes['ico'], 'right') : '') . $attributes['value'] ($attributes['ico'] ? template::ico($attributes['ico'], 'right') : '') . $attributes['value']
); );
} }

View File

@ -490,26 +490,6 @@ $(document).ready(function(){
}; };
}); });
/**
* Active le système d'aide interne
*
*/
$(".buttonHelp").click(function() {
$(".helpDisplayContent").slideToggle();
/**
if( $(".buttonHelp").css('opacity') > '0.75'){
$(".buttonHelp").css('opacity','0.5');
}
else{
$(".buttonHelp").css('opacity','1');
}
*/
});
$(".helpDisplayContent").click(function() {
$(".helpDisplayContent").slideToggle();
});
/** /**
* Remove ID Facebook from URL * Remove ID Facebook from URL

View File

@ -45,8 +45,8 @@ class common {
// Numéro de version // Numéro de version
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/'; const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/';
const ZWII_VERSION = '11.3.01'; const ZWII_VERSION = '12.0.00';
const ZWII_UPDATE_CHANNEL = "v11"; const ZWII_UPDATE_CHANNEL = "test";
public static $actions = []; public static $actions = [];
public static $coreModuleIds = [ public static $coreModuleIds = [
@ -538,6 +538,8 @@ class common {
} }
/** /**
* Effacer les données de la page * Effacer les données de la page
* @param string pageId * @param string pageId
@ -547,7 +549,8 @@ class common {
return unlink(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $page, 'content'])); return unlink(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $page, 'content']));
} }
/** /**
* Sauvegarde des données * Sauvegarde des données
@ -1032,8 +1035,6 @@ class common {
case 'gif': case 'gif':
$source_image = imagecreatefromgif($src); $source_image = imagecreatefromgif($src);
break; break;
case 'webp':
$source_image = imagecreatefromwebp($src);
} }
// Image valide // Image valide
if ($source_image) { if ($source_image) {
@ -1056,9 +1057,6 @@ class common {
case 'image/gif': case 'image/gif':
return (imagegif($virtual_image, $dest)); return (imagegif($virtual_image, $dest));
break; break;
case 'image/webp':
return (imagewebp($virtual_image, $dest));
break;
} }
} else { } else {
return (false); return (false);
@ -1184,13 +1182,34 @@ class common {
} }
/**
* Fonction de parcours des données de module
* @param string $find donnée à rechercher
* @param string $replace donnée à remplacer
* @param array tableau à analyser
* @param int count nombres d'occurrences
* @return array avec les valeurs remplacées.
*/
public function recursive_array_replace ($find, $replace, $array, &$count) {
if (!is_array($array)) {
return str_replace($find, $replace, $array, $count);
}
$newArray = [];
foreach ($array as $key => $value) {
$newArray[$key] = $this->recursive_array_replace($find, $replace, $value,$c);
$count += $c;
}
return $newArray;
}
/** /**
* Génère une archive d'un dossier et des sous-dossiers * Génère une archive d'un dossier et des sous-dossiers
* @param string fileName path et nom de l'archive * @param string fileName path et nom de l'archive
* @param string folder path à zipper * @param string folder path à zipper
* @param array filter dossiers à exclure * @param array filter dossiers à exclure
*/ */
public function makeZip ($fileName, $folder, $filter ) { public function makeZip ($fileName, $folder, $filter = [] ) {
$zip = new ZipArchive(); $zip = new ZipArchive();
$zip->open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); $zip->open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
//$directory = 'site/'; //$directory = 'site/';
@ -1656,11 +1675,130 @@ class common {
*/ */
public function showMenu() { public function showMenu() {
// Met en forme les items du menu // Met en forme les items du menu
$itemsLeft = $this->formatMenu(false); $itemsLeft = '';
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
// Passer les entrées masquées
// Propriétés de l'item
$active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page de l'item
$itemsLeft .= '<li id="' . $parentPageId .'">';
// Menu extra if ( ( $this->getData(['page',$parentPageId,'disable']) === true
$itemsRight = $this->formatMenu(true); AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) OR (
$this->getData(['page',$parentPageId,'disable']) === true
AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND $this->getUser('group') < self::GROUP_MODERATOR
)
){
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
$itemsLeft .= '<a id="' . $parentPageId . '" href="' . $pageUrl . '">';
} else {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId;
$itemsLeft .= '<a class="' . $active . '" id="' . $parentPageId . '" href="' . $pageUrl . '"' . $targetBlank . '>';
}
switch ($this->getData(['page', $parentPageId, 'typeMenu'])) {
case '' :
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
break;
case 'text' :
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
break;
case 'icon' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" />';
} else {
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
case 'icontitle' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'titlshortTitlee']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="';
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']).'"/>';
} else {
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
}
// Cas où les pages enfants enfant sont toutes masquées dans le menu
// ne pas afficher de symbole lorsqu'il n'y a rien à afficher
$totalChild = 0;
$disableChild = 0;
foreach($childrenPageIds as $childKey) {
$totalChild += 1;
}
if($childrenPageIds && $disableChild !== $totalChild &&
$this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) {
$itemsLeft .= template::ico('down', 'left');
}
// ------------------------------------------------
$itemsLeft .= '</a>';
if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true ||
empty($childrenPageIds)) {
continue;
}
$itemsLeft .= '<ul class="navSub">';
foreach($childrenPageIds as $childKey) {
// Propriétés de l'item
$active = ($childKey === $currentPageId) ? 'active ' : '';
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page du sous-item
$itemsLeft .= '<li id=' . $childKey .'>';
if ( ( $this->getData(['page',$childKey,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) OR (
$this->getData(['page',$childKey,'disable']) === true
AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND $this->getUser('group') < self::GROUP_MODERATOR
)
){
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
$itemsLeft .= '<a id="' . $parentPageId . '" href="'. $pageUrl .'">';
} else {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $childKey) ? helper::baseUrl(false) : helper::baseUrl() . $childKey;
$itemsLeft .= '<a class="' . $active . ' ' . $parentPageId . '" id="' . $childKey . '" href="' . $pageUrl . '"' . $targetBlank . '>';
}
switch ($this->getData(['page', $childKey, 'typeMenu'])) {
case '' :
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
break;
case 'text' :
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
break;
case 'icon' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
} else {
$itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
case 'icontitle' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="';
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']).'"/>';
} else {
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
}
break;
case 'icontext' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$itemsLeft .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
} else {
$itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']);
}
break;
}
$itemsLeft .= '</a></li>';
}
$itemsLeft .= '</ul>';
}
// Lien de connexion // Lien de connexion
$itemsRight = '';
if( if(
( (
$this->getData(['theme', 'menu', 'loginLink']) $this->getData(['theme', 'menu', 'loginLink'])
@ -1692,146 +1830,6 @@ class common {
echo '</ul>'; echo '</ul>';
} }
/**
* Cette fonction est appelée par showMenu
* Elle permet de générer le menu selon qu'il s'agisse du menu principal ou du petit menu
* @param $menu bool false pour le menu principal, true pour le petit menu
*/
private function formatMenu($extra = false) {
$items = '';
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
// Menu extra ou standard
if (
// Absence de la position extra, la page est toujours affichée à gauche.
($this->getData(['page',$parentPageId,'extraPosition']) !== NULL || $extra === true)
&&
$this->getData(['page',$parentPageId,'extraPosition']) !== $extra ) {
continue;
}
// Propriétés de l'item
$active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : '';
$targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page de l'item
$items .= '<li id="' . $parentPageId .'">';
if ( ( $this->getData(['page',$parentPageId,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) OR (
$this->getData(['page',$parentPageId,'disable']) === true
AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND $this->getUser('group') < self::GROUP_MODERATOR
)
){
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
$items .= '<a id="' . $parentPageId . '" href="' . $pageUrl . '">';
} else {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId;
$items .= '<a class="' . $active . '" id="' . $parentPageId . '" href="' . $pageUrl . '"' . $targetBlank . '>';
}
switch ($this->getData(['page', $parentPageId, 'typeMenu'])) {
case '' :
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
break;
case 'text' :
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
break;
case 'icon' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" />';
} else {
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
case 'icontitle' :
if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'titlshortTitlee']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $parentPageId, 'iconUrl']).'" data-tippy-content="';
$items .= $this->getData(['page', $parentPageId, 'shortTitle']).'"/>';
} else {
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
}
// Cas où les pages enfants enfant sont toutes masquées dans le menu
// ne pas afficher de symbole lorsqu'il n'y a rien à afficher
$totalChild = 0;
$disableChild = 0;
foreach($childrenPageIds as $childKey) {
$totalChild += 1;
}
if($childrenPageIds && $disableChild !== $totalChild &&
$this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) {
$items .= template::ico('down', 'left');
}
// ------------------------------------------------
$items .= '</a>';
if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true ||
empty($childrenPageIds)) {
continue;
}
$items .= '<ul class="navSub">';
foreach($childrenPageIds as $childKey) {
// Propriétés de l'item
$active = ($childKey === $currentPageId) ? 'active ' : '';
$targetBlank = $this->getData(['page', $childKey, 'targetBlank']) ? ' target="_blank"' : '';
// Mise en page du sous-item
$items .= '<li id=' . $childKey .'>';
if ( ( $this->getData(['page',$childKey,'disable']) === true
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) OR (
$this->getData(['page',$childKey,'disable']) === true
AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND $this->getUser('group') < self::GROUP_MODERATOR
)
){
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
$items .= '<a id="' . $parentPageId . '" href="'. $pageUrl .'">';
} else {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $childKey) ? helper::baseUrl(false) : helper::baseUrl() . $childKey;
$items .= '<a class="' . $active . ' ' . $parentPageId . '" id="' . $childKey . '" href="' . $pageUrl . '"' . $targetBlank . '>';
}
switch ($this->getData(['page', $childKey, 'typeMenu'])) {
case '' :
$items .= $this->getData(['page', $childKey, 'shortTitle']);
break;
case 'text' :
$items .= $this->getData(['page', $childKey, 'shortTitle']);
break;
case 'icon' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
} else {
$items .= $this->getData(['page', $parentPageId, 'shortTitle']);
}
break;
case 'icontitle' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" data-tippy-content="';
$items .= $this->getData(['page', $childKey, 'shortTitle']).'"/>';
} else {
$items .= $this->getData(['page', $childKey, 'shortTitle']);
}
break;
case 'icontext' :
if ($this->getData(['page', $childKey, 'iconUrl']) != "") {
$items .= '<img alt="'.$this->getData(['page', $parentPageId, 'shortTitle']).'" src="'. helper::baseUrl(false) .self::FILE_DIR.'source/'.$this->getData(['page', $childKey, 'iconUrl']).'" />';
$items .= $this->getData(['page', $childKey, 'shortTitle']);
} else {
$items .= $this->getData(['page', $childKey, 'shortTitle']);
}
break;
}
$items .= '</a></li>';
}
$items .= '</ul>';
}
return($items);
}
/** /**
* Générer un menu pour la barre latérale * Générer un menu pour la barre latérale
* Uniquement texte * Uniquement texte
@ -2324,7 +2322,7 @@ class core extends common {
*/ */
foreach ($fonts as $fontId) { foreach ($fonts as $fontId) {
if (!array_key_exists($fontId, $localFonts) ) { if (!array_key_exists($fontId, $localFonts) ) {
$css .= '@import url("https://fonts.cdnfonts.com/css/' . $fontId . '");'; $css .= '@import url("http://fonts.cdnfonts.com/css/' . $fontId . '");';
// Supprimer l'élément des fontes chargées en ligne // Supprimer l'élément des fontes chargées en ligne
unset($fonts[$fontId]); unset($fonts[$fontId]);
} }
@ -2550,7 +2548,7 @@ class core extends common {
*/ */
foreach ($fonts as $fontId) { foreach ($fonts as $fontId) {
if (!array_key_exists($fontId, $localFonts) ) { if (!array_key_exists($fontId, $localFonts) ) {
$css .= '@import url("https://fonts.cdnfonts.com/css/' . $fontId . '");'; $css .= '@import url("http://fonts.cdnfonts.com/css/' . $fontId . '");';
// Supprimer l'élément des fontes chargées en ligne // Supprimer l'élément des fontes chargées en ligne
unset($fonts[$fontId]); unset($fonts[$fontId]);
} }

View File

@ -714,7 +714,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) {
// Option de dévoilement du mdp // Option de dévoilement du mdp
$this->setData(['config', 'connect', 'showPassword', true]); $this->setData(['config', 'connect', 'showPassword', true]);
// Mise à jour // Mise à jour
$this->setData(['core', 'dataVersion', 11200]); $this->setData(['core', 'dataVersion', 11200]);
} }
@ -722,7 +722,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) {
// Version 11.2.02 // Version 11.2.02
if ($this->getData(['core', 'dataVersion']) < 11202) { if ($this->getData(['core', 'dataVersion']) < 11202) {
// Renommer les champs // Renommer les champs
$this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText']) ]); $this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText']) ]);
$this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText']) ]); $this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText']) ]);
$this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText']) ]); $this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText']) ]);
@ -741,6 +741,55 @@ if ($this->getData(['core', 'dataVersion']) < 11202) {
$this->setData(['core', 'dataVersion', 11202]); $this->setData(['core', 'dataVersion', 11202]);
} }
// Version 11.2.03
if ($this->getData(['core', 'dataVersion']) < 11203) {
// Supprimer l'information de redirection
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
$new = '';
$c3 = 0;
$success = false ;
// Boucler sur les pages
foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) {
$content = $this->getPage($parentId, self::$i18n);
$titre = $this->getData(['page', $parentId, 'title']);
$content = $titre . ' ' . $content ;
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
if ($c1 > 0 || $c2 > 0) {
$success = true;
$this->setPage($parentId, $replace, self::$i18n);
$c3 += $c1 + $c2;
}
foreach($childIds as $childId) {
$content = $this->getPage($childId, self::$i18n);
$content = $titre . ' ' . $content ;
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
if ($c1 > 0 || $c2 > 0) {
$success = true;
$this->setPage($childId, $replace, self::$i18n);
$c3 += $c1 + $c2;
}
}
}
// Traiter les modules dont la redirection
$content = $this->getdata(['module']);
$replace = $this->recursive_array_replace('href="' . $old , 'href="'. $new, $content, $c1);
$replace = $this->recursive_array_replace('src="' . $old , 'src="'. $new, $replace, $c2);
if ($content !== $replace) {
$this->setdata(['module',$replace]);
$c3 += $c1 + $c2;
$success = true;
}
// Effacer la baseUrl
$this->deleteData(['core', 'baseUrl']);
// Mise à jour
$this->setData(['core', 'dataVersion', 11203]);
}
// Version 11.3.00 // Version 11.3.00
if ($this->getData(['core', 'dataVersion']) < 11300) { if ($this->getData(['core', 'dataVersion']) < 11300) {
@ -784,7 +833,7 @@ if ($this->getData(['core', 'dataVersion']) < 11300) {
$this->setData(['theme', 'title', 'font', $fonts[ $this->getData (['theme', 'title', 'font' ]) ] ]); $this->setData(['theme', 'title', 'font', $fonts[ $this->getData (['theme', 'title', 'font' ]) ] ]);
$this->setData(['admin', 'fontTitle', $fonts[ $this->getData (['admin', 'fontTitle' ]) ] ]); $this->setData(['admin', 'fontTitle', $fonts[ $this->getData (['admin', 'fontTitle' ]) ] ]);
$this->setData(['admin', 'fontText', $fonts[$this->getData (['admin','fontText' ]) ] ]); $this->setData(['admin', 'fontText', $fonts[$this->getData (['admin','fontText' ]) ] ]);
unlink(self::DATA_DIR . 'admin.css'); unlink(self::DATA_DIR . 'admin.css');
unlink(self::DATA_DIR . 'theme.css'); unlink(self::DATA_DIR . 'theme.css');
@ -795,11 +844,9 @@ if ($this->getData(['core', 'dataVersion']) < 11300) {
// Version 12.0.00 // Version 12.0.00
if ($this->getData(['core', 'dataVersion']) < 12000) { if ($this->getData(['core', 'dataVersion']) < 12000) {
// Effacer le dossier // Effacer le dossier
if (is_dir('core/module/addon')) { $this->removeDir('core/module/addon');
$this->removeDir('core/module/addon');
}
// Mise à jour // Mise à jour
$this->setData(['core', 'dataVersion', 12000]); $this->setData(['core', 'dataVersion', 12000]);
} }

View File

@ -1744,22 +1744,6 @@ th.col12 {
width: 60%; width: 60%;
} }
/* Système d'aide */
.helpDisplayContent {
display: none;
width: 100%;
padding: 10px 10px;
-webkit-box-shadow: 5px 5px 11px 0px #222222;
box-shadow: 5px 5px 11px 0px #222222;
border-radius: 5px;
z-index: 30;
}
.helpDisplayContent, .helpDisplayButton {
cursor: pointer;
}
/* Bannière masquable en petit écran*/ /* Bannière masquable en petit écran*/
@media screen and (max-width: 768px) { @media screen and (max-width: 768px) {
.bannerDisplay{ .bannerDisplay{

View File

@ -19,6 +19,7 @@ class config extends common {
public static $actions = [ public static $actions = [
'backup' => self::GROUP_ADMIN, 'backup' => self::GROUP_ADMIN,
'copyBackups'=> self::GROUP_ADMIN, 'copyBackups'=> self::GROUP_ADMIN,
'delBackups'=> self::GROUP_ADMIN,
'configMetaImage' => self::GROUP_ADMIN, 'configMetaImage' => self::GROUP_ADMIN,
'generateFiles' => self::GROUP_ADMIN, 'generateFiles' => self::GROUP_ADMIN,
'index' => self::GROUP_ADMIN, 'index' => self::GROUP_ADMIN,
@ -383,6 +384,15 @@ class config extends common {
$this->setData(['user',$users]); $this->setData(['user',$users]);
} }
} }
// Conversion vers des Url relatives
if ($this->getData(['core', 'baseUrl'])) {
$url = str_replace('?','',$this->getData(['core', 'baseUrl']));
// Suppresion de la base Url
$this->updateBaseUrl($url);
// Effacer la baseUrl
$this->deleteData(['core', 'baseUrl']);
}
// Message de notification // Message de notification
$notification = $success === true ? 'Restaurer effectuée avec succès' : 'Erreur inconnue'; $notification = $success === true ? 'Restaurer effectuée avec succès' : 'Erreur inconnue';
$redirect = $this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ? helper::baseUrl() . 'config/restore' : helper::baseUrl() . 'user/login/'; $redirect = $this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ? helper::baseUrl() . 'config/restore' : helper::baseUrl() . 'user/login/';
@ -584,7 +594,7 @@ class config extends common {
$this->generateFiles(); $this->generateFiles();
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Modifications enregistrées ' , 'notification' => 'Modifications enregistrées ' ,
'state' => true 'state' => true
@ -616,7 +626,7 @@ class config extends common {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index' 'view' => 'index'
]); ]);
} }
@ -655,10 +665,8 @@ class config extends common {
/** /**
* Met à jour les données de site avec l'adresse transmise * Met à jour les données de site avec l'adresse transmise
*/ */
public function updateBaseUrl () { public function updateBaseUrl ($url) {
// Supprimer l'information de redirection // Supprimer l'information de redirection
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
$new = helper::baseUrl(false,false);
$c3 = 0; $c3 = 0;
$success = false ; $success = false ;
// Boucler sur les pages // Boucler sur les pages
@ -666,8 +674,8 @@ class config extends common {
$content = $this->getPage($parentId, self::$i18n); $content = $this->getPage($parentId, self::$i18n);
$titre = $this->getData(['page', $parentId, 'title']); $titre = $this->getData(['page', $parentId, 'title']);
$content = $titre . ' ' . $content ; $content = $titre . ' ' . $content ;
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ; $replace = str_replace( 'href="' . $url , 'href="'. '' , stripslashes($content),$c1) ;
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ; $replace = str_replace( 'src="' . $url , 'src="'. '' , stripslashes($replace),$c2) ;
if ($c1 > 0 || $c2 > 0) { if ($c1 > 0 || $c2 > 0) {
$success = true; $success = true;
@ -677,8 +685,8 @@ class config extends common {
foreach($childIds as $childId) { foreach($childIds as $childId) {
$content = $this->getPage($childId, self::$i18n); $content = $this->getPage($childId, self::$i18n);
$content = $titre . ' ' . $content ; $content = $titre . ' ' . $content ;
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ; $replace = str_replace( 'href="' . $url , 'href="'. '' , stripslashes($content),$c1) ;
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ; $replace = str_replace( 'src="' . $url , 'src="'. '' , stripslashes($replace),$c2) ;
if ($c1 > 0 || $c2 > 0) { if ($c1 > 0 || $c2 > 0) {
$success = true; $success = true;
$this->setPage($childId, $replace, self::$i18n); $this->setPage($childId, $replace, self::$i18n);
@ -688,8 +696,8 @@ class config extends common {
} }
// Traiter les modules dont la redirection // Traiter les modules dont la redirection
$content = $this->getdata(['module']); $content = $this->getdata(['module']);
$replace = $this->recursive_array_replace('href="' . $old , 'href="'. $new, $content, $c1); $replace = $this->recursive_array_replace('href="' . $url , 'href="'. '', $content, $c1);
$replace = $this->recursive_array_replace('src="' . $old , 'src="'. $new, $replace, $c2); $replace = $this->recursive_array_replace('src="' . $url , 'src="'. '', $replace, $c2);
if ($content !== $replace) { if ($content !== $replace) {
$this->setdata(['module',$replace]); $this->setdata(['module',$replace]);
$c3 += $c1 + $c2; $c3 += $c1 + $c2;
@ -718,7 +726,7 @@ class config extends common {
file_put_contents(self::DATA_DIR . 'journal.log',$d); file_put_contents(self::DATA_DIR . 'journal.log',$d);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Journal réinitialisé avec succès', 'notification' => 'Journal réinitialisé avec succès',
'state' => true 'state' => true
@ -726,7 +734,7 @@ class config extends common {
} else { } else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Aucun journal à effacer', 'notification' => 'Aucun journal à effacer',
'state' => false 'state' => false
@ -754,7 +762,7 @@ class config extends common {
} else { } else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Aucun fichier journal à télécharger', 'notification' => 'Aucun fichier journal à télécharger',
'state' => false 'state' => false
@ -791,7 +799,7 @@ class config extends common {
} else { } else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Aucune liste noire à télécharger', 'notification' => 'Aucune liste noire à télécharger',
'state' => false 'state' => false
@ -808,7 +816,7 @@ class config extends common {
$this->setData(['blacklist',[]]); $this->setData(['blacklist',[]]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Liste noire réinitialisée avec succès', 'notification' => 'Liste noire réinitialisée avec succès',
'state' => true 'state' => true
@ -816,7 +824,7 @@ class config extends common {
} else { } else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Pas de liste à effacer', 'notification' => 'Pas de liste à effacer',
'state' => false 'state' => false
@ -835,32 +843,37 @@ class config extends common {
$this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' ); $this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' );
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration', 'title' => 'Configuration du site',
'view' => 'index', 'view' => 'index',
'notification' => 'Copie terminée', 'notification' => 'Copie terminée',
'state' => true 'state' => true
]); ]);
} }
/** /**
* Fonction de parcours des données de module * Vider le dosser des sauvegardes automatisées
* @param string $find donnée à rechercher
* @param string $replace donnée à remplacer
* @param array tableau à analyser
* @param int count nombres d'occurrences
* @return array avec les valeurs remplacées.
*/ */
private function recursive_array_replace ($find, $replace, $array, &$count) { public function delBackups() {
if (!is_array($array)) { $path = realpath(self::BACKUP_DIR);
return str_replace($find, $replace, $array, $count); $success = $fail = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
{
if (strpos($filename,'.zip')) {
$r = unlink($filename);
$success = $r === true ? $succes + 1 : $success;
$fail = $r === false ? $fail + 1 : $fail;
}
} }
// Valeurs en sortie
$newArray = []; $this->addOutput([
foreach ($array as $key => $value) { 'title' => 'Configuration du site',
$newArray[$key] = $this->recursive_array_replace($find, $replace, $value,$c); 'view' => 'index',
$count += $c; 'notification' => 'Suppression terminée :<br />' . $success . ' fichiers effacé(s) <br />' . $fail . ' échec(s)',
} 'state' => true
return $newArray; ]);
} }
} }

View File

@ -1,14 +1,13 @@
<?php echo template::formOpen('configBackupForm'); ?> <?php echo template::formOpen('configBackupForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('configBackupBack', [ <?php echo template::button('configBackupBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'config', 'href' => helper::baseUrl() . 'config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('configBackupSubmit',[ <?php echo template::submit('configBackupSubmit',[
'value' => 'Sauvegarder', 'value' => 'Sauvegarder',
'uniqueSubmission' => true 'uniqueSubmission' => true

View File

@ -10,7 +10,17 @@
* @link http://zwiicms.fr/ * @link http://zwiicms.fr/
*/ */
$( document).ready(function() { $(document).ready(function () {
/**
* Confirmation de suppression
*/
$("#configBackupDelButton").on("click", function () {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir supprimer les sauvegardes automatisées ?", function () {
$(location).attr("href", _this.attr("href"));
});
});
// Positionnement inital des options // Positionnement inital des options
//----------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------
@ -45,36 +55,36 @@ $( document).ready(function() {
$("#connectCaptchaStrongWrapper").addClass("disabled"); $("#connectCaptchaStrongWrapper").addClass("disabled");
$("#connectCaptchaStrongWrapper").slideDown(); $("#connectCaptchaStrongWrapper").slideDown();
$("#connectCaptchaTypeWrapper").addClass("disabled"); $("#connectCaptchaTypeWrapper").addClass("disabled");
$("#connectCaptchaTypeWrapper").slideDown(); $("#connectCaptchaTypeWrapper").slideDown();
} else { } else {
$("#connectCaptchaStrongWrapper").removeClass("disabled"); $("#connectCaptchaStrongWrapper").removeClass("disabled");
$("#connectCaptchaStrongWrapper").slideUp(); $("#connectCaptchaStrongWrapper").slideUp();
$("#connectCaptchaTypeWrapper").removeClass("disabled"); $("#connectCaptchaTypeWrapper").removeClass("disabled");
$("#connectCaptchaTypeWrapper").slideUp(); $("#connectCaptchaTypeWrapper").slideUp();
$( "#connectCaptchaStrong" ).prop( "checked", false ); $("#connectCaptchaStrong").prop("checked", false);
} }
var configLayout = getCookie("configLayout"); var configLayout = getCookie("configLayout");
if (configLayout == null) { if (configLayout == null) {
configLayout = "setup"; configLayout = "setup";
setCookie("configLayout","setup"); setCookie("configLayout", "setup");
} }
$("#localeContainer").hide(); $("#localeContainer").hide();
$("#socialContainer").hide(); $("#socialContainer").hide();
$("#connectContainer").hide(); $("#connectContainer").hide();
$("#networkContainer").hide(); $("#networkContainer").hide();
$("#setupContainer").hide(); $("#setupContainer").hide();
$("#" + configLayout + "Container" ).show(); $("#" + configLayout + "Container").show();
$("#config" + capitalizeFirstLetter(configLayout) + "Button").addClass("activeButton"); $("#config" + capitalizeFirstLetter(configLayout) + "Button").addClass("activeButton");
// Gestion des événements // Gestion des événements
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* Afficher et masquer options smtp * Afficher et masquer options smtp
*/ */
$("input[name=smtpEnable]").on("change", function() { $("input[name=smtpEnable]").on("change", function () {
if ($("input[name=smtpEnable]").is(':checked')) { if ($("input[name=smtpEnable]").is(':checked')) {
$("#smtpParam").addClass("disabled"); $("#smtpParam").addClass("disabled");
$("#smtpParam").slideDown(); $("#smtpParam").slideDown();
@ -88,7 +98,7 @@ $( document).ready(function() {
* Afficher et masquer options Auth * Afficher et masquer options Auth
*/ */
$("select[name=smtpAuth]").on("change", function() { $("select[name=smtpAuth]").on("change", function () {
if ($("select[name=smtpAuth]").val() == true) { if ($("select[name=smtpAuth]").val() == true) {
$("#smtpAuthParam").addClass("disabled"); $("#smtpAuthParam").addClass("disabled");
$("#smtpAuthParam").slideDown(); $("#smtpAuthParam").slideDown();
@ -102,7 +112,7 @@ $( document).ready(function() {
* Options de blocage de connexions * Options de blocage de connexions
* Contrôle la cohérence des sélections et interdit une seule valeur Aucune * Contrôle la cohérence des sélections et interdit une seule valeur Aucune
*/ */
$("select[name=connectAttempt]").on("change", function() { $("select[name=connectAttempt]").on("change", function () {
if ($("select[name=connectAttempt]").val() === "999") { if ($("select[name=connectAttempt]").val() === "999") {
$("select[name=connectTimeout]").val(0); $("select[name=connectTimeout]").val(0);
} else { } else {
@ -111,7 +121,7 @@ $( document).ready(function() {
} }
} }
}); });
$("select[name=connectTimeout]").on("change", function() { $("select[name=connectTimeout]").on("change", function () {
if ($("select[name=connectTimeout]").val() === "0") { if ($("select[name=connectTimeout]").val() === "0") {
$("select[name=connectAttempt]").val(999); $("select[name=connectAttempt]").val(999);
} else { } else {
@ -124,20 +134,20 @@ $( document).ready(function() {
/** /**
* Captcha strong si captcha sélectionné * Captcha strong si captcha sélectionné
*/ */
$("input[name=connectCaptcha]").on("change", function() { $("input[name=connectCaptcha]").on("change", function () {
if ($("input[name=connectCaptcha]").is(':checked')) { if ($("input[name=connectCaptcha]").is(':checked')) {
$("#connectCaptchaStrongWrapper").addClass("disabled"); $("#connectCaptchaStrongWrapper").addClass("disabled");
$("#connectCaptchaStrongWrapper").slideDown(); $("#connectCaptchaStrongWrapper").slideDown();
$("#connectCaptchaTypeWrapper").addClass("disabled"); $("#connectCaptchaTypeWrapper").addClass("disabled");
$("#connectCaptchaTypeWrapper").slideDown(); $("#connectCaptchaTypeWrapper").slideDown();
} else { } else {
$("#connectCaptchaStrongWrapper").removeClass("disabled"); $("#connectCaptchaStrongWrapper").removeClass("disabled");
$("#connectCaptchaStrongWrapper").slideUp(); $("#connectCaptchaStrongWrapper").slideUp();
$("#connectCaptchaTypeWrapper").removeClass("disabled"); $("#connectCaptchaTypeWrapper").removeClass("disabled");
$("#connectCaptchaTypeWrapper").slideUp(); $("#connectCaptchaTypeWrapper").slideUp();
$( "#connectCaptchaStrong" ).prop( "checked", false ); $("#connectCaptchaStrong").prop("checked", false);
} }
}); });
@ -145,7 +155,7 @@ $( document).ready(function() {
/** /**
* Sélection de la page de configuration à afficher * Sélection de la page de configuration à afficher
*/ */
$("#configSetupButton").on("click", function() { $("#configSetupButton").on("click", function () {
$("#localeContainer").hide(); $("#localeContainer").hide();
$("#socialContainer").hide(); $("#socialContainer").hide();
$("#connectContainer").hide(); $("#connectContainer").hide();
@ -156,9 +166,9 @@ $( document).ready(function() {
$("#configSocialButton").removeClass("activeButton"); $("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton"); $("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton"); $("#configNetworkButton").removeClass("activeButton");
setCookie("configLayout","setup"); setCookie("configLayout", "setup");
}); });
$("#configLocaleButton").on("click", function() { $("#configLocaleButton").on("click", function () {
$("#setupContainer").hide(); $("#setupContainer").hide();
$("#socialContainer").hide(); $("#socialContainer").hide();
$("#connectContainer").hide(); $("#connectContainer").hide();
@ -169,9 +179,9 @@ $( document).ready(function() {
$("#configSocialButton").removeClass("activeButton"); $("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton"); $("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton"); $("#configNetworkButton").removeClass("activeButton");
setCookie("configLayout","locale"); setCookie("configLayout", "locale");
}); });
$("#configSocialButton").on("click", function() { $("#configSocialButton").on("click", function () {
$("#connectContainer").hide(); $("#connectContainer").hide();
$("#setupContainer").hide(); $("#setupContainer").hide();
$("#localeContainer").hide(); $("#localeContainer").hide();
@ -182,9 +192,9 @@ $( document).ready(function() {
$("#configSocialButton").addClass("activeButton"); $("#configSocialButton").addClass("activeButton");
$("#configConnectButton").removeClass("activeButton"); $("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton"); $("#configNetworkButton").removeClass("activeButton");
setCookie("configLayout","social"); setCookie("configLayout", "social");
}); });
$("#configConnectButton").on("click", function() { $("#configConnectButton").on("click", function () {
$("#setupContainer").hide(); $("#setupContainer").hide();
$("#localeContainer").hide(); $("#localeContainer").hide();
$("#socialContainer").hide(); $("#socialContainer").hide();
@ -195,9 +205,9 @@ $( document).ready(function() {
$("#configSocialButton").removeClass("activeButton"); $("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").addClass("activeButton"); $("#configConnectButton").addClass("activeButton");
$("#configNetworkButton").removeClass("activeButton"); $("#configNetworkButton").removeClass("activeButton");
setCookie("configLayout","connect"); setCookie("configLayout", "connect");
}); });
$("#configNetworkButton").on("click", function() { $("#configNetworkButton").on("click", function () {
$("#setupContainer").hide(); $("#setupContainer").hide();
$("#localeContainer").hide(); $("#localeContainer").hide();
$("#socialContainer").hide(); $("#socialContainer").hide();
@ -208,49 +218,49 @@ $( document).ready(function() {
$("#configSocialButton").removeClass("activeButton"); $("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton"); $("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").addClass("activeButton"); $("#configNetworkButton").addClass("activeButton");
setCookie("configLayout","network"); setCookie("configLayout", "network");
}); });
/** /**
* Aspect de la souris * Aspect de la souris
*/ */
$("#socialMetaImage, #socialSiteMap, #configBackupCopyButton").click(function(event) { $("#socialMetaImage, #socialSiteMap, #configBackupCopyButton").click(function (event) {
$('body, .button').css('cursor', 'wait'); $('body, .button').css('cursor', 'wait');
}); });
// Mise en évidence des erreurs de saisie dans les boutons de sélection // Mise en évidence des erreurs de saisie dans les boutons de sélection
var containers = ["setup", "locale", "social", "connect", "network"]; var containers = ["setup", "locale", "social", "connect", "network"];
$.each( containers, function( index, value ){ $.each(containers, function (index, value) {
var a = $("div#" + value + "Container").find("input.notice").not(".displayNone"); var a = $("div#" + value + "Container").find("input.notice").not(".displayNone");
if (a.length > 0) { if (a.length > 0) {
$("#config" + capitalizeFirstLetter(value) + "Button").addClass("buttonNotice"); $("#config" + capitalizeFirstLetter(value) + "Button").addClass("buttonNotice");
} else { } else {
$("#config" + capitalizeFirstLetter(value) + "Button").removeClass("buttonNotice"); $("#config" + capitalizeFirstLetter(value) + "Button").removeClass("buttonNotice");
} }
}); });
}); });
function setCookie(name,value,days) { function setCookie(name, value, days) {
var expires = ""; var expires = "";
if (days) { if (days) {
var date = new Date(); var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000)); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString(); expires = "; expires=" + date.toUTCString();
} }
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax"; document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
} }
function getCookie(name) { function getCookie(name) {
var nameEQ = name + "="; var nameEQ = name + "=";
var ca = document.cookie.split(';'); var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) { for (var i = 0; i < ca.length; i++) {
var c = ca[i]; var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length); while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
} }
return null; return null;
} }

View File

@ -1,23 +1,22 @@
<?php echo template::formOpen('configForm');?> <?php echo template::formOpen('configForm');?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('configBack', [ <?php echo template::button('configBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl(false), 'href' => helper::baseUrl(false),
'ico' => 'home', 'value' => template::ico('home')
'value' => 'Accueil'
]); ?> ]); ?>
</div> </div>
<div class="col2 "> <div class="col1">
<?php echo template::button('configHelp', [ <?php echo template::button('configHelp', [
'class' => 'buttonHelp', 'class' => 'buttonHelp',
'href' => 'https://doc.zwiicms.fr/configuration-du-site', 'href' => 'https://doc.zwiicms.fr/configuration-du-site',
'target' => '_blank', 'target' => '_blank',
'ico' => 'help', 'value' => template::ico('help'),
'value' => 'Aide' 'help' => 'Consulter l\'aide en ligne'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset6"> <div class="col2 offset8">
<?php echo template::submit('Submit'); ?> <?php echo template::submit('Submit'); ?>
</div> </div>
</div> </div>

View File

@ -38,46 +38,4 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Conversion après la restauration<?php echo template::help('Conversion des URL des ressources multimédia entre deux sites aux arborescences différentes.');?></h4>
<div class="row">
<div class="col4 offset1">
<?php
if (is_null($this->getData(['core', 'baseUrl'])) ) {
$baseUrlValue = 'Pas de donnée dans la sauvegarde';
$buttonClass = 'disabled';
} elseif ($this->getData(['core', 'baseUrl']) === '') {
$baseUrlValue = '/';
$buttonClass = helper::baseUrl(false,false) !== $this->getData(['core', 'baseUrl']) ? '' : 'disabled';
} else {
$baseUrlValue = str_replace('?','',$this->getData(['core', 'baseUrl']));
$buttonClass = helper::baseUrl(false,false) !== $baseUrlValue ? '' : 'disabled';
}
echo template::text('configRestoreBaseURLToConvert', [
'label' => 'Dossier de l\'archive' ,
'value' => $baseUrlValue,
'readonly' => true,
'help' => 'Le dossier de base du site est stockée dans la sauvegarde.'
]); ?>
</div>
<div class="col4">
<?php echo template::text('configRestoreCurrentURL', [
'label' => 'Dossier du site actuel',
'value' => helper::baseUrl(false,false),
'readonly' => true
]); ?>
</div>
<div class="col2 verticalAlignMiddle">
<?php echo template::button('configRestoreUpdateBaseURLButton', [
'href' => helper::baseUrl() . 'config/updateBaseUrl',
'class' => $buttonClass,
'value' => 'convertir'
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>

View File

@ -118,26 +118,36 @@
]); ?> ]); ?>
</div> </div>
</div> </div>
<div class="rows textAlignCenter"> <div class="row">
<div class="col3"> <div class="col4 offset1">
<?php echo template::button('configBackupButton', [ <?php echo template::button('configBackupButton', [
'href' => helper::baseUrl() . 'config/backup', 'href' => helper::baseUrl() . 'config/backup',
'value' => 'Sauvegarder', 'value' => 'Sauvegarder les données du site',
'ico' => 'download-cloud' 'ico' => 'download-cloud'
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col4 offset1">
<?php echo template::button('configRestoreButton', [ <?php echo template::button('configRestoreButton', [
'href' => helper::baseUrl() . 'config/restore', 'href' => helper::baseUrl() . 'config/restore',
'value' => 'Restaurer', 'value' => 'Restaurer les données du site',
'ico' => 'upload-cloud' 'ico' => 'upload-cloud'
]); ?> ]); ?>
</div> </div>
<div class="col3"> </div>
<div class="row">
<div class="col4 offset1">
<?php echo template::button('configBackupCopyButton', [ <?php echo template::button('configBackupCopyButton', [
'href' => helper::baseUrl() . 'config/copyBackups', 'href' => helper::baseUrl() . 'config/copyBackups',
'value' => 'Copie sauvegardes auto', 'value' => 'Copier sauvegardes auto',
'ico' => 'download-cloud' 'ico' => 'docs'
]); ?>
</div>
<div class="col4 offset1">
<?php echo template::button('configBackupDelButton', [
'href' => helper::baseUrl() . 'config/delBackups',
'value' => 'Vider dossier sauvegardes auto',
'ico' => 'cancel',
'class' => 'buttonRed'
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -1,37 +1,36 @@
<?php echo template::formOpen('pageEditForm'); ?> <?php echo template::formOpen('pageEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php $href = helper::baseUrl() . $this->getUrl(2); ?> <?php $href = helper::baseUrl() . $this->getUrl(2); ?>
<?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?> <?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?>
<?php echo template::button('pageEditBack', [ <?php echo template::button('pageEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => $href, 'href' => $href,
'ico' => 'left', 'value' => template::ico('home')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col1">
<?php echo template::button('pageEditHelp', [ <?php echo template::button('pageEditHelp', [
'href' => 'https://doc.zwiicms.fr/edition-des-pages', 'href' => 'https://doc.zwiicms.fr/edition-des-pages',
'target' => '_blank', 'target' => '_blank',
'ico' => 'help', 'value' => template::ico('help'),
'value' => 'Aide', 'class' => 'buttonHelp',
'class' => 'buttonHelp' 'help' => 'Consulter l\'aide en ligne'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset2"> <div class="col1 offset6">
<?php echo template::button('pageEditDuplicate', [
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Dupliquer',
'ico' => 'clone'
]); ?>
</div>
<div class="col2">
<?php echo template::button('pageEditDelete', [ <?php echo template::button('pageEditDelete', [
'class' => 'buttonRed', 'class' => 'buttonRed',
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'], 'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Supprimer', 'value' => template::ico('cancel'),
'ico' => 'cancel' 'help' => 'Effacer la page'
]); ?>
</div>
<div class="col1">
<?php echo template::button('pageEditDuplicate', [
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => template::ico('clone'),
'help' => 'Dupliquer la page'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">

View File

@ -21,13 +21,13 @@
<h4>Identité de la fonte</h4> <h4>Identité de la fonte</h4>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::checkbox('fontAddFontImported', true, 'Fonte téléchargée sur <a href="https://cdnfonts.com" target="_blank">cdnFonts</a>', [ <?php echo template::checkbox('fontAddFontImported', true, 'Fonte téléchargée sur cdnFonts', [
'help' => 'Police utilisée en ligne, se connecter sur cdnFonts pour récupérer les informations nécessaires.' 'help' => 'Police utilisée en ligne, se connecter sur cdnFonts pour récupérer les informations nécessaires.'
]); ?> ]); ?>
</div> </div>
<div class="col6"> <div class="col6">
<?php echo template::checkbox('fontAddFontFile', true,'Fonte installée', [ <?php echo template::checkbox('fontAddFontFile', true,'Fonte installée', [
'help' => 'Sélectionnez un fichier de fonte au format WOFF.' 'help' => '<br/>Sélectionnez un fichier de fonte au format WOFF.'
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -1,15 +1,16 @@
<?php echo template::formOpen('translateFormCopy'); ?> <?php echo template::formOpen('translateFormCopy'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('translateFormCopyBack', [ <?php echo template::button('translateFormCopyBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'translate', 'href' => helper::baseUrl() . 'translate',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('translateFormCopySubmit'); ?> <?php echo template::submit('translateFormCopySubmit', [
'value' => 'Copier'
]); ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -1,28 +1,27 @@
<?php echo template::formOpen('translateForm'); ?> <?php echo template::formOpen('translateForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('translateFormBack', [ <?php echo template::button('translateFormBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl(), 'href' => helper::baseUrl(),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <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',
'ico' => 'help', 'value' => template::ico('help'),
'value' => 'Aide', 'class' => 'buttonHelp',
'class' => 'buttonHelp' 'help' => 'Consulter l\'aide en ligne'
]); ?> ]); ?>
</div> </div>
<div class="col3 offset3"> <div class="col1 offset7">
<?php echo template::button('translateButton', [ <?php echo template::button('translateButton', [
'href' => helper::baseUrl() . 'translate/copy', 'href' => helper::baseUrl() . 'translate/copy',
'value' => 'Utilitaire de copie', 'value' => template::ico('docs'),
'ico' => 'cog-alt', 'disabled' => $module::$siteTranslate,
'disabled' => $module::$siteTranslate 'help' => 'Copie de sites inter-langues'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col2">

View File

@ -346,12 +346,14 @@ class user extends common {
self::$groups[$this->getData(['user', $userId, 'group'])], self::$groups[$this->getData(['user', $userId, 'group'])],
template::button('userEdit' . $userId, [ template::button('userEdit' . $userId, [
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/'. $_SESSION['csrf'], 'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/'. $_SESSION['csrf'],
'value' => template::ico('pencil') 'value' => template::ico('pencil'),
'help' => 'Editer ' . $userId
]), ]),
template::button('userDelete' . $userId, [ template::button('userDelete' . $userId, [
'class' => 'userDelete buttonRed', 'class' => 'userDelete buttonRed',
'href' => helper::baseUrl() . 'user/delete/' . $userId. '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . 'user/delete/' . $userId. '/' . $_SESSION['csrf'],
'value' => template::ico('cancel') 'value' => template::ico('cancel'),
'help' => 'Supprimer ' . $userId
]) ])
]; ];
} }

View File

@ -1,14 +1,13 @@
<?php echo template::formOpen('userAddForm'); ?> <?php echo template::formOpen('userAddForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('userAddBack', [ <?php echo template::button('userAddBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'user', 'href' => helper::baseUrl() . 'user',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('userAddSubmit'); ?> <?php echo template::submit('userAddSubmit'); ?>
</div> </div>
</div> </div>

View File

@ -1,23 +1,21 @@
<?php echo template::formOpen('userEditForm'); ?> <?php echo template::formOpen('userEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?> <?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
<?php echo template::button('userEditBack', [ <?php echo template::button('userEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'user', 'href' => helper::baseUrl() . 'user',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
<?php else: ?> <?php else: ?>
<?php echo template::button('userEditBack', [ <?php echo template::button('userEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl(false), 'href' => helper::baseUrl(false),
'ico' => 'home', 'value' => template::ico('home')
'value' => 'Accueil'
]); ?> ]); ?>
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('userEditSubmit'); ?> <?php echo template::submit('userEditSubmit'); ?>
</div> </div>
</div> </div>

View File

@ -3,11 +3,10 @@
'label' => 'Identifiant' 'label' => 'Identifiant'
]); ?> ]); ?>
<div class="row"> <div class="row">
<div class="col3 offset6"> <div class="col1 offset9">
<?php echo template::button('userForgotBack', [ <?php echo template::button('userForgotBack', [
'href' => helper::baseUrl() . 'user/login/' . $this->getUrl(2), 'href' => helper::baseUrl() . 'user/login/' . $this->getUrl(2),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3">

View File

@ -1,23 +1,22 @@
<?php echo template::formOpen('userImportForm'); ?> <?php echo template::formOpen('userImportForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('userImportBack', [ <?php echo template::button('userImportBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'user', 'href' => helper::baseUrl() . 'user',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col1">
<?php echo template::button('userHelp', [ <?php echo template::button('userHelp', [
'href' => 'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs', 'href' => 'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs',
'target' => '_blank', 'target' => '_blank',
'ico' => 'help', 'value' => template::ico('help'),
'value' => 'Aide', 'class' => 'buttonHelp',
'class' => 'buttonHelp' 'help' => 'Consulter l\'aide en ligne'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset6"> <div class="col2 offset8">
<?php echo template::submit('userImportSubmit', [ <?php echo template::submit('userImportSubmit', [
'value' => 'Importer' 'value' => 'Importer'
]); ?> ]); ?>
@ -28,7 +27,7 @@
<div class="block"> <div class="block">
<h4>Importation de fichier plat CSV</h4> <h4>Importation de fichier plat CSV</h4>
<div class="row"> <div class="row">
<div class="col6"> <div class="col10">
<?php echo template::file('userImportCSVFile', [ <?php echo template::file('userImportCSVFile', [
'label' => 'Liste d\'utilisateurs :' 'label' => 'Liste d\'utilisateurs :'
]); ?> ]); ?>

View File

@ -1,33 +1,32 @@
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('userAddBack', [ <?php echo template::button('userAddBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl(false), 'href' => helper::baseUrl(false),
'ico' => 'home', 'value' => template::ico('home')
'value' => 'Accueil'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col1">
<?php echo template::button('userHelp', [ <?php echo template::button('userHelp', [
'href' => 'https://doc.zwiicms.fr/gestion-des-utilisateurs', 'href' => 'https://doc.zwiicms.fr/gestion-des-utilisateurs',
'target' => '_blank', 'target' => '_blank',
'ico' => 'help', 'value' => template::ico('help'),
'value' => 'Aide', 'class' => 'buttonHelp',
'class' => 'buttonHelp' 'help' => 'Consulter l\'aide en ligne'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset4"> <div class="col1 offset8">
<?php echo template::button('userImport', [ <?php echo template::button('userImport', [
'href' => helper::baseUrl() . 'user/import', 'href' => helper::baseUrl() . 'user/import',
'ico' => 'plus', 'value' => template::ico('upload') ,
'value' => 'Importation' 'help' => 'Importer des utilisateurs en masse'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col1">
<?php echo template::button('userAdd', [ <?php echo template::button('userAdd', [
'href' => helper::baseUrl() . 'user/add', 'href' => helper::baseUrl() . 'user/add',
'ico' => 'plus', 'value' => template::ico('plus'),
'value' => 'Utilisateur' 'help' => 'Ajouter un utilisateur'
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -114,7 +114,7 @@ tinymce.init({
// Active l'onglet avancé lors de l'ajout d'une image // Active l'onglet avancé lors de l'ajout d'une image
image_advtab: true, image_advtab: true,
// Urls absolues // Urls absolues
relative_urls: false, relative_urls: true,
// Url de base // Url de base
document_base_url: baseUrl, document_base_url: baseUrl,
// Gestionnaire de fichiers // Gestionnaire de fichiers
@ -294,7 +294,7 @@ tinymce.init({
// Active l'onglet avancé lors de l'ajout d'une image // Active l'onglet avancé lors de l'ajout d'une image
image_advtab: true, image_advtab: true,
// Urls absolues // Urls absolues
relative_urls: false, relative_urls: true,
// Url de base // Url de base
document_base_url: baseUrl, document_base_url: baseUrl,
// Contenu du bouton formats // Contenu du bouton formats

View File

@ -15,7 +15,7 @@
class blog extends common { class blog extends common {
const VERSION = '5.2'; const VERSION = '6.0';
const REALNAME = 'Blog'; const REALNAME = 'Blog';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -32,6 +32,7 @@ class blog extends common {
'commentDelete' => self::GROUP_MODERATOR, 'commentDelete' => self::GROUP_MODERATOR,
'commentDeleteAll' => self::GROUP_MODERATOR, 'commentDeleteAll' => self::GROUP_MODERATOR,
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_MODERATOR,
'option' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
@ -100,6 +101,9 @@ class blog extends common {
self::EDIT_OWNER => 'Propriétaire' self::EDIT_OWNER => 'Propriétaire'
]; ];
// Nombre d'articles dans la page de config:
public static $itemsperPage = 8;
public static $users = []; public static $users = [];
@ -398,103 +402,116 @@ class blog extends common {
* Configuration * Configuration
*/ */
public function config() { public function config() {
// Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès
$filterData=[];
foreach ($articleIds as $key => $value) {
if (
( // Propriétaire
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
OR $this->getUser('group') === self::GROUP_ADMIN )
)
OR (
// Groupe
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
)
OR (
// Tout le monde
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
)
) {
$filterData[] = $value;
}
}
$articleIds = $filterData;
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),self::$itemsperPage);
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) {
$a = array_values($approvals);
$toApprove = count(array_keys($a,false));
$approved = count(array_keys($a,true));
} else {
$toApprove = 0;
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
}
// Met en forme le tableau
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
self::$articles[] = [
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>',
$date .' à '. $heure,
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [
'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' ,
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved,
'help' => ($toApprove || $approved ) > 0 ? 'Editer / Approuver les commentaires' : ''
]),
template::button('blogConfigEdit' . $articleIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('pencil'),
'help' => 'Editer l\'article'
]),
template::button('blogConfigDelete' . $articleIds[$i], [
'class' => 'blogConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel'),
'help' => 'Effacer l\'article'
])
];
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration du module',
'view' => 'config'
]);
}
public function option() {
// Mise à jour des données de module // Mise à jour des données de module
$this->update(); $this->update();
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
$this->setData(['module', $this->getUrl(0), 'config',[ $this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('blogOptionShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('blogOptionFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true), 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT,true),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']) 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
]]); ]]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
'notification' => 'Modifications enregistrées', 'notification' => 'Modifications enregistrées',
'state' => true 'state' => true
]); ]);
} else { } else {
// Ids des articles par ordre de publication
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Gestion des droits d'accès
$filterData=[];
foreach ($articleIds as $key => $value) {
if (
( // Propriétaire
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
OR $this->getUser('group') === self::GROUP_ADMIN )
)
OR (
// Groupe
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
)
OR (
// Tout le monde
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
)
) {
$filterData[] = $value;
}
}
$articleIds = $filterData;
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Nombre de commentaires à approuver et approuvés
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
if ( is_array($approvals) ) {
$a = array_values($approvals);
$toApprove = count(array_keys($a,false));
$approved = count(array_keys($a,true));
} else {
$toApprove = 0;
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
}
// Met en forme le tableau
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
self::$articles[] = [
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>',
$date .' à '. $heure,
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [
'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' ,
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
]),
template::button('blogConfigEdit' . $articleIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('pencil')
]),
template::button('blogConfigDelete' . $articleIds[$i], [
'class' => 'blogConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel')
])
];
}
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration du module', 'title' => 'Options de configuration',
'view' => 'config' 'view' => 'option'
]); ]);
} }
} }
/** /**
* Suppression * Suppression
*/ */

2
module/blog/changes.md Normal file
View File

@ -0,0 +1,2 @@
# version 6
- mise à la norme avec le module news : le formulaire est sorti de l'écran principal

View File

@ -1,17 +1,16 @@
<?php echo template::formOpen('blogAddForm'); ?> <?php echo template::formOpen('blogAddForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('blogAddBack', [ <?php echo template::button('blogAddBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col3 offset5"> <div class="col2 offset7">
<?php echo template::button('blogAddDraft', [ <?php echo template::button('blogAddDraft', [
'uniqueSubmission' => true, 'uniqueSubmission' => true,
'value' => 'Enregistrer en brouillon' 'value' => 'Brouillon'
]); ?> ]); ?>
<?php echo template::hidden('blogAddState', [ <?php echo template::hidden('blogAddState', [
'value' => true 'value' => true

View File

@ -1,51 +1,27 @@
<?php echo template::formOpen('blogConfig'); ?> <?php echo template::formOpen('blogConfig'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('blogConfigBack', [ <?php echo template::button('blogConfigBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'posts', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'posts',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset6"> <div class="col1 offset9">
<?php echo template::button('blogConfigOption', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/option',
'value' => template::ico('sliders'),
'help' => 'Options de configuration'
]); ?>
</div>
<div class="col1">
<?php echo template::button('blogConfigAdd', [ <?php echo template::button('blogConfigAdd', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/add', 'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
'ico' => 'plus', 'value' => template::ico('plus'),
'value' => 'Article' 'help' => 'Rédiger un article'
]); ?> ]); ?>
</div> </div>
<div class="col2">
<?php echo template::submit('blogConfigSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres du module</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('blogConfigShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col6">
<?php echo template::text('blogConfigFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6 offset6">
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
</div>
</div>
</div>
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<?php if($module::$articles): ?> <?php if($module::$articles): ?>

View File

@ -1,17 +1,16 @@
<?php echo template::formOpen('blogEditForm'); ?> <?php echo template::formOpen('blogEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('blogEditBack', [ <?php echo template::button('blogEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col3 offset5"> <div class="col3 offset6">
<?php echo template::button('blogEditDraft', [ <?php echo template::button('blogEditDraft', [
'uniqueSubmission' => true, 'uniqueSubmission' => true,
'value' => 'Enregistrer en brouillon' 'value' => 'Brouillon'
]); ?> ]); ?>
<?php echo template::hidden('blogEditState', [ <?php echo template::hidden('blogEditState', [
'value' => true 'value' => true

View File

@ -41,7 +41,7 @@
: utf8_encode(strftime('%d %B %Y', $article['publishedOn'])); ?> : utf8_encode(strftime('%d %B %Y', $article['publishedOn'])); ?>
</div> </div>
<p class="blogContent"> <p class="blogContent">
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>... <?php echo helper::subword(strip_tags($article['content']), 0, 400); ?>...
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">Lire la suite</a> <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">Lire la suite</a>
</p> </p>
</div> </div>

View File

@ -0,0 +1,18 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,46 @@
<?php echo template::formOpen('blogOption'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('blogOptionBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('blogOptionSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres du module</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col6">
<?php echo template::text('blogOptionFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6 offset6">
<?php echo template::select('blogOptionItemsperPage', $module::$ItemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::VERSION; ?>
</div>

3
module/form/changes.md Normal file
View File

@ -0,0 +1,3 @@
# Version 3
- Déplacement des options de formulaires
- Gabarit du formulaire sur la page

View File

@ -16,7 +16,7 @@
class form extends common { class form extends common {
const VERSION = '2.11'; const VERSION = '3.0';
const REALNAME = 'Formulaire'; const REALNAME = 'Formulaire';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -24,6 +24,7 @@ class form extends common {
public static $actions = [ public static $actions = [
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_MODERATOR,
'option' => self::GROUP_MODERATOR,
'data' => self::GROUP_MODERATOR, 'data' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR,
'deleteall' => self::GROUP_MODERATOR, 'deleteall' => self::GROUP_MODERATOR,
@ -38,6 +39,9 @@ class form extends common {
public static $pagination; public static $pagination;
// Nombre d'articles dans la page de config:
public static $itemperPage = 20;
// Objets // Objets
const TYPE_MAIL = 'mail'; const TYPE_MAIL = 'mail';
@ -75,38 +79,35 @@ class form extends common {
'100' => '100%' '100' => '100%'
]; ];
public static $optionOffset = [
0 => 'Aucune',
1 => 'Une colonne',
2 => 'Deux colonnes'
];
public static $optionWidth = [
6 => 'Six colonnes',
7 => 'Sept colonnes',
8 => 'Huit colonnes',
9 => 'Neuf colonnes',
10 => 'Dix colonnes',
11 => 'Onze colonnes',
12 => 'Douze colonnes',
];
public static $optionAlign = [
'' => 'A gauche',
'textAlignCenter' => 'Au centre',
'textAlignRight' => 'A droite'
];
/** /**
* Configuration * Configuration
*/ */
public function config() { public function config() {
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
self::$listUsers [] = '';
foreach($userIdsFirstnames as $userId => $userFirstname) {
self::$listUsers [] = $userId;
}
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
// Configuration
$this->setData([
'module',
$this->getUrl(0),
'config',
[
'button' => $this->getInput('formConfigButton'),
'captcha' => $this->getInput('formConfigCaptcha', helper::FILTER_BOOLEAN),
'group' => $this->getInput('formConfigGroup', helper::FILTER_INT),
'user' => self::$listUsers [$this->getInput('formConfigUser', helper::FILTER_INT)],
'mail' => $this->getInput('formConfigMail') ,
'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '',
'subject' => $this->getInput('formConfigSubject'),
'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN),
'signature' => $this->getInput('formConfigSignature'),
'logoUrl' => $this->getInput('formConfigLogo'),
'logoWidth' => $this->getInput('formConfigLogoWidth')
]
]);
// Génération des données vides // Génération des données vides
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) { if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
$this->setData(['module', $this->getUrl(0), 'data', []]); $this->setData(['module', $this->getUrl(0), 'data', []]);
@ -148,6 +149,75 @@ class form extends common {
]); ]);
} }
public function option() {
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
self::$listUsers [] = '';
foreach ($userIdsFirstnames as $userId => $userFirstname) {
self::$listUsers [] = $userId;
}
// Soumission du formulaire
if ($this->isPost()) {
// Débordement
$width = $this->getInput('formOptionWidth');
if ($this->getInput('formOptionWidth',helper::FILTER_INT) + $this->getInput('formOptionOffset',helper::FILTER_INT) > 12 ) {
$width = (string) $this->getInput('formOptionWidth',helper::FILTER_INT) - $this->getInput('formOptionOffset',helper::FILTER_INT);
}
// Configuration
$this->setData([
'module',
$this->getUrl(0),
'config',
[
'button' => $this->getInput('formOptionButton'),
'captcha' => $this->getInput('formOptionCaptcha', helper::FILTER_BOOLEAN),
'group' => $this->getInput('formOptionGroup', helper::FILTER_INT),
'user' => self::$listUsers [$this->getInput('formOptionUser', helper::FILTER_INT)],
'mail' => $this->getInput('formOptionMail') ,
'pageId' => $this->getInput('formOptionPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formOptionPageId', helper::FILTER_ID) : '',
'subject' => $this->getInput('formOptionSubject'),
'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN),
'signature' => $this->getInput('formOptionSignature'),
'logoUrl' => $this->getInput('formOptionLogo'),
'logoWidth' => $this->getInput('formOptionLogoWidth'),
'offset' =>$this->getInput('formOptionOffset'),
'width' =>$width,
'align' =>$this->getInput('formOptionAlign'),
]
]);
// Génération des données vides
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
$this->setData(['module', $this->getUrl(0), 'data', []]);
}
// Valeurs en sortie
$this->addOutput([
'notification' => 'Modifications enregistrées' ,
'redirect' => helper::baseUrl() . $this->getUrl(),
'state' => true
]);
} else {
// Liste des pages
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
foreach($childrenPageIds as $childKey) {
self::$pages[$childKey] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $this->getData(['page', $childKey, 'title']);
}
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Options de configuration',
'vendor' => [
'html-sortable',
'flatpickr'
],
'view' => 'option'
]);
}
}
/** /**
* Données enregistrées * Données enregistrées
*/ */
@ -155,7 +225,7 @@ class form extends common {
$data = $this->getData(['module', $this->getUrl(0), 'data']); $data = $this->getData(['module', $this->getUrl(0), 'data']);
if($data) { if($data) {
// Pagination // Pagination
$pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE); $pagination = helper::pagination($data, $this->getUrl(), self::$itemsperPages);
// Liste des pages // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Inverse l'ordre du tableau // Inverse l'ordre du tableau

View File

@ -54,6 +54,15 @@ function add(inputUid, input) {
position(); position();
} }
/**
* Afficher/cacher les options supplémentaires
*/
$(document).on("click", ".formConfigMoreToggle", function() {
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
});
/** /**
* Calcul des positions * Calcul des positions
*/ */
@ -76,14 +85,6 @@ if(inputs) {
}); });
} }
/**
* Afficher/cacher les options supplémentaires
*/
$(document).on("click", ".formConfigMoreToggle", function() {
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
});
/** /**
* Crée un nouveau champ à partir des champs cachés * Crée un nouveau champ à partir des champs cachés
@ -96,6 +97,12 @@ $("#formConfigAdd").on("click", function() {
/** /**
* Actions sur les champs * Actions sur les champs
*/ */
// Validation auto après ajout d'un champ
$("a#formConfigAdd.button").click(function () {
$("#formConfigForm").submit();
});
// Tri entre les champs // Tri entre les champs
sortable("#formConfigInputs", { sortable("#formConfigInputs", {
forcePlaceholderSize: true, forcePlaceholderSize: true,
@ -143,73 +150,3 @@ $("#formConfigInputs")
}); });
// Simule un changement de type au chargement de la page // Simule un changement de type au chargement de la page
$(".formConfigType").trigger("change"); $(".formConfigType").trigger("change");
/**
* Affiche/cache les options de la case à cocher du mail
*/
$("#formConfigMailOptionsToggle").on("change", function() {
if($(this).is(":checked")) {
$("#formConfigMailOptions").slideDown();
}
else {
$("#formConfigMailOptions").slideUp(function() {
$("#formConfigGroup").val("");
$("#formConfigSubject").val("");
$("#formConfigMail").val("");
$("#formConfigUser").val("");
});
}
}).trigger("change");
/**
* Affiche/cache les options de la case à cocher de la redirection
*/
$("#formConfigPageIdToggle").on("change", function() {
if($(this).is(":checked")) {
$("#formConfigPageIdWrapper").slideDown();
}
else {
$("#formConfigPageIdWrapper").slideUp(function() {
$("#formConfigPageId").val("");
});
}
}).trigger("change");
/**
* Paramètres par défaut au chargement
*/
$( document ).ready(function() {
/**
* Masquer ou afficher la sélection du logo
*/
if ($("#formConfigSignature").val() !== "text") {
$("#formConfigLogoWrapper").addClass("disabled");
$("#formConfigLogoWrapper").slideDown();
$("#formConfigLogoWidthWrapper").addClass("disabled");
$("#formConfigLogoWidthWrapper").slideDown();
} else {
$("#formConfigLogoWrapper").removeClass("disabled");
$("#formConfigLogoWrapper").slideUp();
$("#formConfigLogoWidthWrapper").removeClass("disabled");
$("#formConfigLogoWidthWrapper").slideUp();
}
});
/**
* Masquer ou afficher la sélection du logo
*/
var formConfigSignatureDOM = $("#formConfigSignature");
formConfigSignatureDOM.on("change", function() {
if ($(this).val() !== "text") {
$("#formConfigLogoWrapper").addClass("disabled");
$("#formConfigLogoWrapper").slideDown();
$("#formConfigLogoWidthWrapper").addClass("disabled");
$("#formConfigLogoWidthWrapper").slideDown();
} else {
$("#formConfigLogoWrapper").removeClass("disabled");
$("#formConfigLogoWrapper").slideUp();
$("#formConfigLogoWidthWrapper").removeClass("disabled");
$("#formConfigLogoWidthWrapper").slideUp();
}
});

View File

@ -49,140 +49,48 @@
</div> </div>
</div> </div>
<?php echo template::formOpen('formConfigForm'); ?> <?php echo template::formOpen('formConfigForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('formConfigBack', [ <?php echo template::button('formConfigBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour' ]); ?>
]); ?> </div>
</div> <div class="col1 offset7">
<div class="col3 offset5"> <?php echo template::button('formConfigData', [
<?php echo template::button('formConfigData', [ 'href' => helper::baseUrl() . $this->getUrl(0) . '/data',
'href' => helper::baseUrl() . $this->getUrl(0) . '/data', 'value' => template::ico('code'),
'value' => 'Gérer les données' 'help' => 'Voir et exporter les données du formulaire'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col1">
<?php echo template::button('formConfigLayout', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/option',
'value' => template::ico('sliders'),
'help' => 'Options de configuration'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('formConfigSubmit'); ?> <?php echo template::submit('formConfigSubmit'); ?>
</div> </div>
</div>
<div class="block">
<h4>Liste des champs</h4>
<div id="formConfigNoInput">
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
</div> </div>
<div id="formConfigInputs"></div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col1 offset11">
<div class="block"> <?php echo template::button('formConfigAdd', [
<h4>Configuration</h4> 'value' => template::ico('plus'),
<?php echo template::text('formConfigButton', [ 'class' => 'buttonGreen'
'help' => 'Laissez vide afin de conserver le texte par défaut.', ]); ?>
'label' => 'Texte du bouton de soumission',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button'])
]); ?>
<?php echo template::checkbox('formConfigMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saississez un email. Votre serveur doit autoriser les envois de mail.'
]); ?>
<div id="formConfigMailOptions" class="displayNone">
<div class="row">
<div class="col11 offset1">
<?php echo template::text('formConfigSubject', [
'help' => 'Laissez vide afin de conserver le texte par défaut.',
'label' => 'Sujet du mail',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject'])
]); ?>
</div>
</div>
<?php
// Element 0 quand aucun membre a été sélectionné
$groupMembers = [''] + $module::$groupNews;
?>
<div class="row">
<div class="col3 offset1">
<?php echo template::select('formConfigGroup', $groupMembers, [
'label' => 'Aux groupes à partir de',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?>
</div>
<div class="col3">
<?php echo template::select('formConfigUser', $module::$listUsers, [
'label' => 'A un membre',
'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers)
]); ?>
</div>
<div class="col4">
<?php echo template::text('formConfigMail', [
'label' => 'A une adresse email',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']),
'help' => 'Un email ou une liste de diffusion'
]); ?>
</div>
</div>
<div class="row">
<div class="col6 offset1">
<?php echo template::checkbox('formConfigMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
'help' => 'Cette option permet de réponse drectement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
]); ?>
</div>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('formConfigSignature', $module::$signature, [
'label' => 'Sélectionner le type de signature',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
]); ?>
</div>
<div class="col4">
<?php echo template::file('formConfigLogo', [
'help' => 'Sélectionnez le logo du site',
'label' => 'Logo',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('formConfigLogoWidth', $module::$logoWidth, [
'label' => 'Sélectionner la largeur du logo',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('formConfigPageIdToggle', true, 'Redirection après soumission du formulaire', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
]); ?>
</div>
<div class="col5">
<?php echo template::select('formConfigPageId', $module::$pages, [
'classWrapper' => 'displayNone',
'label' => 'Sélectionner une page du site :',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
]); ?>
</div>
</div>
<?php echo template::checkbox('formConfigCaptcha', true, 'Valider un captcha afin de soumettre le formulaire.', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
]); ?>
</div>
<div class="block">
<h4>Liste des champs</h4>
<div id="formConfigNoInput">
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
</div>
<div id="formConfigInputs"></div>
<div class="row">
<div class="col1 offset11">
<?php echo template::button('formConfigAdd', [
'value' => template::ico('plus')
]); ?>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div>
</div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<div class="moduleVersion">Version <div class="moduleVersion">Version
<?php echo $module::VERSION; ?> <?php echo $module::VERSION; ?>

View File

@ -1,25 +1,24 @@
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('formDataBack', [ <?php echo template::button('formDataBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset6"> <div class="col1 offset9">
<?php echo template::button('formDataDeleteAll', [ <?php echo template::button('formDataDeleteAll', [
'class' => 'formDataDeleteAll buttonRed', 'class' => 'formDataDeleteAll buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'],
'ico' => 'cancel', 'value' => template::ico('cancel'),
'value' => 'Tout effacer' 'help' => 'Effacer toutes les données'
]); ?> ]); ?>
</div> </div>
<div class="col2"> <div class="col1">
<?php echo template::button('formDataBack', [ <?php echo template::button('formDataBack', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'],
'ico' => 'download', 'value' => template::ico('download'),
'value' => 'Export CSV' 'help' => 'Exporter toutes les données'
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -1,67 +1,75 @@
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?> <?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
<?php echo template::formOpen('formForm'); ?> <div class="row <?php echo $this->getData(['module', $this->getUrl(0), 'config', 'align']);?>">
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> <div class="<?php
<?php if($input['type'] === $module::TYPE_MAIL): ?> echo 'col' . $this->getData(['module', $this->getUrl(0), 'config', 'width']) . ' ';
<?php echo template::mail('formInput[' . $index . ']', [ echo $this->getData(['module', $this->getUrl(0), 'config', 'offset']) !== 0 ? 'offset' . $this->getData(['module', $this->getUrl(0), 'config', 'offset']) : '';
'id' => 'formInput_' . $index, ?>">
'label' => $input['name'] <?php echo template::formOpen('formForm'); ?>
]); ?> <?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
<?php elseif($input['type'] === $module::TYPE_SELECT): ?> <?php if($input['type'] === $module::TYPE_MAIL): ?>
<?php <?php echo template::mail('formInput[' . $index . ']', [
$values = array_flip(explode(',', $input['values'])); 'id' => 'formInput_' . $index,
foreach($values as $value => $key) { 'label' => $input['name']
$values[$value] = trim($value); ]); ?>
} <?php elseif($input['type'] === $module::TYPE_SELECT): ?>
?> <?php
<?php echo template::select('formInput[' . $index . ']', $values, [ $values = array_flip(explode(',', $input['values']));
'id' => 'formInput_' . $index, foreach($values as $value => $key) {
'label' => $input['name'] $values[$value] = trim($value);
]); ?> }
<?php elseif($input['type'] === $module::TYPE_TEXT): ?> ?>
<?php echo template::text('formInput[' . $index . ']', [ <?php echo template::select('formInput[' . $index . ']', $values, [
'id' => 'formInput_' . $index, 'id' => 'formInput_' . $index,
'label' => $input['name'] 'label' => $input['name']
]); ?> ]); ?>
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?> <?php elseif($input['type'] === $module::TYPE_TEXT): ?>
<?php echo template::textarea('formInput[' . $index . ']', [ <?php echo template::text('formInput[' . $index . ']', [
'id' => 'formInput_' . $index, 'id' => 'formInput_' . $index,
'label' => $input['name'] 'label' => $input['name']
]); ?> ]); ?>
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?> <?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
<?php echo template::date('formInput[' . $index . ']', [ <?php echo template::textarea('formInput[' . $index . ']', [
'id' => 'formInput_' . $index, 'id' => 'formInput_' . $index,
'label' => $input['name'], 'label' => $input['name']
'vendor' => 'flatpickr' ]); ?>
]); ?> <?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?> <?php echo template::date('formInput[' . $index . ']', [
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name'] 'id' => 'formInput_' . $index,
); ?> 'label' => $input['name'],
<?php elseif($input['type'] === $module::TYPE_LABEL): ?> 'vendor' => 'flatpickr'
<h3 class='formLabel'> ]); ?>
<?php echo $input['name']; ?> <?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
<hr class="formLabel"> <?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
</h3> ); ?>
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
<h3 class='formLabel'>
<?php echo $input['name']; ?>
<hr class="formLabel">
</h3>
<?php endif; ?>
<?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
<div class="row">
<div class="col12 textAlignCenter">
<?php echo template::captcha('formCaptcha', [
'limit' => $this->getData(['config','connect', 'captchaStrong']),
'type' => $this->getData(['config','connect', 'captchaType'])
]); ?>
</div>
</div>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
<div class="row"> <div class="row">
<div class="col12 textAlignCenter"> <div class="col2 offset10">
<?php echo template::captcha('formCaptcha', [ <?php echo template::submit('formSubmit', [
'limit' => $this->getData(['config','connect', 'captchaStrong']), 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer',
'type' => $this->getData(['config','connect', 'captchaType']) 'ico' => ''
]); ?> ]); ?>
</div> </div>
</div> </div>
<?php endif; ?>
<div class="row">
<div class="col2 offset10">
<?php echo template::submit('formSubmit', [
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer',
'ico' => ''
]); ?>
</div>
</div> </div>
<?php echo template::formClose(); ?> </div>
</div>
<?php echo template::formClose(); ?>
<?php else: ?> <?php else: ?>
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?> <?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -0,0 +1,18 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,72 @@
/*
* Affiche/cache les options de la case à cocher du mail
*/
$("#formOptionMailOptionsToggle").on("change", function() {
if($(this).is(":checked")) {
$("#formOptionMailOptions").slideDown();
}
else {
$("#formOptionMailOptions").slideUp(function() {
$("#formOptionGroup").val("");
$("#formOptionSubject").val("");
$("#formOptionMail").val("");
$("#formOptionUser").val("");
});
}
}).trigger("change");
/**
* Affiche/cache les options de la case à cocher de la redirection
*/
$("#formOptionPageIdToggle").on("change", function() {
if($(this).is(":checked")) {
$("#formOptionPageIdWrapper").slideDown();
}
else {
$("#formOptionPageIdWrapper").slideUp(function() {
$("#formOptionPageId").val("");
});
}
}).trigger("change");
/**
* Paramètres par défaut au chargement
*/
$( document ).ready(function() {
/**
* Masquer ou afficher la sélection du logo
*/
if ($("#formOptionSignature").val() !== "text") {
$("#formOptionLogoWrapper").addClass("disabled");
$("#formOptionLogoWrapper").slideDown();
$("#formOptionLogoWidthWrapper").addClass("disabled");
$("#formOptionLogoWidthWrapper").slideDown();
} else {
$("#formOptionLogoWrapper").removeClass("disabled");
$("#formOptionLogoWrapper").slideUp();
$("#formOptionLogoWidthWrapper").removeClass("disabled");
$("#formOptionLogoWidthWrapper").slideUp();
}
});
/**
* Masquer ou afficher la sélection du logo
*/
var formOptionSignatureDOM = $("#formOptionSignature");
formOptionSignatureDOM.on("change", function() {
if ($(this).val() !== "text") {
$("#formOptionLogoWrapper").addClass("disabled");
$("#formOptionLogoWrapper").slideDown();
$("#formOptionLogoWidthWrapper").addClass("disabled");
$("#formOptionLogoWidthWrapper").slideDown();
} else {
$("#formOptionLogoWrapper").removeClass("disabled");
$("#formOptionLogoWrapper").slideUp();
$("#formOptionLogoWidthWrapper").removeClass("disabled");
$("#formOptionLogoWidthWrapper").slideUp();
}
});

View File

@ -0,0 +1,157 @@
<?php echo template::formOpen('formOptionForm'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('formOptionBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('formOptionSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Validation du formulaire</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('formOptionCaptcha', true, 'Captcha', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
]); ?>
</div>
<div class="col6">
<?php echo template::text('formOptionButton', [
'help' => 'Laissez vide afin de conserver le texte par défaut.',
'label' => 'Etiquette du bouton de soumission',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('formOptionPageIdToggle', true, 'Redirection après soumission du formulaire', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
]); ?>
</div>
<div class="col5">
<?php echo template::select('formOptionPageId', $module::$pages, [
'classWrapper' => 'displayNone',
'label' => 'Page du site :',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Gabarit</h4>
<div class="row">
<div class="col6">
<?php echo template::select('formOptionAlign', $module::$optionAlign, [
'label' => 'Alignement du formulaire',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'align'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::select('formOptionOffset', $module::$optionOffset, [
'label' => 'Décalage à gauche',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'offset'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('formOptionWidth', $module::$optionWidth, [
'label' => 'Largeur',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'width'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Courriel</h4>
<?php echo template::checkbox('formOptionMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saisissez un email. Votre serveur doit autoriser les envois de mail.'
]); ?>
<div id="formOptionMailOptions" class="displayNone">
<div class="row">
<div class="col12">
<?php echo template::text('formOptionSubject', [
'help' => 'Laissez vide afin de conserver le texte par défaut.',
'label' => 'Sujet du mail',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject'])
]); ?>
</div>
</div>
<?php
// Element 0 quand aucun membre a été sélectionné
$groupMembers = [''] + $module::$groupNews;
?>
<div class="row">
<div class="col4">
<?php echo template::select('formOptionGroup', $groupMembers, [
'label' => 'Aux groupes à partir de',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?>
</div>
<div class="col4">
<?php echo template::select('formOptionUser', $module::$listUsers, [
'label' => 'A un membre',
'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers)
]); ?>
</div>
<div class="col4">
<?php echo template::text('formOptionMail', [
'label' => 'A une adresse email',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']),
'help' => 'Un email ou une liste de diffusion'
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('formOptionSignature', $module::$signature, [
'label' => 'Sélectionner le type de signature',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
]); ?>
</div>
<div class="col4">
<?php echo template::file('formOptionLogo', [
'help' => 'Sélectionnez le logo du site',
'label' => 'Logo',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('formOptionLogoWidth', $module::$logoWidth, [
'label' => 'Sélectionner la largeur du logo',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('formOptionMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
'help' => 'Cette option permet de réponse directement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
]); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,2 @@
# version 3.4
- Changement de nom du bouton Thème devient mise en page

View File

@ -17,7 +17,7 @@
class gallery extends common { class gallery extends common {
const VERSION = '3.3'; const VERSION = '3.4';
const REALNAME = 'Galerie'; const REALNAME = 'Galerie';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -346,12 +346,14 @@ class gallery extends common {
$gallery['config']['directory'], $gallery['config']['directory'],
template::button('galleryConfigEdit' . $galleryId , [ template::button('galleryConfigEdit' . $galleryId , [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'],
'value' => template::ico('pencil') 'value' => template::ico('pencil'),
'help' => 'Configuration de la galerie '
]), ]),
template::button('galleryConfigDelete' . $galleryId, [ template::button('galleryConfigDelete' . $galleryId, [
'class' => 'galleryConfigDelete buttonRed', 'class' => 'galleryConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel') 'value' => template::ico('cancel'),
'help' => 'Supprimer cette galerie'
]) ])
]; ];
// Tableau des id des galleries pour le drag and drop // Tableau des id des galleries pour le drag and drop

View File

@ -1,17 +1,17 @@
<?php echo template::formOpen('galleryConfigForm'); ?> <?php echo template::formOpen('galleryConfigForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('galleryConfigBack', [ <?php echo template::button('galleryConfigBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col1 offset10">
<?php echo template::button('galleryConfigBack', [ <?php echo template::button('galleryConfigBack', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'],
'value' => template::ico('brush','right') . 'Thème' 'value' => template::ico('sliders'),
'help' => 'Options de configuration'
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -1,14 +1,13 @@
<?php echo template::formOpen('galleryEditForm'); ?> <?php echo template::formOpen('galleryEditForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('galleryEditBack', [ <?php echo template::button('galleryEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('galleryEditSubmit'); ?> <?php echo template::submit('galleryEditSubmit'); ?>
</div> </div>
</div> </div>

View File

@ -1,10 +1,9 @@
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('galleryGalleryBack', [ <?php echo template::button('galleryGalleryBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0), 'href' => helper::baseUrl() . $this->getUrl(0),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
</div> </div>

View File

@ -1,15 +1,14 @@
<?php echo template::formOpen('galleryThemeForm'); ?> <?php echo template::formOpen('galleryThemeForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('galleryThemeBack', [ <?php echo template::button('galleryThemeBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('galleryThemeBack'); ?> <?php echo template::submit('galleryThemeBack'); ?>
</div> </div>
</div> </div>

6
module/news/changes.md Normal file
View File

@ -0,0 +1,6 @@
# Version 4
- Config : le nombre d'objet est fixe, constante dans news.php
- Ecran layout réservé à la configuration et au thème
- Bug avec l'initialisation, fichier css déclaré mais absent
A faire partie CSS à amléiorer au niveau des options

View File

@ -15,7 +15,7 @@
class news extends common { class news extends common {
const VERSION = '3.7'; const VERSION = '4.0';
const REALNAME = 'News'; const REALNAME = 'News';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -23,7 +23,8 @@ class news extends common {
public static $actions = [ public static $actions = [
'add' => self::GROUP_MODERATOR, 'add' => self::GROUP_MODERATOR,
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_MODERATOR, // Edition des news
'option' => self::GROUP_MODERATOR, // paramétrage des news
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
@ -88,7 +89,8 @@ class news extends common {
// Signature de l'article // Signature de l'article
public static $articleSignature = ''; public static $articleSignature = '';
// Nombre d'articles dans la page de config:
public static $itemsperPage = 8;
/** /**
* Flux RSS * Flux RSS
@ -189,10 +191,65 @@ class news extends common {
// Mise à jour des données de module // Mise à jour des données de module
$this->update(); $this->update();
// Ids des news par ordre de publication
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Pagination fixe
$pagination = helper::pagination($newsIds, $this->getUrl(),self::$itemsperPage );
// Liste des pages
self::$pages = $pagination['pages'];
// News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau
$dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
$dateOn .= ' à ';
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
$dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
$dateOff .= ' à ';
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
} else {
$dateOff = 'Permanent';
}
self::$news[] = [
$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
$dateOn,
$dateOff,
self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
template::button('newsConfigEdit' . $newsIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
'value' => template::ico('pencil'),
'help' => 'Editer cette nouvelle'
]),
template::button('newsConfigDelete' . $newsIds[$i], [
'class' => 'newsConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel'),
'help' => 'Effacer cette nouvelle'
])
];
}
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration du module',
'view' => 'config',
'vendor' => [
'tinycolorpicker'
]
]);
}
public function option() {
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
// Générer la feuille de CSS // Générer la feuille de CSS
$style = '.newsFrame {'; $style = '.newsFrame {';
$style .= 'border:' . $this->getInput('newsThemeBorderStyle',helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth',helper::FILTER_STRING_SHORT) . ';'; $style .= 'border:' . $this->getInput('newsThemeBorderStyle',helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth',helper::FILTER_STRING_SHORT) . ';';
@ -217,69 +274,26 @@ class news extends common {
]]); ]]);
$this->setData(['module', $this->getUrl(0), 'config',[ $this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('newsOptionShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('newsOptionFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true), 'itemsperPage' => $this->getInput('newsOptionItemsperPage', helper::FILTER_INT,true),
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true), 'itemsperCol' => $this->getInput('newsOptionItemsperCol', helper::FILTER_INT,true),
'height' => $this->getInput('newsConfigHeight', helper::FILTER_INT,true), 'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT,true),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']) 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
]]); ]]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
'notification' => 'Modifications enregistrées', 'notification' => 'Modifications enregistrées',
'state' => true 'state' => true
]); ]);
} else { } else {
// Ids des news par ordre de publication
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
// Liste des pages
self::$pages = $pagination['pages'];
// News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau
$dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
$dateOn .= ' à ';
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
$dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
$dateOff .= ' à ';
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
} else {
$dateOff = 'Permanent';
}
self::$news[] = [
$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
$dateOn,
$dateOff,
self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
template::button('newsConfigEdit' . $newsIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
'value' => template::ico('pencil')
]),
template::button('newsConfigDelete' . $newsIds[$i], [
'class' => 'newsConfigDelete buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel')
])
];
}
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => 'Configuration du module', 'title' => 'Options de configuration',
'view' => 'config', 'view' => 'option',
'vendor' => [ 'vendor' => [
'tinycolorpicker' 'tinycolorpicker'
] ]
@ -435,8 +449,7 @@ class news extends common {
$newsIds[] = $newsId; $newsIds[] = $newsId;
} }
} }
// Pagination // Pagination selon le layout
//$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])); $pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
// Nombre de colonnes // Nombre de colonnes
self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']); self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']);

View File

@ -1,17 +1,16 @@
<?php echo template::formOpen('newsAddForm'); ?> <?php echo template::formOpen('newsAddForm'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('newsAddBack', [ <?php echo template::button('newsAddBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col3 offset5"> <div class="col2 offset7">
<?php echo template::button('newsAddDraft', [ <?php echo template::button('newsAddDraft', [
'uniqueSubmission' => true, 'uniqueSubmission' => true,
'value' => 'Enregistrer en brouillon' 'value' => 'Brouillon'
]); ?> ]); ?>
<?php echo template::hidden('newsAddState', [ <?php echo template::hidden('newsAddState', [
'value' => true 'value' => true

View File

@ -1,102 +1,28 @@
<?php echo template::formOpen('newsConfig'); ?> <?php echo template::formOpen('newsConfig'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('newsConfigBack', [ <?php echo template::button('newsConfigBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),'posts', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),'posts',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset6"> <div class="col1 offset9">
<?php echo template::button('newsConfigLayout', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/option',
'value' => template::ico('sliders'),
'help' => 'Options de configuration'
]); ?>
</div>
<div class="col1">
<?php echo template::button('newsConfigAdd', [ <?php echo template::button('newsConfigAdd', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/add', 'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
'ico' => 'plus', 'value' => template::ico('plus'),
'value' => 'News' 'help' => 'Rédiger une news'
]); ?> ]); ?>
</div> </div>
<div class="col2">
<?php echo template::submit('newsConfigSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres du module</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('newsConfigShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
'help' => 'Flux limité aux articles de la première page.'
]); ?>
</div>
<div class="col6">
<?php echo template::text('newsConfigFeedslabel', [
'label' => 'Etiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('newsConfigItemsperCol', $module::$columns, [
'label' => 'Nombre de colonnes',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsConfigItemsperPage', $module::$itemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsConfigHeight', $module::$height, [
'label' => 'Abrégé de l\'article',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Thème du module</h4>
<div class="row">
<div class="col3">
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
'label' => 'Bordure',
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
]); ?>
</div>
<div class="col3">
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
'label' => 'Epaisseur',
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBorderColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur de la bordure',
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur du fond',
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
]); ?>
</div>
</div>
</div>
</div>
</div> </div>
<?php if($module::$news): ?> <?php if($module::$news): ?>
<?php echo template::table([4, 2, 2, 2, 1, 1], $module::$news, ['Titre', 'Publication', 'Dépublication', 'État', '', '']); ?> <?php echo template::table([4, 2, 2, 2, 1, 1], $module::$news, ['Titre', 'Publication', 'Dépublication', 'État', '', '']); ?>
<?php echo $module::$pages; ?> <?php echo $module::$pages; ?>

View File

@ -4,14 +4,13 @@
<?php echo template::button('newsEditBack', [ <?php echo template::button('newsEditBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col3 offset5"> <div class="col2 offset6">
<?php echo template::button('newsEditDraft', [ <?php echo template::button('newsEditDraft', [
'uniqueSubmission' => true, 'uniqueSubmission' => true,
'value' => 'Enregistrer en brouillon' 'value' => 'Brouillon'
]); ?> ]); ?>
<?php echo template::hidden('newsEditState', [ <?php echo template::hidden('newsEditState', [
'value' => true 'value' => true

View File

@ -0,0 +1,18 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,95 @@
<?php echo template::formOpen('newsOption'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('newsOptionBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('newsOptionSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres du module</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
'help' => 'Flux limité aux articles de la première page.'
]); ?>
</div>
<div class="col6">
<?php echo template::text('newsOptionFeedslabel', [
'label' => 'Etiquette RSS',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
'label' => 'Nombre de colonnes',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('newsOptionHeight', $module::$height, [
'label' => 'Abrégé de l\'article',
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Thème du module</h4>
<div class="row">
<div class="col3">
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
'label' => 'Bordure',
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
]); ?>
</div>
<div class="col3">
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
'label' => 'Epaisseur',
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBorderColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur de la bordure',
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
]); ?>
</div>
<div class="col3">
<?php echo template::text('newsThemeBackgroundColor', [
'class' => 'colorPicker',
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur du fond',
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::VERSION; ?>
</div>

View File

@ -1,14 +1,13 @@
<?php echo template::formOpen('redirectionConfig'); ?> <?php echo template::formOpen('redirectionConfig'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('redirectionConfigBack', [ <?php echo template::button('redirectionConfigBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('redirectionConfigSubmit'); ?> <?php echo template::submit('redirectionConfigSubmit'); ?>
</div> </div>
</div> </div>

View File

@ -1,14 +1,13 @@
<?php echo template::formOpen('searchConfig'); ?> <?php echo template::formOpen('searchConfig'); ?>
<div class="row"> <div class="row">
<div class="col2"> <div class="col1">
<?php echo template::button('searchConfigBack', [ <?php echo template::button('searchConfigBack', [
'class' => 'buttonGrey', 'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'ico' => 'left', 'value' => template::ico('left')
'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8"> <div class="col2 offset9">
<?php echo template::submit('searchConfigSubmit'); ?> <?php echo template::submit('searchConfigSubmit'); ?>
</div> </div>
</div> </div>