This commit is contained in:
fredtempez 2021-04-03 16:24:25 +02:00
parent 40a62401bc
commit 4d9d71602e
5 changed files with 26 additions and 3 deletions

View File

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

View File

@ -180,15 +180,30 @@ class news extends common {
public function config() { public function config() {
// 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()) {
// 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',[ $this->setData(['module', $this->getUrl(0), 'config',[
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true), 'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true), 'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT), '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 // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -387,7 +402,8 @@ class news extends common {
$this->addOutput([ $this->addOutput([
'showBarEditButton' => true, 'showBarEditButton' => true,
'showPageContent' => 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 */ overflow: hidden; /* les dépassements seront masqués */
position: relative; position: relative;
} }
.newsBlur { .newsBlur {
position: absolute; position: absolute;
bottom: -5%; bottom: -5%;

View File

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

View File

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