Merge branch '10600' into 11000

This commit is contained in:
fredtempez 2021-04-06 11:26:04 +02:00
commit 14f525a618
7 changed files with 29 additions and 45 deletions

View File

@ -19,7 +19,7 @@ class blog extends common {
const REALNAME = 'Blog';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
const EDIT_OWNER = 'owner';
const EDIT_GROUP = 'group';

View File

@ -18,7 +18,7 @@ class download extends common {
const REALNAME = 'Téléchargement';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
// Constantes du module
const EDIT_OWNER = 'owner';

View File

@ -20,7 +20,7 @@ class form extends common {
const REALNAME = 'Formulaire';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
public static $actions = [
'config' => self::GROUP_MODERATOR,

View File

@ -21,7 +21,7 @@ class gallery extends common {
const REALNAME = 'Galerie';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = self::DATA_DIR . 'modules/gallery/';
const SORT_ASC = 'SORT_ASC';
const SORT_DSC = 'SORT_DSC';
@ -149,10 +149,6 @@ class gallery extends common {
*/
private function update() {
// Variables génériques
$class = get_called_class();
$moduleId = $this->getUrl(0);
// Mise à jour d'une version inférieure
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) {
@ -183,18 +179,17 @@ class gallery extends common {
if ( $this->getData(['module', $this->getUrl(0), 'config']) === null ) {
require_once('module/gallery/ressource/defaultdata.php');
$this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]);
}
if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '.css')) {
// Variables génériques
$class = get_called_class();
$moduleId = $this->getUrl(0);
// Dossier de l'instance
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
if (!is_dir(self::DATADIRECTORY )) {
mkdir (self::DATADIRECTORY, 0777, true);
}
// Nom de la feuille de style
$fileCSS = self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' ;
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ;
$this->setData(['module', $this->getUrl(0), 'config', 'style', $fileCSS]);
// Générer la feuille de CSS
@ -217,7 +212,7 @@ class gallery extends common {
$content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendTextColor']),$content );
$content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendBgColor']),$content );
// Ecriture de la feuille de style
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $content . $themeCss);
file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $content . $themeCss);
}
}
@ -710,14 +705,11 @@ class gallery extends common {
// Soumission du formulaire
if($this->isPost()) {
// Générer la feuille de CSS
$class = get_called_class();
$moduleId = $this->getUrl(0);
// Dossier de l'instance
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
if (!is_dir(self::DATADIRECTORY )) {
mkdir (self::DATADIRECTORY, 0777, true);
}
$fileCSS = self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' ;
$fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ;
// Fin feuille de style
$this->getData(['module', $this->getUrl(0), 'config', [
'thumbAlign' => $this->getinput('galleryThemeThumbAlign'),

View File

@ -19,7 +19,7 @@ class news extends common {
const REALNAME = 'Actualités';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = self::DATA_DIR . 'modules/news/';
public static $actions = [
'add' => self::GROUP_MODERATOR,
@ -185,15 +185,13 @@ class news extends common {
if($this->isPost()) {
// Générer la feuille de CSS
$class = get_called_class();
$moduleId = $this->getUrl(0);
$style = '.newsContent {height:' . $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT) . ';}';
// Dossier de l'instance
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
if (!is_dir(self::DATADIRECTORY)) {
mkdir (self::DATADIRECTORY, 0777, true);
}
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $style );
$success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $style );
// Fin feuille de style
$this->setData(['module', $this->getUrl(0), 'config',[
@ -203,7 +201,7 @@ class news extends common {
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
'style' => $success ? self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' : ''
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : ''
]]);
// Valeurs en sortie
$this->addOutput([

View File

@ -19,7 +19,7 @@ class redirection extends common {
const REALNAME = 'Redirection';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
public static $actions = [
'config' => self::GROUP_MODERATOR,

View File

@ -23,7 +23,7 @@ class search extends common {
const REALNAME = 'Recherche';
const DELETE = true;
const UPDATE = '0.0';
const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json)
const DATADIRECTORY = self::DATA_DIR . 'modules/search/';
public static $actions = [
'index' => self::GROUP_VISITOR,
@ -55,8 +55,6 @@ class search extends common {
// Version 2.0
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '2.0', '<') ) {
$class = get_called_class();
$moduleId = $this->getUrl(0);
// Données de l'instance
$data = $this->getData(['module', $this->getUrl(0)]);
$this->setData(['module', $this->getUrl(0), 'config', [
@ -65,7 +63,7 @@ class search extends common {
'resultHideContent' => $this->getData(['module', $this->getUrl(0), 'resultHideContent']),
'previewLength' => $this->getData(['module', $this->getUrl(0), 'previewLength']),
'keywordColor' => $this->getData(['module', $this->getUrl(0), 'keywordColor']),
'style' => self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css',
'style' => self::DATADIRECTORY . $this->getUrl(0) . '.css',
'versionData' => '2.0'
]]);
$this->deleteData(['module', $this->getUrl(0), 'submitText']);
@ -85,19 +83,17 @@ class search extends common {
if ( !is_array($this->getData(['module', $this->getUrl(0), 'config']) ) ) {
require_once('module/search/ressource/defaultdata.php');
$class = get_called_class();
$moduleId = $this->getUrl(0);
// Sauver les données par défaut
init::$defaultData['style'] = self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css';
init::$defaultData['style'] = self::DATADIRECTORY . $this->getUrl(0) . '.css';
$this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]);
$style = '.searchItem {background:' . $this->getData(['module', $this->getUrl(0), 'config', 'keywordColor']). ';}';
// Dossier de l'instance
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
if (!is_dir(self::DATADIRECTORY )) {
mkdir (self::DATADIRECTORY , 0777, true);
}
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $style );
$success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $style );
}
@ -116,15 +112,13 @@ class search extends common {
if($this->isPost()) {
// Générer la feuille de CSS
$class = get_called_class();
$moduleId = $this->getUrl(0);
$style = '.searchItem {background:' . $this->getInput('searchKeywordColor') . ';}';
// Dossier de l'instance
if (!is_dir(self::DATA_DIR . 'modules/' . $class)) {
mkdir (self::DATA_DIR . 'modules/' . $class, 0777, true);
if (!is_dir(self::DATADIRECTORY)) {
mkdir (self::DATADIRECTORY , 0777, true);
}
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' , $style );
$success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $style );
// Fin feuille de style
// Soumission du formulaire
@ -134,7 +128,7 @@ class search extends common {
'resultHideContent' => $this->getInput('searchResultHideContent',helper::FILTER_BOOLEAN),
'previewLength' => $this->getInput('searchPreviewLength',helper::FILTER_INT),
'keywordColor' => $this->getInput('searchKeywordColor'),
'style' => $success ? self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '.css' : '',
'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : '',
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
]]);