Licene et auteur + nouvelle présentation
This commit is contained in:
parent
c30b839587
commit
3a80515b17
@ -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),
|
||||
|
@ -57,6 +57,20 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadAddFileAuthor', [
|
||||
'label' => 'Auteur',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('downloadAddFileLicense', $module::$itemLicense, [
|
||||
'label' => 'Licence',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,6 +64,20 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadEditFileAuthor', [
|
||||
'label' => 'Auteur',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileAuthor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('downloadEditFileLicense', $module::$itemLicense, [
|
||||
'label' => 'Licence',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'fileLicense'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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");
|
||||
});
|
@ -1,8 +1,15 @@
|
||||
<article>
|
||||
<div class="row">
|
||||
<div class="col10">
|
||||
<div class="downloadDate">
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row verticalAlignMiddle">
|
||||
<div class="col11 downloadDate">
|
||||
<?php echo $module::$itemSignature . ' - ';?>
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
|
||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->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'])));
|
||||
@ -11,9 +18,9 @@
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])));
|
||||
echo $date . ' à ' . $heure;
|
||||
?>
|
||||
<!-- Bouton d'édition -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="col1 verticalAlignMiddle">
|
||||
<?php if (
|
||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
AND
|
||||
@ -38,18 +45,31 @@
|
||||
): ?>
|
||||
<?php echo template::button('downloadItemEdit', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
|
||||
'value' => 'Editer'
|
||||
'value' => template::ico('pencil')
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bloc RSS-->
|
||||
<div class="row">
|
||||
<div class="col12 rssFeed">
|
||||
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||
<img src='module/news/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']); ?>
|
||||
<?php
|
||||
echo '<img class="downloaditemPicture" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) .
|
||||
echo '<img class="downloadItemPicture" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) .
|
||||
'" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'picture']) . '">';
|
||||
?>
|
||||
</div>
|
||||
@ -77,6 +97,20 @@
|
||||
<?php echo ' du ' . $date; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Auteur :
|
||||
<?php echo $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileAuthor']); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Licence :
|
||||
<?php echo $module::$itemLicense[$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'fileLicense'])]; ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Téléchargements :
|
||||
@ -85,24 +119,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bloc commentaire -->
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<p class="clearBoth signature"><?php echo $module::$itemSignature;?></p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bloc RSS-->
|
||||
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||
<div id="rssFeed">
|
||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||
<img src='module/news/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<p>Cet item ne reçoit pas de commentaire.</p>
|
||||
<?php else: ?>
|
||||
@ -112,50 +132,50 @@
|
||||
<?php $s = $commentsNb === 1 ? '': 's' ?>
|
||||
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
|
||||
</h3>
|
||||
<?php echo template::formOpen('downloaditemForm'); ?>
|
||||
<?php echo template::text('downloaditemCommentShow', [
|
||||
<?php echo template::formOpen('downloadItemForm'); ?>
|
||||
<?php echo template::text('downloadItemCommentShow', [
|
||||
'placeholder' => 'Rédiger un commentaire...',
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
<div id="downloaditemCommentWrapper" class="displayNone">
|
||||
<div id="downloadItemCommentWrapper" class="displayNone">
|
||||
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<?php echo template::text('downloaditemUserName', [
|
||||
<?php echo template::text('downloadItemUserName', [
|
||||
'label' => 'Nom',
|
||||
'readonly' => true,
|
||||
'value' => $module::$editCommentSignature
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloaditemUserId', [
|
||||
<?php echo template::hidden('downloadItemUserId', [
|
||||
'value' => $this->getUser('id')
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php echo template::text('downloaditemAuthor', [
|
||||
<?php echo template::text('downloadItemAuthor', [
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 textAlignCenter verticalAlignBottom">
|
||||
<div id="downloaditemOr">Ou</div>
|
||||
<div id="downloadItemOr">Ou</div>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
<?php echo template::button('downloaditemLogin', [
|
||||
<?php echo template::button('downloadItemLogin', [
|
||||
'href' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
|
||||
'value' => 'Connexion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo template::textarea('downloaditemContent', [
|
||||
<?php echo template::textarea('downloadItemContent', [
|
||||
'label' => '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'])
|
||||
]); ?>
|
||||
<div id="downloaditemContentAlarm"> </div>
|
||||
<div id="downloadItemContentAlarm"> </div>
|
||||
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::captcha('downloaditemCaptcha', [
|
||||
<?php echo template::captcha('downloadItemCaptcha', [
|
||||
'limit' => $this->getData(['config','captchaStrong'])
|
||||
]); ?>
|
||||
</div>
|
||||
@ -163,13 +183,13 @@
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('downloaditemCommentHide', [
|
||||
<?php echo template::button('downloadItemCommentHide', [
|
||||
'class' => 'buttonGrey',
|
||||
'value' => 'Annuler'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloaditemSubmit', [
|
||||
<?php echo template::submit('downloadItemSubmit', [
|
||||
'value' => 'Envoyer',
|
||||
'ico' => ''
|
||||
]); ?>
|
||||
@ -191,5 +211,6 @@
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $module::$pages; ?>
|
||||
</article>
|
Loading…
x
Reference in New Issue
Block a user