diff --git a/core/core.php b/core/core.php index 13c54e4c..4efa650a 100644 --- a/core/core.php +++ b/core/core.php @@ -1959,6 +1959,7 @@ class common { if(common::$inputNotices) { $notification = 'Impossible de soumettre le formulaire, car il contient des erreurs'; $notificationClass = 'notificationError'; + var_dump(common::$inputNotices) ; } if (common::$coreNotices) { $notification = 'Données absentes, restauration de

| '; diff --git a/module/blog/blog.php b/module/blog/blog.php index 4e8619c8..a6330573 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -77,7 +77,7 @@ class blog extends common { ]; // Nombre d'objets par page - public static $ItemsList = [ + public static $ArticlesListed = [ 4 => '4 articles', 8 => '8 articles', 12 => '12 articles', @@ -87,11 +87,18 @@ class blog extends common { //Paramètre longueur maximale des commentaires en nb de caractères public static $commentLength = [ - '500' => '500', - '1000' => '1000', - '2000' => '2000', - '5000' => '5000', - '10000' => '10000' + 100 => '100 signes', + 250 => '250 signes', + 500 => '500 signes', + 750 => '750 signes' + ]; + + public static $articlesLenght = [ + 0 => 'Article complet', + 500 => '500 signes', + 1000 => '1000 signes', + 1500 => '1500 signes', + 2000 => '2000 signes' ]; // Permissions d'un article @@ -101,6 +108,7 @@ class blog extends common { self::EDIT_OWNER => 'Propriétaire' ]; + // Nombre d'articles dans la page de config: public static $itemsperPage = 8; @@ -245,7 +253,8 @@ class blog extends common { 'title' => 'Nouvel article', 'vendor' => [ 'flatpickr', - 'tinymce' + 'tinymce', + 'furl' ], 'view' => 'add' ]); @@ -494,7 +503,9 @@ class blog extends common { 'feeds' => $this->getInput('blogOptionShowFeeds',helper::FILTER_BOOLEAN), 'feedsLabel' => $this->getInput('blogOptionFeedslabel',helper::FILTER_STRING_SHORT), 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT,true), - 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']) + 'layout' => $this->getInput('blogOptionLayout',helper::FILTER_BOOLEAN), + 'articlesLenght'=> $this->getInput('blogOptionArticlesLenght', helper::FILTER_INT), + 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']), ]]); // Valeurs en sortie $this->addOutput([ @@ -654,6 +665,8 @@ class blog extends common { $this->getUrl(0), 'posts', $articleId, [ + 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), + 'permalink' => $this->getInput('blogEditPermalink', helper::FILTER_STRING_SHORT, true), 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']), 'content' => $this->getInput('blogEditContent', null), 'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true), @@ -662,7 +675,6 @@ class blog extends common { 'picturePosition' => $this->getInput('blogEditPicturePosition', helper::FILTER_STRING_SHORT), 'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true), 'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN), - 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), 'userId' => $newuserid, 'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('blogEditConsent'), 'commentMaxlength' => $this->getInput('blogEditCommentMaxlength'), @@ -699,7 +711,8 @@ class blog extends common { 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']), 'vendor' => [ 'flatpickr', - 'tinymce' + 'tinymce', + 'furl' ], 'view' => 'edit' ]); @@ -844,6 +857,8 @@ class blog extends common { foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) { if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) { $articleIds[] = $articleId; + // Nombre de commentaires approuvés par article + self::$comments [$articleId] = count ( $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'comment'])); } } // Pagination diff --git a/module/blog/changes.md b/module/blog/changes.md index 6a7d7be0..05bd219d 100644 --- a/module/blog/changes.md +++ b/module/blog/changes.md @@ -1,2 +1,3 @@ # version 6 - - mise à la norme avec le module news : le formulaire est sorti de l'écran principal \ No newline at end of file + - mise à la norme avec le module news : le formulaire est sorti de l'écran principal + - Les images ne sont plus obligatoire et la liste des articles peut être sans tableau. \ No newline at end of file diff --git a/module/blog/vendor/furl/LICENSE b/module/blog/vendor/furl/LICENSE new file mode 100644 index 00000000..5f86a4d6 --- /dev/null +++ b/module/blog/vendor/furl/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Vedat Taylan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/module/blog/vendor/furl/README.md b/module/blog/vendor/furl/README.md new file mode 100644 index 00000000..2386a5ff --- /dev/null +++ b/module/blog/vendor/furl/README.md @@ -0,0 +1,4 @@ +# furl +jQuery Furl (Friendly URL) Plugin 1.0.0 + +Usage : $('#InputID').furl({id:'ReplaceInputID', seperate (optional) : '_' }); diff --git a/module/blog/vendor/furl/inc.json b/module/blog/vendor/furl/inc.json new file mode 100644 index 00000000..7ef795a0 --- /dev/null +++ b/module/blog/vendor/furl/inc.json @@ -0,0 +1,3 @@ +[ + "jquery.furl.js" +] \ No newline at end of file diff --git a/module/blog/vendor/furl/jquery.furl.js b/module/blog/vendor/furl/jquery.furl.js new file mode 100644 index 00000000..58a13808 --- /dev/null +++ b/module/blog/vendor/furl/jquery.furl.js @@ -0,0 +1,76 @@ +/* + * jQuery Furl (Friendly URL) Plugin 1.0.0 + * + * Author : Vedat Taylan + * + * Year : 2018 + * Usage : $('#InputID').furl({id:'ReplaceInputID', seperate (optional) : '_' }); + */ +(function ($, undefined) { + function Furl() { + this.defaults = { + seperate: '-' + }; + } + Furl.prototype = { + init: function (target, options) { + var $this = this; + options = $.extend({}, $this.defaults, options); + + $(target).keyup(function () { + var url = urlReplace($(this).val(), options); + var $element = $('#' + options.id); + + if ($element.length > 0) { + var tagName = $element.get(0).tagName; + switch (tagName) { + case 'INPUT': + $element.val(url); + break; + default: + $element.text(url); + } + } + }); + } + }; + function urlReplace(url, options) { + return url.toLowerCase() + .replace(/ä/g, 'ae') + .replace(/Ä/g, 'ae') + .replace(/ğ/g, 'g') + .replace(/ü/g, 'u') + .replace(/ş/g, 's') + .replace(/ı/g, 'i') + .replace(/ö/g, 'o') + .replace(/ç/g, 'c') + .replace(/Ğ/g, 'g') + .replace(/Ü/g, 'u') + .replace(/Ş/g, 's') + .replace(/I/g, 'i') + .replace(/İ/g, 'i') + .replace(/Ö/g, 'o') + .replace(/Ç/g, 'c') + + .replace(/[^a-z0-9\s-]/g, "") + .replace(/[\s-]+/g, " ") + .replace(/^\s+|\s+$/g, "") + .replace(/\s/g, "-") + + .replace(/^\s+|\s+$/g, "") + .replace(/[_|\s]+/g, "-") + .replace(/[^a-z\u0400-\u04FF0-9-]+/g, "") + .replace(/[-]+/g, "-") + .replace(/^-+|-+$/g, "") + .replace(/[-]+/g, options.seperate); + } + + $.furl = new Furl(); + $.furl.version = "1.0.0"; + + $.fn.furl = function (options) { + return this.each(function () { + $.furl.init(this, options); + }); + }; +})(jQuery); diff --git a/module/blog/view/add/add.js.php b/module/blog/view/add/add.js.php index b47a8406..b4e9647d 100644 --- a/module/blog/view/add/add.js.php +++ b/module/blog/view/add/add.js.php @@ -52,4 +52,7 @@ $( document).ready(function() { } else { $("#blogAddCommentGroupNotification").slideUp(); } + + // Permalink + $('#blogAddTitle').furl({id:'blogAddPermalink', seperate: '_' }); }); \ No newline at end of file diff --git a/module/blog/view/add/add.php b/module/blog/view/add/add.php index 22e51de4..7d6e015a 100644 --- a/module/blog/view/add/add.php +++ b/module/blog/view/add/add.php @@ -28,11 +28,16 @@

Informations générales

-
+
'Titre' ]); ?>
+
+ 'Permalink' + ]); ?> +
@@ -55,10 +60,10 @@
-
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture']) - ]); ?> +
+ true + ]); ?>
diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 7622e110..26005d2b 100644 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -66,12 +66,12 @@ getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>

