[10.0.30.dev] installation du site par défaut

This commit is contained in:
fredtempez 2019-10-16 20:00:22 +02:00
parent 0e6511f06a
commit e1d3743676
4 changed files with 142 additions and 117 deletions

View File

@ -21,6 +21,9 @@
- Procédure d'importation :
- L'importation des données est possible uniquement à partir d'une version 9.
- Une notification est affichée après l'importation.
- Procédure d'installation :
- Modification de la gestion des données de site par défaut.
- Régénération automatisée des fichiers manquants de données manquants.
## version 9.2.09
- Correections :

View File

@ -31,7 +31,7 @@ class common {
const TEMP_DIR = 'site/tmp/';
// Numéro de version
const ZWII_VERSION = '10.0.29.dev';
const ZWII_VERSION = '10.0.30.dev';
public static $actions = [];
public static $coreModuleIds = [
@ -947,7 +947,7 @@ class common {
* @param array $module : nom du module à générer
* choix valides : core config user theme page module
*/
public function initData($module, $lang = 'fr') {
public function initData($module, $lang = 'fr', $sampleSite = false) {
// Tableau avec les données vierges
require_once('core/module/install/ressource/defaultdata.php');
@ -966,7 +966,12 @@ class common {
'dir' => $folder,
'template' => self::TEMP_DIR . 'data.template.json'
]);
$db->set($module,init::$defaultData[$module]);
if ($sampleSite === true) {
$db->set($module,init::$siteData[$module]);
} else {
$db->set($module,init::$defaultData[$module]);
}
$db->save;
}

View File

@ -51,26 +51,9 @@ class install extends common {
$userMail = $this->getInput('installMail', helper::FILTER_MAIL, true);
$userId = $this->getInput('installId', helper::FILTER_ID, true);
// Configure certaines données par défaut
if ($this->getInput('installDefaultData',helper::FILTER_BOOLEAN) === FALSE) {
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
if ( $parentPageId !== 'accueil') {
if ($this->getdata(['page',$parentPageId,'moduleId'])) {
$this->deleteData(['page',$parentPageId]);
}
}
foreach($childrenPageIds as $childKey) {
$this->deleteData(['page', $childKey]);
}
}
// Effacer les modules
$this->deleteData(['module']);
// Ajouter ici la liste des pages privées qui ne sont pas vues lors de l'installation.
$this->deleteData(['page', 'privee']);
// Effacer les fichiers par défaut
if (is_dir(self::FILE_DIR.'source/galerie')) {
$this->removeAll(self::FILE_DIR.'source/galerie');
$this->removeAll(self::FILE_DIR.'thumb/galerie');
}
if ($this->getInput('installDefaultData',helper::FILTER_BOOLEAN) === TRUE) {
$this->initData('page','fr',true);
$this->initData('module','fr',true);
} else {
$this->setData(['module', 'blog', 'mon-premier-article', 'userId', $userId]);
$this->setData(['module', 'blog', 'mon-deuxieme-article', 'userId', $userId]);

View File

@ -1,7 +1,7 @@
<?php
class init extends common {
public static $defaultData = [
public static $defaultData = [
'config' => [
'analyticsId' => '',
'autoBackup' => true,
@ -27,6 +27,133 @@ class init extends common {
'lastBackup' => 0,
'lastClearTmp' => 0
],
'page' => [
'accueil' => [
'typeMenu' => 'text',
'iconUrl' => '',
'disable' => false,
'content' => '<h3>Bienvenue sur votre nouveau site Zwii !</h3>
<p><strong>Un email contenant le récapitulatif de votre installation vient de vous être envoyé.</strong></p>
<p>Connectez-vous dès maintenant à votre espace membre afin de créer un site à votre image ! Vous pourrez personnaliser le thème, créer des pages, ajouter des utilisateurs et bien plus encore !</p>
<p>Si vous avez besoin d\'aide ou si vous cherchez des informations sur Zwii, n\'hésitez pas à jeter un œil à notre <a title="Forum" href="https://forum.zwiicms.com/">forum</a>.</p>',
'hideTitle' => false,
'homePageId' => true,
'breadCrumb' => false,
'metaDescription' => '',
'metaTitle' => '',
'moduleId' => '',
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Accueil',
'block' => '12',
'barLeft' => '',
'barRight' => '',
'displayMenu' => 'none',
'hideMenuSide' => false,
'hideMenuChildren' =>false
]
],
'module' => [],
'user' => [],
'theme' => [
'body' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'image' => '',
'imageAttachment' => 'scroll',
'imageRepeat' => 'no-repeat',
'imagePosition' => 'top center',
'imageSize' => 'auto'
],
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'Open+Sans',
'fontSize' => '.8em',
'fontWeight' => 'normal',
'height' => '0',
'loginLink' => true,
'margin' => true,
'position' => 'site',
'textColor' => 'rgba(33, 34, 35, 1)',
'copyrightPosition' => 'right',
'copyrightAlign' => 'right',
'text' => 'Pied de page personnalisé',
'textPosition' => 'left',
'textAlign' => 'left',
'textTransform' => 'none',
'socialsPosition' => 'center',
'socialsAlign' => 'center',
'displayVersion' => true,
'displayVersion' => true,
'displaySiteMap' => true,
'displayCopyright' => true,
'displayLegal' => false,
'displaySearch' => false,
'template' => '3'
],
'header' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'Oswald',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '150px',
'image' => 'banniere/zwii_banniere-960px.jpg',
'imagePosition' => 'center center',
'imageRepeat' => 'no-repeat',
'margin' => false,
'position' => 'site',
'textAlign' => 'center',
'textColor' => 'rgba(33, 34, 35, 1)',
'textHide' => true,
'textTransform' => 'none',
'linkHome' => true,
'imageContainer' => 'auto'
],
'link' => [
'textColor' => 'rgba(74, 105, 189, 1)'
],
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'Open+Sans',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
'loginLink' => true,
'margin' => false,
'position' => 'site-second',
'textAlign' => 'left',
'textColor' => 'rgba(255, 255, 255, 1)',
'textTransform' => 'none',
'fixed' => false
],
'site' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0',
'shadow' => '0',
'width' => '960px'
],
'text' => [
'font' => 'Open+Sans',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)'
],
'title' => [
'font' => 'Oswald',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
],
'version' => 0,
]
];
public static $siteData = [
'page' => [
'accueil' => [
'typeMenu' => 'text',
@ -414,99 +541,6 @@ class init extends common {
]
]
]
],
'user' => [],
'theme' => [
'body' => [
'backgroundColor' => 'rgba(236, 239, 241, 1)',
'image' => '',
'imageAttachment' => 'scroll',
'imageRepeat' => 'no-repeat',
'imagePosition' => 'top center',
'imageSize' => 'auto'
],
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'Open+Sans',
'fontSize' => '.8em',
'fontWeight' => 'normal',
'height' => '0',
'loginLink' => true,
'margin' => true,
'position' => 'site',
'textColor' => 'rgba(33, 34, 35, 1)',
'copyrightPosition' => 'right',
'copyrightAlign' => 'right',
'text' => 'Pied de page personnalisé',
'textPosition' => 'left',
'textAlign' => 'left',
'textTransform' => 'none',
'socialsPosition' => 'center',
'socialsAlign' => 'center',
'displayVersion' => true,
'displayVersion' => true,
'displaySiteMap' => true,
'displayCopyright' => true,
'displayLegal' => false,
'displaySearch' => false,
'template' => '3'
],
'header' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'Oswald',
'fontSize' => '2em',
'fontWeight' => 'normal',
'height' => '150px',
'image' => 'banniere/zwii_banniere-960px.jpg',
'imagePosition' => 'center center',
'imageRepeat' => 'no-repeat',
'margin' => false,
'position' => 'site',
'textAlign' => 'center',
'textColor' => 'rgba(33, 34, 35, 1)',
'textHide' => true,
'textTransform' => 'none',
'linkHome' => true,
'imageContainer' => 'auto'
],
'link' => [
'textColor' => 'rgba(74, 105, 189, 1)'
],
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'Open+Sans',
'fontSize' => '1em',
'fontWeight' => 'normal',
'height' => '15px 10px',
'loginLink' => true,
'margin' => false,
'position' => 'site-second',
'textAlign' => 'left',
'textColor' => 'rgba(255, 255, 255, 1)',
'textTransform' => 'none',
'fixed' => false
],
'site' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'radius' => '0',
'shadow' => '0',
'width' => '960px'
],
'text' => [
'font' => 'Open+Sans',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)'
],
'title' => [
'font' => 'Oswald',
'fontWeight' => 'normal',
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
],
'version' => 0,
]
];
}