diff --git a/module/download/download.php b/module/download/download.php index 10533d62..b63d067f 100644 --- a/module/download/download.php +++ b/module/download/download.php @@ -20,6 +20,7 @@ class download extends common { const UPDATE = '0.0'; const DATADIRECTORY = []; // Contenu localisé inclus par défaut (page.json et module.json) + // Constantes du module const EDIT_OWNER = 'owner'; const EDIT_GROUP = 'group'; const EDIT_ALL = 'all'; @@ -98,6 +99,14 @@ class download extends common { ]; + public static $itemLicense = [ + 'none'=> 'Non définie', + 'cc' => 'Licence libre Creative Common, partage autorisé', + 'gnu' => 'Licence libre GNU, partage autorisé', + 'mit' => 'Licence libre MIT, partage autorisé', + 'owner' => 'Licence Propriétaire' + ]; + public static $users = []; /** @@ -189,6 +198,8 @@ class download extends common { 'file' => $this->getInput('downloadAddFile', helper::FILTER_STRING_SHORT, true), 'fileVersion' => $this->getInput('downloadAddFileVersion', helper::FILTER_STRING_SHORT, true), 'fileDate' => $this->getInput('downloadAddFileDate', helper::FILTER_DATETIME, true), + 'fileLicense' => $this->getInput('downloadAddFileLicense', helper::FILTER_STRING_SHORT, true), + 'fileAuthor' => $this->getInput('downloadAddFileAuthor', helper::FILTER_STRING_SHORT, true), 'fileStats' => [], 'publishedOn' => $this->getInput('downloadAddPublishedOn', helper::FILTER_DATETIME, true), 'state' => $this->getInput('downloadAddState', helper::FILTER_BOOLEAN), @@ -555,6 +566,8 @@ class download extends common { 'fileVersion' => $this->getInput('downloadEditFileVersion', helper::FILTER_STRING_SHORT, true), 'fileDate' => $this->getInput('downloadEditFileDate', helper::FILTER_DATETIME, true), 'fileStats' => $this->getData(['module',$this->getUrl(0), 'items', $this->getUrl(2), 'fileStats']), + 'fileLicense' => $this->getInput('downloadEditFileLicense', helper::FILTER_STRING_SHORT, true), + 'fileAuthor' => $this->getInput('downloadEditFileAuthor', helper::FILTER_STRING_SHORT, true), 'publishedOn' => $this->getInput('downloadEditPublishedOn', helper::FILTER_DATETIME, true), 'state' => $this->getInput('downloadEditState', helper::FILTER_BOOLEAN), 'title' => $this->getInput('downloadEditTitle', helper::FILTER_STRING_SHORT, true), diff --git a/module/download/view/add/add.php b/module/download/view/add/add.php index a4df7f10..b392a5ec 100644 --- a/module/download/view/add/add.php +++ b/module/download/view/add/add.php @@ -57,6 +57,20 @@ ]); ?> +
+
+ 'Auteur', + 'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor']) + ]); ?> +
+
+ 'Licence', + 'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense']) + ]); ?> +
+
diff --git a/module/download/view/edit/edit.php b/module/download/view/edit/edit.php index 7dc32b55..d80153ad 100644 --- a/module/download/view/edit/edit.php +++ b/module/download/view/edit/edit.php @@ -64,6 +64,20 @@ ]); ?> +
+
+ 'Auteur', + 'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor']) + ]); ?> +
+
+ 'Licence', + 'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense']) + ]); ?> +
+
diff --git a/module/download/view/item/item.js.php b/module/download/view/item/item.js.php index 2748a7c8..3cda4b73 100644 --- a/module/download/view/item/item.js.php +++ b/module/download/view/item/item.js.php @@ -13,31 +13,31 @@ /** * Affiche le bloc pour rédiger un commentaire */ -var commentShowDOM = $("#downloaditemCommentShow"); +var commentShowDOM = $("#downloadItemCommentShow"); commentShowDOM.on("click focus", function() { - $("#downloaditemCommentShowWrapper").fadeOut(function() { - $("#downloaditemCommentWrapper").fadeIn(); - $("#downloaditemCommentContent").trigger("focus"); + $("#downloadItemCommentShowWrapper").fadeOut(function() { + $("#downloadItemCommentWrapper").fadeIn(); + $("#downloadItemCommentContent").trigger("focus"); }); }); -if($("#downloaditemCommentWrapper").find("textarea.notice,input.notice").length) { +if($("#downloadItemCommentWrapper").find("textarea.notice,input.notice").length) { commentShowDOM.trigger("click"); } /** * Cache le bloc pour rédiger un commentaire */ -$("#downloaditemCommentHide").on("click focus", function() { - $("#downloaditemCommentWrapper").fadeOut(function() { - $("#downloaditemCommentShowWrapper").fadeIn(); - $("#downloaditemCommentContent").val(""); - $("#downloaditemCommentAuthor").val(""); +$("#downloadItemCommentHide").on("click focus", function() { + $("#downloadItemCommentWrapper").fadeOut(function() { + $("#downloadItemCommentShowWrapper").fadeIn(); + $("#downloadItemCommentContent").val(""); + $("#downloadItemCommentAuthor").val(""); }); }); /** * Force le scroll vers les commentaires en cas d'erreur */ -$("#downloaditemCommentForm").on("submit", function() { +$("#downloadItemCommentForm").on("submit", function() { $(location).attr("href", "#comment"); }); \ No newline at end of file diff --git a/module/download/view/item/item.php b/module/download/view/item/item.php index 3173dbf9..6b1a7e10 100644 --- a/module/download/view/item/item.php +++ b/module/download/view/item/item.php @@ -1,27 +1,34 @@ -
-
-
-
+
+
+
+
+ getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?> +
+
+
+
+ + getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])) : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])) + $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) + ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])) : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn']))); - echo $date . ' à ' . $heure; + echo $date . ' à ' . $heure; ?> +
-
-
- + getUser('password') === $this->getInput('ZWII_USER_PASSWORD') AND ( // Propriétaire ( - $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER - AND ( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'userId']) === $this->getUser('id') - OR $this->getUser('group') === self::GROUP_ADMIN ) + $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) ) OR ( // Groupe @@ -38,158 +45,172 @@ ): ?> helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], - 'value' => 'Editer' + 'value' => template::ico('pencil') ]); ?> - -
-
-
-
-
-
- getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . - '" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . '">'; - ?> -
-
-
-
- self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'file']), - 'href' => helper::baseUrl() . $this->getUrl(0) . '/downloadFile/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], - 'value' => 'Télécharger' - ]); ?> -
-
-
-
- getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileVersion']); ?> -
-
-
-
- getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate']))); - ?> - -
-
-
-
- Téléchargements : - - -
+
-
- getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?> -
-
-