Cet article ne reçoit pas de commentaire.

-

+

0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> -
+ 'Rédiger un commentaire...', diff --git a/module/blog/view/edit/edit.js.php b/module/blog/view/edit/edit.js.php index ab3c5b77..a17276bc 100644 --- a/module/blog/view/edit/edit.js.php +++ b/module/blog/view/edit/edit.js.php @@ -64,4 +64,8 @@ $( document).ready(function() { } else { $("#blogEditCommentGroupNotification").slideUp(); } + + // Permalink + $('#blogEditTitle').furl({id:'blogEditPermalink', seperate: '_' }); + }); \ No newline at end of file diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index 5fd831bb..feada688 100644 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -28,12 +28,18 @@

Informations générales

-
+
'Titre', 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']) ]); ?>
+
+ 'Permalink', + 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'permalink']) + ]); ?> +
@@ -60,7 +66,7 @@
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture']) ]); ?>
diff --git a/module/blog/view/index/index.css b/module/blog/view/index/index.css index 474b1a83..12d42b5a 100755 --- a/module/blog/view/index/index.css +++ b/module/blog/view/index/index.css @@ -14,6 +14,24 @@ */ } +#sectionTitle { + margin-top: 0; + margin-bottom: 5px; +} +.blogArticlePicture { + height: auto; + border:1px solid lightgray; + box-shadow: 1px 1px 5px; +} +.blogArticlePictureleft { + float: left; + margin: 15px 10px 5px 0 ; +} +.blogArticlePictureright { + float: right; + margin: 15px 0 5px 10px ; +} + .blogPicture:hover { opacity: .7; } @@ -55,6 +73,24 @@ } } +.pict20{ + width: 20%; +} +.pict30{ + width: 30%; +} +.pict40{ + width: 40%; +} +.pict50{ + width: 50%; +} +.pict100{ + width: 100%; + margin: 15px 0 20px 0 ; +} + + /* * Flux RSS */ diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 5ecfb53a..2fe00a75 100644 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -1,54 +1,132 @@ -
-
- $article): ?> -
-
- - makeThumb( self::FILE_DIR . 'source/' . $article['picture'], - self::FILE_DIR . 'thumb/' . $thumb, - self::THUMBS_WIDTH); - } - ?> - - <?php echo $article['picture']; ?> + $article): ?> + getData(['module', $this->getUrl(0), 'config', 'layout']) !== true): ?> +
+ +
+

