news ameliorations apercu

This commit is contained in:
Deltacms 2022-12-28 17:09:41 +01:00
parent 763ad2cd30
commit 556db4b79b
5 changed files with 33 additions and 24 deletions

View File

@ -28,13 +28,13 @@ $text['news_view']['config'][25] = 'Hidden titles';
$text['news_view']['config'][26] = 'Same height';
$text['news_view']['config'][27] = 'Columns in the same row will have the same height';
$text['news_view']['config'][28] = "Are you sure you want to delete this news ?";
$text['news_view']['config'][29] = "This setting concerns the number of characters displayed in the news preview. In the last paragraph, which is often truncated, the different html tags are removed.";
$text['news_view']['config'][29] = "This setting concerns the news preview. In the last paragraph, which is often truncated, the different html tags are removed.";
$text['news_view']['config'][30] = "Media without margin";
$text['news_view']['config'][31] = "In the preview only the first media is displayed (image, iframe, video, figure). With this option the media will appear without margin.";
$text['news_view']['config'][31] = "With this option the media will appear without margin in the preview.";
$text['news_view']['config'][32] = 'Help';
$text['news_view']['config'][33] = 'module/news/view/config/config.help.html';
$text['news_view']['config'][34] = 'Media hidden in preview';
$text['news_view']['config'][35] = 'In the preview only the first media is displayed, this option hides it';
$text['news_view']['config'][34] = 'Hidden media';
$text['news_view']['config'][35] = 'This option hides the media in the preview';
$text['news_view']['index'][0] = 'read more';
$text['news_view']['index'][1] = 'No news.';
$text['news_view']['index'][2] = ' Edit';
@ -96,11 +96,11 @@ $columns = [
];
$height = [
-1 => 'Complete article',
1000 => '1000 characters',
800 => '800 characters',
600 => '600 characters',
400 => '400 characters',
200 => '200 characters'
1000 => '1000 characters + 1 media',
800 => '800 characters + 1 media',
600 => '600 characters + 1 media',
400 => '400 characters + 1 media',
200 => '200 characters + 1 media'
];
$borderWidth = [
0 => 'None',

View File

@ -28,13 +28,13 @@ $text['news_view']['config'][25] = 'Titres masqués';
$text['news_view']['config'][26] = 'Même hauteur';
$text['news_view']['config'][27] = 'Les colonnes sur une même ligne auront même hauteur';
$text['news_view']['config'][28] = "Êtes-vous sûr de vouloir supprimer cette news ?";
$text['news_view']['config'][29] = "Ce réglage concerne le nombre de caractères affichés dans l'aperçu des nouvelles. Dans le dernier paragraphe, souvent tronqué, les différentes balises html sont supprimées.";
$text['news_view']['config'][29] = "Ce réglage concerne l'aperçu des nouvelles. Dans le dernier paragraphe, souvent tronqué, les différentes balises html sont supprimées.";
$text['news_view']['config'][30] = "Média sans marge";
$text['news_view']['config'][31] = "Dans l'aperçu seul le premier média est affiché (image, iframe, video, figure). Avec cette option le média apparaîtra sans marge.";
$text['news_view']['config'][31] = "Avec cette option les médias apparaîtront sans marge dans l'aperçu.";
$text['news_view']['config'][32] = 'Aide';
$text['news_view']['config'][33] = 'module/news/view/config/config.help.html';
$text['news_view']['config'][34] = 'Média caché dans l\'aperçu';
$text['news_view']['config'][35] = 'Dans l\'aperçu seul le premier média est affiché, cette option le cache.';
$text['news_view']['config'][34] = 'Médias cachés';
$text['news_view']['config'][35] = 'Cette option cache les médias dans l\'aperçu.';
$text['news_view']['index'][0] = 'lire la suite';
$text['news_view']['index'][1] = 'Aucune news.';
$text['news_view']['index'][2] = ' Editer';
@ -95,11 +95,11 @@ $columns = [
];
$height = [
-1 => 'Article complet',
1000 => '1000 caractères',
800 => '800 caractères',
600 => '600 caractères',
400 => '400 caractères',
200 => '200 caractères'
1000 => '1000 caractères + 1 média',
800 => '800 caractères + 1 média',
600 => '600 caractères + 1 média',
400 => '400 caractères + 1 média',
200 => '200 caractères + 1 média'
];
$borderWidth = [
0 => 'Aucune',

View File

@ -170,7 +170,7 @@ class news extends common {
// Dossier de l'instance
if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) {
mkdir (self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', 0755, true);
mkdir (self::DATADIRECTORY . $this->getUrl(0), 0755, true);
}
$success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style );
@ -478,7 +478,7 @@ class news extends common {
for( $key=0; $key<count($arrayContent); $key++){
//Paragraphe avec media autorisé ( img, iframe, video, figure)
if( ($arrayType[$key] === 'IM' || $arrayType[$key] === 'IF' || $arrayType[$key] === 'V' || $arrayType[$key] === 'F' )
&& $mediaDisplay === 0 && $this->getData(['module', $this->getUrl(0), 'config', 'hideMedia']) === false ){
&& ( $mediaDisplay === 0 || $this->getData(['module', $this->getUrl(0), 'config', 'height']) === -1) && $this->getData(['module', $this->getUrl(0), 'config', 'hideMedia']) === false ){
// Modification des balises pour supprimer les marges
if( $this->getData(['module', $this->getUrl(0), 'config', 'noMargin']) === true){
$arrayContent[$key] = str_replace('</p>', '', $arrayContent[$key]);
@ -490,6 +490,9 @@ class news extends common {
$arrayContent[$key] = str_replace( $substring, '', $arrayContent[$key]);
}else{
$arrayContent[$key] = str_replace( 'figure class="image"', 'figure class="image" style="margin:0"', $arrayContent[$key]);
$arrayContent[$key] = str_replace( 'figure class="image align-left"', 'figure class="image" style="margin:0"', $arrayContent[$key]);
$arrayContent[$key] = str_replace( 'figure class="image align-right"', 'figure class="image" style="margin:0"', $arrayContent[$key]);
$arrayContent[$key] = str_replace( 'figure class="image align-center"', 'figure class="image" style="margin:0"', $arrayContent[$key]);
}
}
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
@ -504,6 +507,7 @@ class news extends common {
$arrayContent[$key] = strip_tags($arrayContent[$key]);
$arrayContent[$key] = '<p>'.substr( $arrayContent[$key], 0, $charRemain).'</p>';
$arrayContent[$key] .= '<p> ... <a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsIds[$i] . '"><span class="newsSuite">'.$text['news_view']['index'][0].'</span></a></p>' ;
$charDisplay = $charDisplay + 100; //pour tenir compte des balises html de la ligne précédente
}
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
$charDisplay = $charDisplay + strlen( strip_tags( $arrayContent[$key]) );
@ -511,7 +515,9 @@ class news extends common {
} else {
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
}
}
} elseif ( $arrayType[$key] === 'A' && $this->getData(['module', $this->getUrl(0), 'config', 'height']) === -1) {
self::$news[$newsIds[$i]]['content'] .= $arrayContent[$key];
}
}
// Mise en forme de la signature

View File

@ -46,6 +46,10 @@
font-weight: normal;
}
.newsSpace {
min-height: 20px;
}
.newsSignature {
position: absolute;
bottom: 3px;

View File

@ -32,10 +32,9 @@ if($module::$news):
<?php } ?>
<div class="newsContent">
<?php echo $news['content']; ?>
<br><br>
</div>
<div class="newsSignature">
<div class="newsSpace"></div>
<div class="newsSignature">
<i class="far fa-calendar-alt"></i>
<?php if( function_exists('datefmt_create') && function_exists('datefmt_create') && extension_loaded('intl') ){
echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$news['publishedOn'])));