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 @@
Cet article ne reçoit pas de commentaire.
-+ getData(['module',$this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module',$this->getUrl(0), 'config', 'articlesLenght']) : 500 ?> +
'), 0, $lenght); ?>... + Lire la suite +
+Cet article ne reçoit pas de commentaire.
+ +