-
-
- getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> - - - getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?> -

Cet item ne reçoit pas de commentaire.

- -

- - - - 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> -

- - 'Rédiger un commentaire...', - 'readonly' => true - ]); ?> -
- getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> - 'Nom', - 'readonly' => true, - 'value' => $module::$editCommentSignature - ]); ?> - $this->getUser('id') - ]); ?> - -
-
- 'Nom' - ]); ?> -
-
-
Ou
-
-
- helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', - 'value' => 'Connexion' - ]); ?> -
-
- - 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']).' caractères', - 'class' => 'editorWysiwygComment', - 'noDirty' => true, - 'maxlength' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']) - ]); ?> -
- getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> -
-
- $this->getData(['config','captchaStrong']) - ]); ?> -
-
- -
-
- 'buttonGrey', - 'value' => 'Annuler' - ]); ?> -
-
- 'Envoyer', - 'ico' => '' - ]); ?> -
-
-
- -
-
- $comment): ?> -
-

- le +
+ getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?> + + + ' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '

' ; ?> - -
- + + +

- -
\ No newline at end of file +
+
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']); ?> + getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . + '" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . '">'; + ?> +
+
+
+
+ self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'file']), + 'href' => helper::baseUrl() . $this->getUrl(0) . '/downloadFile/' . $this->getUrl(1) . '/' . $_SESSION['csrf'], + 'value' => 'Télécharger' + ]); ?> +
+
+
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileVersion']); ?> +
+
+
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])), 'UTF-8', true) + ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate'])) + : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileDate']))); + ?> + +
+
+
+
+ Auteur : + getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileAuthor']); ?> + +
+
+
+
+ Licence : + getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileLicense'])]; ?> + +
+
+
+
+ Téléchargements : + + +
+
+
+ + +
+
+ getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?> +

Cet item ne reçoit pas de commentaire.

+ +

+ + + + 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?> +

+ + 'Rédiger un commentaire...', + 'readonly' => true + ]); ?> +
+ getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?> + 'Nom', + 'readonly' => true, + 'value' => $module::$editCommentSignature + ]); ?> + $this->getUser('id') + ]); ?> + +
+
+ 'Nom' + ]); ?> +
+
+
Ou
+
+
+ helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment', + 'value' => 'Connexion' + ]); ?> +
+
+ + 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']).' caractères', + 'class' => 'editorWysiwygComment', + 'noDirty' => true, + 'maxlength' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']) + ]); ?> +
+ getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?> +
+
+ $this->getData(['config','captchaStrong']) + ]); ?> +
+
+ +
+
+ 'buttonGrey', + 'value' => 'Annuler' + ]); ?> +
+
+ 'Envoyer', + 'ico' => '' + ]); ?> +
+
+
+ +
+
+ $comment): ?> +
+

+ le + +

+ +
+
+
+
+ \ No newline at end of file