+ + - +

+ -
-

+
+ + +
+

+ getData(['module',$this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module',$this->getUrl(0), 'config', 'articlesLenght']) : 500 ?> +

'), 0, $lenght); ?>... + Lire la suite +

+

+
+ +
+
+

-

-
- - - - - - -
-
- - -
-

-

'), 0, 400); ?>... - Lire la suite -

-
+
- -
-
+
+
+
+ getData(['module', $this->getUrl(0), 'posts',$articleId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'pictureSize']); ?> + getData(['module', $this->getUrl(0), 'posts',$articleId, 'hidePicture']) == false) { + echo '' . $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'picture']) . ''; + } ?> + getData(['module', $this->getUrl(0),'posts',$articleId, 'content']); ?> +
+
+
+
+ + + + getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])), 'UTF-8', true) + ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])) + : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn']))); + $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])), 'UTF-8', true) + ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])) + : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn']))); + echo $date . ' à ' . $heure; + ?> + + getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + AND + ( // Propriétaire + ( + $this->getData(['module', $this->getUrl(0), 'posts',$articleId,'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), 'posts',$articleId,'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) + ) + OR ( + // Groupe + ( $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'editConsent']) === self::GROUP_ADMIN + OR $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'editConsent']) === self::GROUP_MODERATOR) + AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts',$articleId,'editConsent']) + ) + OR ( + // Tout le monde + $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'editConsent']) === $module::EDIT_ALL + AND $this->getUser('group') >= $module::$actions['config'] + ) + ) + ): ?> + + Editer + + +
+
+ getData(['module', $this->getUrl(0), 'posts', $articleId, 'commentClose'])): ?> +

Cet article ne reçoit pas de commentaire.

+ +
+ + + + getUrl(0) . '/' . $articleId; ?>"> + + + echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; + ?> +
+ + + getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
diff --git a/module/blog/view/option/option.php b/module/blog/view/option/option.php index 721eb6a7..11ae4772 100644 --- a/module/blog/view/option/option.php +++ b/module/blog/view/option/option.php @@ -14,27 +14,47 @@
-

Paramètres du module

+

Flux RSS

-
+
$this->getData(['module', $this->getUrl(0), 'config', 'feeds']), ]); ?>
-
+
'Texte de l\'étiquette', 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) ]); ?>
+
+
+
+
+
+
+

Disposition de la liste des articles

-
- 'Articles par page', - 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) +
+ $this->getData(['module', $this->getUrl(0), 'config', 'layout']), + 'help' => 'La disposition moderne affiche les articles les uns à la suite des autres' ]); ?>
+
+ 'Longueur des articles', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) + ]); ?> +
+
+ 'Articles par page', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) + ]); ?> +
+