This commit is contained in:
fredtempez 2021-04-03 17:54:22 +02:00
commit 89ef3c84ab
5 changed files with 27 additions and 3 deletions

View File

@ -2211,6 +2211,11 @@ class core extends common {
'style' => file_get_contents($stylePath)
]);
}
if ($output['style']) {
$this->addOutput([
'style' => $this->output['style'] . file_get_contents($output['style'])
]);
}
// JS
$scriptPath = $modulePath . 'module/' . $moduleId . '/view/' . $output['view'] . '/' . $output['view'] . '.js.php';
if(file_exists($scriptPath)) {

View File

@ -180,15 +180,30 @@ class news extends common {
public function config() {
// Mise à jour des données de module
$this->update();
// Soumission du formulaire
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 . '/' . $moduleId)) {
mkdir (self::DATA_DIR . 'modules/' . $class . '/' . $moduleId, 0775, true);
}
$success = file_put_contents(self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '/style.css' , $style );
// Fin feuille de style
$this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT),
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version'])
'version' => $this->getData(['module', $this->getUrl(0), 'config', 'version']),
'style' => $success ? self::DATA_DIR . 'modules/' . $class . '/' . $moduleId . '/style.css' : ''
]]);
// Valeurs en sortie
$this->addOutput([
@ -387,7 +402,8 @@ class news extends common {
$this->addOutput([
'showBarEditButton' => true,
'showPageContent' => true,
'view' => 'index'
'view' => 'index',
'style' => $this->getData(['module', $this->getUrl(0),'config', 'style'])
]);
}

View File

@ -25,6 +25,7 @@
overflow: hidden; /* les dépassements seront masqués */
position: relative;
}
.newsBlur {
position: absolute;
bottom: -5%;
@ -39,6 +40,7 @@
.newsContent {
clear: left;
margin-left: 10px;
margin-bottom: 5px;
}
.newsSignature {

View File

@ -5,7 +5,7 @@
<h1 class="newsTitle" id="<?php echo $newsId;?>">
<?php echo '<a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
</h1>
<div class="newsContent" style="height:<?php echo $this->getData(['module', $this->getUrl(0),'config', 'itemsHeight']); ?>;">
<div class="newsContent">
<?php echo $news['content']; ?>
<div class="newsBlur"></div>
</div>

View File

@ -0,0 +1 @@
.newsContent {height:200px;}