Merge branch '12204' of https://forge.chapril.org/ZwiiCMS-Team/ZwiiCMS into 12204
This commit is contained in:
commit
2f3a39ad2c
10
module/download/changes.md
Normal file
10
module/download/changes.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Version 3.2
|
||||
- Compatibilité PHP 8.2
|
||||
# Version 3.1
|
||||
- Liste export du catalogue non json
|
||||
# Version 3
|
||||
- Uniformisation interface graphique
|
||||
- Corrige un bug de création de catégorie
|
||||
# Version 2.6
|
||||
- Saisie obligatoire d'un contenu
|
||||
- Nouvelle structure 'posts' plutôt que 'items' pour permettre la recherche dans les descriptions avec le module Search
|
1345
module/download/download.php
Normal file
1345
module/download/download.php
Normal file
File diff suppressed because it is too large
Load Diff
1
module/download/enum.json
Normal file
1
module/download/enum.json
Normal file
@ -0,0 +1 @@
|
||||
{"name":"download","realName":"Téléchargement","version":"3.1","update":"0.0","delete":true,"dataDirectory":""}
|
BIN
module/download/ressource/feed-icon-16.gif
Normal file
BIN
module/download/ressource/feed-icon-16.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 652 B |
38
module/download/vendor/FeedWriter/ATOM.php
vendored
Normal file
38
module/download/vendor/FeedWriter/ATOM.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper for creating ATOM feeds
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class ATOM extends Feed
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(Feed::ATOM);
|
||||
}
|
||||
|
||||
}
|
1017
module/download/vendor/FeedWriter/Feed.php
vendored
Normal file
1017
module/download/vendor/FeedWriter/Feed.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
module/download/vendor/FeedWriter/InvalidOperationException.php
vendored
Normal file
33
module/download/vendor/FeedWriter/InvalidOperationException.php
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
use \LogicException;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The exception that is thrown when an invalid operation is performed on
|
||||
* the object.
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class InvalidOperationException extends LogicException
|
||||
{
|
||||
}
|
413
module/download/vendor/FeedWriter/Item.php
vendored
Normal file
413
module/download/vendor/FeedWriter/Item.php
vendored
Normal file
@ -0,0 +1,413 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
use \DateTime;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
|
||||
* Copyright (C) 2010-2013, 2015-2016 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Universal Feed Writer
|
||||
*
|
||||
* Item class - Used as feed element in Feed class
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
* @author Anis uddin Ahmad <anisniit@gmail.com>
|
||||
* @link http://www.ajaxray.com/projects/rss
|
||||
*/
|
||||
class Item
|
||||
{
|
||||
/**
|
||||
* Collection of feed item elements
|
||||
*/
|
||||
private $elements = array();
|
||||
|
||||
/**
|
||||
* Contains the format of this feed.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* Is used as a suffix when multiple elements have the same name.
|
||||
**/
|
||||
private $_cpt = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $version constant (RSS1/RSS2/ATOM) RSS2 is default.
|
||||
*/
|
||||
public function __construct($version = Feed::RSS2)
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an unique number
|
||||
*
|
||||
* @access private
|
||||
* @return int
|
||||
**/
|
||||
private function cpt()
|
||||
{
|
||||
return $this->_cpt++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an element to elements array
|
||||
*
|
||||
* @access public
|
||||
* @param string $elementName The tag name of an element
|
||||
* @param string $content The content of tag
|
||||
* @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format
|
||||
* @param boolean $overwrite Specifies if an already existing element is overwritten.
|
||||
* @param boolean $allowMultiple Specifies if multiple elements of the same name are allowed.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the element name is not a string, empty or NULL.
|
||||
*/
|
||||
public function addElement($elementName, $content, array $attributes = null, $overwrite = FALSE, $allowMultiple = FALSE)
|
||||
{
|
||||
if (empty($elementName))
|
||||
throw new \InvalidArgumentException('The element name may not be empty or NULL.');
|
||||
if (!is_string($elementName))
|
||||
throw new \InvalidArgumentException('The element name must be a string.');
|
||||
|
||||
$key = $elementName;
|
||||
|
||||
// return if element already exists & if overwriting is disabled
|
||||
// & if multiple elements are not allowed.
|
||||
if (isset($this->elements[$elementName]) && !$overwrite) {
|
||||
if (!$allowMultiple)
|
||||
return $this;
|
||||
|
||||
$key .= '-' . $this->cpt();
|
||||
}
|
||||
|
||||
$this->elements[$key]['name'] = $elementName;
|
||||
$this->elements[$key]['content'] = $content;
|
||||
$this->elements[$key]['attributes'] = $attributes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set multiple feed elements from an array.
|
||||
* Elements which have attributes cannot be added by this method
|
||||
*
|
||||
* @access public
|
||||
* @param array array of elements in 'tagName' => 'tagContent' format.
|
||||
* @return self
|
||||
*/
|
||||
public function addElementArray(array $elementArray)
|
||||
{
|
||||
foreach ($elementArray as $elementName => $content) {
|
||||
$this->addElement($elementName, $content);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the collection of elements in this feed item
|
||||
*
|
||||
* @access public
|
||||
* @return array All elements of this item.
|
||||
* @throws InvalidOperationException on ATOM feeds if either a content or link element is missing.
|
||||
* @throws InvalidOperationException on RSS1 feeds if a title or link element is missing.
|
||||
*/
|
||||
public function getElements()
|
||||
{
|
||||
// ATOM feeds have some specific requirements...
|
||||
if ($this->version == Feed::ATOM)
|
||||
{
|
||||
// Add an 'id' element, if it was not added by calling the setLink method.
|
||||
// Use the value of the title element as key, since no link element was specified.
|
||||
if (!array_key_exists('id', $this->elements))
|
||||
$this->setId(Feed::uuid($this->elements['title']['content'], 'urn:uuid:'));
|
||||
|
||||
// Either a 'link' or 'content' element is needed.
|
||||
if (!array_key_exists('content', $this->elements) && !array_key_exists('link', $this->elements))
|
||||
throw new InvalidOperationException('ATOM feed entries need a link or a content element. Call the setLink or setContent method.');
|
||||
}
|
||||
// ...same with RSS1 feeds.
|
||||
else if ($this->version == Feed::RSS1)
|
||||
{
|
||||
if (!array_key_exists('title', $this->elements))
|
||||
throw new InvalidOperationException('RSS1 feed entries need a title element. Call the setTitle method.');
|
||||
if (!array_key_exists('link', $this->elements))
|
||||
throw new InvalidOperationException('RSS1 feed entries need a link element. Call the setLink method.');
|
||||
}
|
||||
|
||||
return $this->elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of this feed item
|
||||
*
|
||||
* @access public
|
||||
* @return string The feed type, as defined in Feed.php
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
// Wrapper functions ------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set the 'description' element of feed item
|
||||
*
|
||||
* @access public
|
||||
* @param string $description The content of the 'description' or 'summary' element
|
||||
* @return self
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$tag = ($this->version == Feed::ATOM) ? 'summary' : 'description';
|
||||
|
||||
return $this->addElement($tag, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'content' element of the feed item
|
||||
* For ATOM feeds only
|
||||
*
|
||||
* @access public
|
||||
* @param string $content Content for the item (i.e., the body of a download post).
|
||||
* @return self
|
||||
* @throws InvalidOperationException if this method is called on non-ATOM feeds.
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
if ($this->version != Feed::ATOM)
|
||||
throw new InvalidOperationException('The content element is supported in ATOM feeds only.');
|
||||
|
||||
return $this->addElement('content', $content, array('type' => 'html'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'title' element of feed item
|
||||
*
|
||||
* @access public
|
||||
* @param string $title The content of 'title' element
|
||||
* @return self
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
return $this->addElement('title', $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'date' element of the feed item.
|
||||
*
|
||||
* The value of the date parameter can be either an instance of the
|
||||
* DateTime class, an integer containing a UNIX timestamp or a string
|
||||
* which is parseable by PHP's 'strtotime' function.
|
||||
*
|
||||
* @access public
|
||||
* @param DateTime|int|string $date Date which should be used.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the given date was not parseable.
|
||||
*/
|
||||
public function setDate($date)
|
||||
{
|
||||
if (!is_numeric($date)) {
|
||||
if ($date instanceof DateTime)
|
||||
$date = $date->getTimestamp();
|
||||
else {
|
||||
$date = strtotime($date);
|
||||
|
||||
if ($date === FALSE)
|
||||
throw new \InvalidArgumentException('The given date string was not parseable.');
|
||||
}
|
||||
} elseif ($date < 0)
|
||||
throw new \InvalidArgumentException('The given date is not an UNIX timestamp.');
|
||||
|
||||
if ($this->version == Feed::ATOM) {
|
||||
$tag = 'updated';
|
||||
$value = date(\DATE_ATOM, $date);
|
||||
} elseif ($this->version == Feed::RSS2) {
|
||||
$tag = 'pubDate';
|
||||
$value = date(\DATE_RSS, $date);
|
||||
} else {
|
||||
$tag = 'dc:date';
|
||||
$value = date("Y-m-d", $date);
|
||||
}
|
||||
|
||||
return $this->addElement($tag, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'link' element of feed item
|
||||
*
|
||||
* @access public
|
||||
* @param string $link The content of 'link' element
|
||||
* @return self
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
if ($this->version == Feed::RSS2 || $this->version == Feed::RSS1) {
|
||||
$this->addElement('link', $link);
|
||||
} else {
|
||||
$this->addElement('link','',array('href'=>$link));
|
||||
$this->setId(Feed::uuid($link,'urn:uuid:'));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a external media to the feed item.
|
||||
* Not supported in RSS 1.0 feeds.
|
||||
*
|
||||
* See RFC 4288 for syntactical correct MIME types.
|
||||
*
|
||||
* Note that you should avoid the use of more than one enclosure in one item,
|
||||
* since some RSS aggregators don't support it.
|
||||
*
|
||||
* @access public
|
||||
* @param string $url The URL of the media.
|
||||
* @param integer $length The length of the media.
|
||||
* @param string $type The MIME type attribute of the media.
|
||||
* @param boolean $multiple Specifies if multiple enclosures are allowed
|
||||
* @return self
|
||||
* @link https://tools.ietf.org/html/rfc4288
|
||||
* @throws \InvalidArgumentException if the length or type parameter is invalid.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
public function addEnclosure($url, $length, $type, $multiple = TRUE)
|
||||
{
|
||||
if ($this->version == Feed::RSS1)
|
||||
throw new InvalidOperationException('Media attachment is not supported in RSS1 feeds.');
|
||||
|
||||
// the length parameter should be set to 0 if it can't be determined
|
||||
// see http://www.rssboard.org/rss-profile#element-channel-item-enclosure
|
||||
if (!is_numeric($length) || $length < 0)
|
||||
throw new \InvalidArgumentException('The length parameter must be an integer and greater or equals to zero.');
|
||||
|
||||
// Regex used from RFC 4287, page 41
|
||||
if (!is_string($type) || preg_match('/.+\/.+/', $type) != 1)
|
||||
throw new \InvalidArgumentException('type parameter must be a string and a MIME type.');
|
||||
|
||||
$attributes = array('length' => $length, 'type' => $type);
|
||||
|
||||
if ($this->version == Feed::RSS2) {
|
||||
$attributes['url'] = $url;
|
||||
$this->addElement('enclosure', '', $attributes, FALSE, $multiple);
|
||||
} else {
|
||||
$attributes['href'] = $url;
|
||||
$attributes['rel'] = 'enclosure';
|
||||
$this->addElement('atom:link', '', $attributes, FALSE, $multiple);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'author' element of feed item.
|
||||
* Not supported in RSS 1.0 feeds.
|
||||
*
|
||||
* @access public
|
||||
* @param string $author The author of this item
|
||||
* @param string|null $email Optional email address of the author
|
||||
* @param string|null $uri Optional URI related to the author
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the provided email address is syntactically incorrect.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
public function setAuthor($author, $email = null, $uri = null)
|
||||
{
|
||||
if ($this->version == Feed::RSS1)
|
||||
throw new InvalidOperationException('The author element is not supported in RSS1 feeds.');
|
||||
|
||||
// Regex from RFC 4287 page 41
|
||||
if ($email != null && preg_match('/.+@.+/', $email) != 1)
|
||||
throw new \InvalidArgumentException('The email address is syntactically incorrect.');
|
||||
|
||||
if ($this->version == Feed::RSS2)
|
||||
{
|
||||
if ($email != null)
|
||||
$author = $email . ' (' . $author . ')';
|
||||
|
||||
$this->addElement('author', $author);
|
||||
}
|
||||
else
|
||||
{
|
||||
$elements = array('name' => $author);
|
||||
|
||||
if ($email != null)
|
||||
$elements['email'] = $email;
|
||||
|
||||
if ($uri != null)
|
||||
$elements['uri'] = $uri;
|
||||
|
||||
$this->addElement('author', $elements);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the unique identifier of the feed item
|
||||
*
|
||||
* On ATOM feeds, the identifier must begin with an valid URI scheme.
|
||||
*
|
||||
* @access public
|
||||
* @param string $id The unique identifier of this item
|
||||
* @param boolean $permaLink The value of the 'isPermaLink' attribute in RSS 2 feeds.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the permaLink parameter is not boolean.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
public function setId($id, $permaLink = false)
|
||||
{
|
||||
if ($this->version == Feed::RSS2) {
|
||||
if (!is_bool($permaLink))
|
||||
throw new \InvalidArgumentException('The permaLink parameter must be boolean.');
|
||||
|
||||
$permaLink = $permaLink ? 'true' : 'false';
|
||||
|
||||
$this->addElement('guid', $id, array('isPermaLink' => $permaLink));
|
||||
} elseif ($this->version == Feed::ATOM) {
|
||||
// Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
|
||||
// The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
|
||||
// by using only permanent or historical schemes.
|
||||
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
|
||||
$found = FALSE;
|
||||
$checkId = strtolower($id);
|
||||
|
||||
foreach($validSchemes as $scheme)
|
||||
if (strrpos($checkId, $scheme . ':', -strlen($checkId)) !== FALSE)
|
||||
{
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
throw new \InvalidArgumentException("The ID must begin with an IANA-registered URI scheme.");
|
||||
|
||||
$this->addElement('id', $id, NULL, TRUE);
|
||||
} else
|
||||
throw new InvalidOperationException('A unique ID is not supported in RSS1 feeds.');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
} // end of class Item
|
42
module/download/vendor/FeedWriter/README.md
vendored
Normal file
42
module/download/vendor/FeedWriter/README.md
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# Generate **RSS 1.0**, **RSS 2.0** or **ATOM** Formatted Feeds
|
||||
|
||||
This package can be used to generate feeds in either **RSS 1.0**, **RSS 2.0** or **ATOM** format.
|
||||
|
||||
Applications can create a feed object, several feed item objects, set several types of properties of either feed and feed items, and add items to the feed.
|
||||
|
||||
Once a feed is fully composed with its items, the feed class can generate the necessary XML structure to describe the feed in **RSS** or **ATOM** format. This structure can be directly sent to the browser, or just returned as string.
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.3 or higher
|
||||
|
||||
If you don't have **PHP 5.3** available on your system there is a version supporting **PHP 5.0** and above. See the `legacy-php-5.0` branch.
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation can be found in the `gh-pages` branch, or on [GitHub Pages](https://mibe.github.io/FeedWriter/).
|
||||
|
||||
See the `/examples` directory for usage examples.
|
||||
|
||||
See the `CHANGELOG.md` file for changes between the different versions.
|
||||
|
||||
## Authors
|
||||
|
||||
In chronological order:
|
||||
|
||||
- [Anis uddin Ahmad](https://github.com/ajaxray)
|
||||
- [Michael Bemmerl](https://github.com/mibe)
|
||||
- Phil Freo
|
||||
- Paul Ferrett
|
||||
- Brennen Bearnes
|
||||
- Michael Robinson
|
||||
- Baptiste Fontaine
|
||||
- Kristián Valentín
|
||||
- Brandtley McMinn
|
||||
- Julian Bogdani
|
||||
- Cedric Gampert
|
||||
- Yamek
|
||||
- Thielj
|
||||
- Pavel Khakhlou
|
||||
- Daniel
|
||||
- Tino Goratsch
|
37
module/download/vendor/FeedWriter/RSS1.php
vendored
Normal file
37
module/download/vendor/FeedWriter/RSS1.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper for creating RSS1 feeds
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class RSS1 extends Feed
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(Feed::RSS1);
|
||||
}
|
||||
}
|
37
module/download/vendor/FeedWriter/RSS2.php
vendored
Normal file
37
module/download/vendor/FeedWriter/RSS2.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper for creating RSS2 feeds
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class RSS2 extends Feed
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(Feed::RSS2);
|
||||
}
|
||||
}
|
18
module/download/view/add/add.css
Normal file
18
module/download/view/add/add.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
54
module/download/view/add/add.js.php
Normal file
54
module/download/view/add/add.js.php
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour enregistrer en brouillon
|
||||
*/
|
||||
$("#downloadAddDraft").on("click", function() {
|
||||
$("#downloadAddState").val(0);
|
||||
$("#downloadAddForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Options de commentaires
|
||||
*/
|
||||
$("#downloadAddCommentClose").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$("#downloadAddCommentNotification").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$("#downloadAddCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadAddCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$( document).ready(function() {
|
||||
|
||||
if ($("#downloadAddCloseComment").is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
|
||||
if ($("#downloadAddCommentNotification").is(':checked') ) {
|
||||
$("#downloadAddCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadAddCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
184
module/download/view/add/add.php
Normal file
184
module/download/view/add/add.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php echo template::formOpen('downloadAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('downloadAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset7">
|
||||
<?php echo template::button('downloadAddDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadAddState', [
|
||||
'value' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadAddPublish', [
|
||||
'value' => 'Publier'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations sur la ressource</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadAddTitle', [
|
||||
'label' => 'Titre'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadAddVersion', [
|
||||
'label' => 'Version'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::date('downloadAddversionDate', [
|
||||
'label' => 'Publiée le'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadAddAuthor', [
|
||||
'label' => 'Auteur'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadAddLicense', $module::$licenses, [
|
||||
'label' => 'Licence'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php if ($module::$categories) {
|
||||
echo template::select('downloadAddCategorie', $module::$categories, [
|
||||
'label' => 'Catégorie'
|
||||
]);
|
||||
} else {
|
||||
echo template::select('downloadAddCategorie', [''=>''], [
|
||||
'label' => 'Pas de catégorie',
|
||||
'disabled' => true
|
||||
]);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::file('downloadAddThumb', [
|
||||
'label' => 'Capture d\'écran',
|
||||
'language' => $this->getData(['user', $this->getUser('id'), 'language']),
|
||||
'type' => 1
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadAddRessourceType', $module::$ressourceType, [
|
||||
'label' => 'Type de ressource',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'ressourceType'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::file('downloadAddFile', [
|
||||
'label' => 'Fichier',
|
||||
'language' => $this->getData(['user', $this->getUser('id'), 'language']),
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'file'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::text('downloadAddUrl', [
|
||||
'label' => 'URL',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'url']),
|
||||
'placeholder' => 'https://'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('downloadAddContent', [
|
||||
'class' => 'editorWysiwyg'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Options de publication</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadAddUserId', $module::$users, [
|
||||
'label' => 'Auteur',
|
||||
'selected' => $this->getUser('id'),
|
||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('downloadAddPublishedOn', [
|
||||
'help' => 'L\'item n\'est visible qu\'après la date de publication prévue.',
|
||||
'label' => 'Date de publication',
|
||||
'value' => time()
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadAddConsent', $module::$itemConsent , [
|
||||
'label' => 'Edition - Suppression',
|
||||
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']),
|
||||
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Commentaires</h4>
|
||||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('downloadAddCommentClose', true, 'Fermer les commentaires', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentClose'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('downloadAddCommentApproved', true, 'Approbation par un modérateur', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']),
|
||||
''
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadAddCommentMaxlength', $module::$commentLength,[
|
||||
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.',
|
||||
'label' => 'Caractères par commentaire',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('downloadAddCommentNotification', true, 'Notification par email', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentNotification']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadAddCommentGroupNotification', $module::$groupNews, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
18
module/download/view/categories/categories.css
Normal file
18
module/download/view/categories/categories.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
23
module/download/view/categories/categories.js.php
Normal file
23
module/download/view/categories/categories.js.php
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".categoriesDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cette catégorie ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
40
module/download/view/categories/categories.php
Normal file
40
module/download/view/categories/categories.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php echo template::formOpen('categoriesForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('categoriesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ">
|
||||
<div class="col10 offset1">
|
||||
<div class="block">
|
||||
<h4>Nouvelle catégorie</h4>
|
||||
<div class="row ">
|
||||
<div class="col10">
|
||||
<?php echo template::text('categoriesTitle', [
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'categories', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
<?php echo template::submit('categoriesSubmit', [
|
||||
'ico' => 'plus',
|
||||
'value' => '',
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php if ($module::$categories): ?>
|
||||
<?php echo template::table([2, 6, 1, 1], $module::$categories, ['Nom', 'URL', '', '']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune catégorie'); ?>
|
||||
<?php endif; ?>
|
||||
<div class=" moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
18
module/download/view/categoryEdit/categoryEdit.css
Normal file
18
module/download/view/categoryEdit/categoryEdit.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
30
module/download/view/categoryEdit/categoryEdit.php
Normal file
30
module/download/view/categoryEdit/categoryEdit.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php echo template::formOpen('categoryEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('categoryEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/categories',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('categoryEditSubmit', [
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Éditer la catégorie</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('categoryEditTitle', [
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'categories', $this->getUrl(2)])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
18
module/download/view/comment/comment.css
Normal file
18
module/download/view/comment/comment.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
62
module/download/view/comment/comment.js.php
Normal file
62
module/download/view/comment/comment.js.php
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".downloadCommentDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Supprimer le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation d'approbation
|
||||
*/
|
||||
$(".downloadCommentApproved").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Approuver le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de rejet
|
||||
*/
|
||||
$(".downloadCommentRejected").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Rejeter le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de suppression en masse
|
||||
*/
|
||||
$(".downloadCommentDeleteAll").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nombre = "<?php echo count($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment' ])); ?>";
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
if( nombre === "1"){
|
||||
var message = "Supprimer le commentaire de l'item " + nom + " ?";
|
||||
} else{
|
||||
var message = "Supprimer les " + nombre + " commentaires de l'item " + nom + " ?";
|
||||
}
|
||||
return core.confirm(message, function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
22
module/download/view/comment/comment.php
Normal file
22
module/download/view/comment/comment.php
Normal file
@ -0,0 +1,22 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadCommentBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
<?php if($module::$comments): ?>
|
||||
<div class="col2 offset8">
|
||||
<?php echo $module::$commentsDelete; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php echo template::table([3, 5, 2, 1, 1], $module::$comments, ['Date', 'Contenu', 'Auteur', '', '']); ?>
|
||||
<?php echo $module::$pages.'<br/>'; ?>
|
||||
<?php else: ?>
|
||||
</div>
|
||||
<?php echo template::speech('Aucun commentaire.'); ?>
|
||||
<?php endif; ?>
|
18
module/download/view/config/config.css
Normal file
18
module/download/view/config/config.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
21
module/download/view/config/config.js.php
Normal file
21
module/download/view/config/config.js.php
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".downloadConfigDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cet item ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
40
module/download/view/config/config.php
Normal file
40
module/download/view/config/config.php
Normal file
@ -0,0 +1,40 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('downloadConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('downloadConfigSetup', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/setup',
|
||||
'value' => template::ico('sliders'),
|
||||
'help' => 'Options'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('downloadConfigCategories', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/categories',
|
||||
'value' => template::ico('table'),
|
||||
'help' => 'Catégories'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('downloadConfigAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||
'class' => 'buttonGreen',
|
||||
'value' => template::ico('plus'),
|
||||
'help' => 'Ajouter une ressource'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($module::$items): ?>
|
||||
<?php echo template::table([2, 2, 1, 2, 1, 1, 1, 1, 1], $module::$items, ['Titre', 'Catégorie ' . $module::$allCategories, 'Version', 'Du', 'Stats', 'État', 'Comm', '', '']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune ressource'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
18
module/download/view/edit/edit.css
Normal file
18
module/download/view/edit/edit.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
77
module/download/view/edit/edit.js.php
Normal file
77
module/download/view/edit/edit.js.php
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
// Lien de connexion
|
||||
$("#downloadEditMailNotification").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigGroup").show();
|
||||
}
|
||||
else {
|
||||
$("#formConfigGroup").hide();
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour enregistrer en brouillon
|
||||
*/
|
||||
$("#downloadEditDraft").on("click", function() {
|
||||
$("#downloadEditState").val(0);
|
||||
$("#downloadEditForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Options de commentaires
|
||||
*/
|
||||
$("#downloadEditCommentClose").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$("#downloadEditCommentNotification").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$("#downloadEditCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadEditCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$( document).ready(function() {
|
||||
|
||||
/** Gestion des commentaires */
|
||||
|
||||
if ($("#downloadEditCloseComment").is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
|
||||
if ($("#downloadEditCommentNotification").is(':checked') ) {
|
||||
$("#downloadEditCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadEditCommentGroupNotification").slideUp();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Paramétrage du sélecteur de date
|
||||
* Supprimer les heures
|
||||
|
||||
const datepickr = flatpickr("#downloadEditversionDate", {});
|
||||
datepickr.set (enableTime, false);
|
||||
*/
|
||||
});
|
195
module/download/view/edit/edit.php
Normal file
195
module/download/view/edit/edit.php
Normal file
@ -0,0 +1,195 @@
|
||||
<?php echo template::formOpen('downloadEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('downloadEditDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadEditState', [
|
||||
'value' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadEditSubmit', [
|
||||
'value' => 'Publier'
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations sur la ressource</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadEditTitle', [
|
||||
'label' => 'Titre',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadEditVersion', [
|
||||
'label' => 'Version',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'version'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::date('downloadEditversionDate', [
|
||||
'label' => 'Publiée le',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'versionDate'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadEditAuthor', [
|
||||
'label' => 'Auteur',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'author'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadEditLicense', $module::$licenses, [
|
||||
'label' => 'Licence',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'license'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php if ($module::$categories) {
|
||||
echo template::select('downloadEditCategorie', $module::$categories, [
|
||||
'label' => 'Catégorie',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'category'])
|
||||
]);
|
||||
} else {
|
||||
echo template::select('downloadEditCategorie', [''=>''], [
|
||||
'label' => 'Pas de catégorie',
|
||||
'disabled' => true
|
||||
]);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::file('downloadEditThumb', [
|
||||
'label' => 'Capture d\'écran',
|
||||
'language' => $this->getData(['user', $this->getUser('id'), 'language']),
|
||||
'type' => 1,
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'thumb'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadEditRessourceType', $module::$ressourceType, [
|
||||
'label' => 'Type de ressource',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'ressourceType'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::file('downloadEditFile', [
|
||||
'label' => 'Fichier',
|
||||
'language' => $this->getData(['user', $this->getUser('id'), 'language']),
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'file'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::text('downloadEditUrl', [
|
||||
'label' => 'URL',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'url']),
|
||||
'placeholder' => 'https://'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('downloadEditContent', [
|
||||
'class' => 'editorWysiwyg',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'content'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Options de publication</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadEditUserId', $module::$users, [
|
||||
'label' => 'Auteur',
|
||||
'selected' => $this->getUser('id'),
|
||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('downloadEditPublishedOn', [
|
||||
'help' => 'L\'item n\'est visible qu\'après la date de publication prévue.',
|
||||
'label' => 'Date de publication',
|
||||
'value' => time()
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadEditConsent', $module::$itemConsent , [
|
||||
'label' => 'Edition - Suppression',
|
||||
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']),
|
||||
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Commentaires</h4>
|
||||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('downloadEditCommentClose', true, 'Fermer les commentaires', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentClose'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('downloadEditCommentApproved', true, 'Approbation par un modérateur', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']),
|
||||
''
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadEditCommentMaxlength', $module::$commentLength,[
|
||||
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.',
|
||||
'label' => 'Caractères par commentaire',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('downloadEditCommentNotification', true, 'Notification par email', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentNotification']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadEditCommentGroupNotification', $module::$groupNews, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
69
module/download/view/index/index.css
Normal file
69
module/download/view/index/index.css
Normal file
@ -0,0 +1,69 @@
|
||||
.rowitem {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
.downloadPicture {
|
||||
float: none;
|
||||
border: 1px;
|
||||
}
|
||||
.downloadPicture img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
/*
|
||||
border:1px solid lightgray;
|
||||
box-shadow: 1px 1px 5px darkgray;
|
||||
*/
|
||||
}
|
||||
|
||||
.downloadPicture:hover {
|
||||
opacity: .7;
|
||||
}
|
||||
.row:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
.downloadComment {
|
||||
padding-right: 10px;
|
||||
float: right;
|
||||
}
|
||||
h2{
|
||||
margin-bottom: 5px;
|
||||
margin-top: 0px;
|
||||
padding: 0px;
|
||||
|
||||
}
|
||||
.downloadContent {
|
||||
float: left;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.downloadDate {
|
||||
font-size:0.8em;
|
||||
font-style: italic;
|
||||
/*
|
||||
color: grey;
|
||||
*/
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.downloadContent {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.downloadPicture img {
|
||||
width: 50% ;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Flux RSS
|
||||
*/
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
65
module/download/view/index/index.php
Normal file
65
module/download/view/index/index.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php if($module::$items): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php foreach($module::$items as $itemId => $item): ?>
|
||||
<div class="row rowitem">
|
||||
<div class="col3 downloadLeft">
|
||||
<?php
|
||||
// Déterminer le nom de la miniature
|
||||
$parts = explode('/',$item['thumb']);
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $item['thumb']);
|
||||
// Créer la miniature si manquante
|
||||
if (!file_exists( self::FILE_DIR . 'thumb/' . $thumb) ) {
|
||||
$this->makeThumb( self::FILE_DIR . 'source/' . $item['thumb'],
|
||||
self::FILE_DIR . 'thumb/' . $thumb,
|
||||
self::THUMBS_WIDTH);
|
||||
}
|
||||
|
||||
?>
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>" class="downloadPicture">
|
||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $item['thumb']; ?>">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col9 downloadRight">
|
||||
<article>
|
||||
<h2 class="downloadTitle">
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>">
|
||||
<?php echo $item['title']; ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="downloadComment">
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>#comment">
|
||||
<?php if ($item['comment']): ?>
|
||||
<?php echo count($item['comment']); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php echo template::ico('comment', ['margin' => 'left']); ?>
|
||||
</div>
|
||||
<div class="downloadDate">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php echo helper::dateUTF8('%d %B %Y - %H:%M', $item['publishedOn']); ?>
|
||||
</div>
|
||||
<p class="downloadContent">
|
||||
<?php echo helper::subword(strip_tags($item['content']), 0, 400); ?>...
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>">Lire la suite</a>
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?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/download/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun item.'); ?>
|
||||
<?php endif; ?>
|
67
module/download/view/item/item.css
Normal file
67
module/download/view/item/item.css
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
#sectionTitle {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.downloadItemPicture {
|
||||
width: 100%;
|
||||
border:1px solid lightgray;
|
||||
box-shadow: 1px 1px 5px;
|
||||
}
|
||||
.downloadItemPictureleft {
|
||||
float: left;
|
||||
margin: 15px 10px 5px 0 ;
|
||||
}
|
||||
.downloadItemPictureright {
|
||||
float: right;
|
||||
margin: 15px 0 5px 10px ;
|
||||
}
|
||||
|
||||
|
||||
.pict20{
|
||||
width: 20%;
|
||||
}
|
||||
.pict30{
|
||||
width: 30%;
|
||||
}
|
||||
.pict40{
|
||||
width: 40%;
|
||||
}
|
||||
.pict50{
|
||||
width: 50%;
|
||||
}
|
||||
.pict100{
|
||||
width: 100%;
|
||||
margin: 15px 0 20px 0 ;
|
||||
}
|
||||
|
||||
#downloaditemCommentShow {
|
||||
cursor: text;
|
||||
}
|
||||
#downloaditemOr {
|
||||
padding: 10px;
|
||||
}
|
||||
.downloadDate {
|
||||
font-size:0.8em;
|
||||
font-style: italic;
|
||||
color: grey;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.downloaditemPicture {
|
||||
height:auto;
|
||||
max-width: 100%;}
|
||||
}
|
||||
|
||||
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.itemInfo, .itemContent {
|
||||
min-height: 25em;
|
||||
}
|
50
module/download/view/item/item.js.php
Normal file
50
module/download/view/item/item.js.php
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Incrémente les stats
|
||||
*/
|
||||
$('#downloadItemFile').click(function() {
|
||||
$('#downloadStats').html(function(i, val) { return val*1+1 });
|
||||
});
|
||||
|
||||
/**
|
||||
* Affiche le bloc pour rédiger un commentaire
|
||||
*/
|
||||
var commentShowDOM = $("#downloadItemCommentShow");
|
||||
commentShowDOM.on("click focus", function() {
|
||||
$("#downloadItemCommentShowWrapper").fadeOut(function() {
|
||||
$("#downloadItemCommentWrapper").fadeIn();
|
||||
$("#downloadItemCommentContent").trigger("focus");
|
||||
});
|
||||
});
|
||||
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("");
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Force le scroll vers les commentaires en cas d'erreur
|
||||
*/
|
||||
$("#downloadItemCommentForm").on("submit", function() {
|
||||
$(location).attr("href", "#comment");
|
||||
});
|
226
module/download/view/item/item.php
Normal file
226
module/download/view/item/item.php
Normal file
@ -0,0 +1,226 @@
|
||||
<div class="row">
|
||||
<div class="col3 itemInfo">
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'thumb'])): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
$pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']);
|
||||
$parts = explode('/',$this->getData(['module', $this->getUrl(0), 'posts',$this->getUrl(1), 'thumb']));
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'thumb']));
|
||||
echo '<img class="downloadItemPicture" src="' . helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb .
|
||||
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'thumb']) . '">';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'ressourceType']) !== 'content'): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'ressourceType'])) {
|
||||
case 'file':
|
||||
$href = helper::baseUrl() . $this->getUrl(0) . '/downloadFile/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];
|
||||
$target = '_self';
|
||||
break;
|
||||
case 'url' :
|
||||
$href = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'url']);
|
||||
$target = '_blank';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<?php echo template::button('downloadItemFile', [
|
||||
'href' => $href,
|
||||
'value' => 'Télécharger',
|
||||
'target'=> $target
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'version']) ): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo 'Version n°' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'version']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'date']) ): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo ' du ' . helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'date']));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Auteur :
|
||||
<?php echo $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'author']); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Licence :
|
||||
<?php echo $module::$licenses[$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'license'])]; ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'file'])): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Téléchargements : <span id="downloadStats"><?php echo $module::$statSum;'<span>'?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12 itemContent">
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row verticalAlignMiddle">
|
||||
<div class="col12 downloadDate">
|
||||
<?php echo $module::$itemSignature . ' - ';?>
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php $date = helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']));
|
||||
$heure = helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']));
|
||||
echo $date . ' à ' . $heure;
|
||||
?>
|
||||
|
||||
<!-- Bouton d'édition -->
|
||||
<?php if (
|
||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
AND
|
||||
( // Propriétaire
|
||||
(
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
OR (
|
||||
// Groupe
|
||||
( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
|
||||
OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
|
||||
AND $this->getUser('group') >= $module::$actions['config']
|
||||
)
|
||||
)
|
||||
): ?>
|
||||
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>">
|
||||
<?php echo template::ico('pencil');?> Éditer
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<!-- 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/download/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bloc commentaire -->
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<p>Cet item ne reçoit pas de commentaire.</p>
|
||||
<?php else: ?>
|
||||
<h3 id="comment">
|
||||
<?php //$commentsNb = count($module::$comments); ?>
|
||||
<?php $commentsNb = $module::$nbCommentsApproved; ?>
|
||||
<?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', [
|
||||
'placeholder' => 'Rédiger un commentaire...',
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
<div id="downloadItemCommentWrapper" class="displayNone">
|
||||
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<?php echo template::text('downloadItemUserName', [
|
||||
'label' => 'Nom',
|
||||
'readonly' => true,
|
||||
'value' => $module::$editCommentSignature
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadItemUserId', [
|
||||
'value' => $this->getUser('id')
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php echo template::text('downloadItemAuthor', [
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 textAlignCenter verticalAlignBottom">
|
||||
<div id="downloadItemOr">Ou</div>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
<?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', [
|
||||
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' caractères',
|
||||
'class' => 'editorWysiwygComment',
|
||||
'noDirty' => true,
|
||||
'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
|
||||
]); ?>
|
||||
<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', [
|
||||
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
||||
'type' => $this->getData(['config','connect', 'captchaType'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('downloadItemCommentHide', [
|
||||
'class' => 'buttonGrey',
|
||||
'value' => 'Annuler'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadItemSubmit', [
|
||||
'value' => 'Envoyer',
|
||||
'ico' => ''
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php foreach($module::$comments as $commentId => $comment): ?>
|
||||
<div class="block">
|
||||
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
||||
le <?php echo helper::dateUTF8('%d %B %Y - %H:%M', $comment['createdOn']);
|
||||
?>
|
||||
<?php echo $comment['content']; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $module::$pages; ?>
|
1
module/download/view/list/list.php
Normal file
1
module/download/view/list/list.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- rien -->
|
1
module/download/view/rss/rss.php
Normal file
1
module/download/view/rss/rss.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- rien -->
|
18
module/download/view/setup/setup.css
Normal file
18
module/download/view/setup/setup.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
47
module/download/view/setup/setup.php
Normal file
47
module/download/view/setup/setup.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php echo template::formOpen('downloadConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('downloadConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('downloadConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres
|
||||
</h4>
|
||||
<div class="blockContainer">
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('downloadConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('downloadConfigFeedslabel', [
|
||||
'label' => 'Etiquette du flux',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
||||
|
18
module/download/view/stats/stats.css
Normal file
18
module/download/view/stats/stats.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
22
module/download/view/stats/stats.js.php
Normal file
22
module/download/view/stats/stats.js.php
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".statsDeleteAll").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir purger les statistiques ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
36
module/download/view/stats/stats.php
Normal file
36
module/download/view/stats/stats.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php echo template::formOpen('statsConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('statsConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('statsConfigAdd', [
|
||||
'class' => 'statsDeleteAll buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/statsDeleteAll' . '/' . $this->getUrl(2) . '/'. $_SESSION['csrf'] ,
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Purger'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<h3> Nombre de téléchargements :
|
||||
<?php echo $module::$statSum; ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$items): ?>
|
||||
<?php echo template::table([6, 6], $module::$items, ['Date', 'Adresse IP']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun item.'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
2
module/registration/changes.md
Normal file
2
module/registration/changes.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Version 1.2
|
||||
- Compatiblité PHP 8.2
|
388
module/registration/registration.php
Normal file
388
module/registration/registration.php
Normal file
@ -0,0 +1,388 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
class registration extends common {
|
||||
|
||||
const VERSION = '1.2';
|
||||
const REALNAME = 'Auto-Inscription';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
|
||||
const STATUS_AWAITING = NULL; // En attente de validation du mail
|
||||
const STATUS_VALIDATED = -2; // Mail validé en attente d'un admin
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_VISITOR,
|
||||
'validate' => self::GROUP_VISITOR,
|
||||
'config' => self::GROUP_ADMIN,
|
||||
'user' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'edit' => self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
public static $statusGroups = [
|
||||
self::STATUS_AWAITING => 'En attente',
|
||||
self::STATUS_VALIDATED => 'Email validé',
|
||||
];
|
||||
|
||||
public static $timeLimit = [
|
||||
2 => '2 minutes',
|
||||
5 => '5 minutes',
|
||||
10 => '10 minutes'
|
||||
];
|
||||
|
||||
public static $users = [];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Liste des utilisateurs en attente
|
||||
*/
|
||||
public function user() {
|
||||
$userIdsFirstnames = helper::arraycollumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
||||
if ( $this->getData(['user',$userId,'group']) === self::STATUS_AWAITING ||
|
||||
$this->getData(['user',$userId,'group']) === self::STATUS_VALIDATED ) {
|
||||
self::$users[] = [
|
||||
$userId,
|
||||
$userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
self::$statusGroups[$this->getData(['user', $userId, 'group'])] ,
|
||||
helper::dateUTF8(date('Y-m-d G:i'), $this->getData(['user', $userId, 'timer'])),
|
||||
template::button('registrationUserEdit' . $userId, [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $userId . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('registrationUserDelete' . $userId, [
|
||||
'class' => 'userDelete red',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $userId . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Demandes d\'inscription',
|
||||
'view' => 'user'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function edit() {
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf'] &&
|
||||
$this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . 'user',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Accès refusé
|
||||
if(
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Droit d'édition
|
||||
AND (
|
||||
// Impossible de s'auto-éditer
|
||||
(
|
||||
$this->getUser('id') === $this->getUrl(2)
|
||||
AND $this->getUrl('group') <= self::GROUP_VISITOR
|
||||
)
|
||||
// Impossible d'éditer un autre utilisateur
|
||||
OR ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Accès autorisé
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Modification du groupe
|
||||
$this->setData([
|
||||
'user',
|
||||
$this->getUrl(2),
|
||||
[
|
||||
'firstname' => $this->getData(['user',$this->getUrl(2),'firstname']),
|
||||
'forgot' => 0,
|
||||
'group' => $this->getInput('registrationUserEditGroup',helper::FILTER_INT),
|
||||
'lastname' => $this->getData(['user',$this->getUrl(2),'lastname']),
|
||||
'mail' => $this->getData(['user',$this->getUrl(2),'mail']),
|
||||
'password' => $this->getData(['user',$this->getUrl(2),'password']),
|
||||
'connectFail' => $this->getData(['user',$this->getUrl(2),'connectFail']),
|
||||
'connectTimeout' => $this->getData(['user',$this->getUrl(2),'connectTimeout']),
|
||||
'accessUrl' => $this->getData(['user',$this->getUrl(2),'accessUrl']),
|
||||
'accessTimer' => $this->getData(['user',$this->getUrl(2),'accessTimer']),
|
||||
'accessCsrf' => $this->getData(['user',$this->getUrl(2),'accessCsrf'])
|
||||
]
|
||||
]);
|
||||
// Notifier le user uniquement si le groupe est membre au moins membre
|
||||
if ($this->getInput('registrationUserEditGroup') >= 1 ) {
|
||||
$this->sendMail(
|
||||
$this->getData(['user',$this->getUrl(2),'mail']),
|
||||
'Approbation de l\'inscription',
|
||||
'<p>' . $this->getdata(['module','registration',$this->getUrl(0),'config','mailValidateContent']) . '</p>'
|
||||
|
||||
);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $this->getData(['user', $this->getUrl(2), 'firstname']) . ' ' . $this->getData(['user', $this->getUrl(2), 'lastname']),
|
||||
'view' => 'edit'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete() {
|
||||
// Accès refusé
|
||||
if(
|
||||
// L'utilisateur n'existe pas
|
||||
$this->getData(['user', $this->getUrl(2)]) === null
|
||||
// Groupe insuffisant
|
||||
AND ($this->getUrl('group') < self::GROUP_MODERATOR)
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user',
|
||||
'notification' => 'Action interdite'
|
||||
]);
|
||||
}
|
||||
// Bloque la suppression de son propre compte
|
||||
elseif($this->getUser('id') === $this->getUrl(2)) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user',
|
||||
'notification' => 'Impossible de supprimer votre propre compte'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['user', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/user',
|
||||
'notification' => 'Utilisateur supprimé',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ajout
|
||||
*/
|
||||
public function index() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$check=true;
|
||||
// L'identifiant d'utilisateur est indisponible
|
||||
$userId = $this->getInput('registrationAddId', helper::FILTER_ID, true);
|
||||
if($this->getData(['module','registration', $userId])) {
|
||||
self::$inputNotices['registrationAddId'] = 'Identifiant déjà utilisé';
|
||||
$check=false;
|
||||
}
|
||||
// Double vérification pour le mot de passe
|
||||
if($this->getInput('registrationAddPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('registrationAddConfirmPassword', helper::FILTER_STRING_SHORT, true)) {
|
||||
self::$inputNotices['registrationAddConfirmPassword'] = 'Incorrect';
|
||||
$check = false;
|
||||
}
|
||||
// Le mail existe déjà
|
||||
foreach($this->getData(['user']) as $usersId => $user) {
|
||||
if($user['mail'] === $this->getInput('registrationAddMail', helper::FILTER_MAIL, true) ) {
|
||||
self::$inputNotices['registrationAddMail'] = 'Mail déjà utilisé';
|
||||
$check = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Données de l'utilisateur
|
||||
$userFirstname = $this->getInput('registrationAddFirstname', helper::FILTER_STRING_SHORT, true);
|
||||
$userLastname = $this->getInput('registrationAddLastname', helper::FILTER_STRING_SHORT, true);
|
||||
$userMail = $this->getInput('registrationAddMail', helper::FILTER_MAIL, true);
|
||||
$userTimer = $this->getInput('registrationAddTimer', helper::FILTER_INT, true);
|
||||
// Pas de nom saisi
|
||||
if (empty($userFirstname) ||
|
||||
empty($userLastname) ||
|
||||
empty($this->getInput('registrationAddPassword', helper::FILTER_STRING_SHORT, true)) ||
|
||||
empty($this->getInput('registrationAddConfirmPassword', helper::FILTER_STRING_SHORT, true))) {
|
||||
$check=false;
|
||||
}
|
||||
// Si tout est ok
|
||||
if ($check === true) {
|
||||
// création effective temporaire
|
||||
$this->setData([
|
||||
'user',
|
||||
$userId,
|
||||
[
|
||||
'firstname' => $userFirstname,
|
||||
'lastname' => $userLastname,
|
||||
'mail' => $userMail,
|
||||
'password' => $this->getInput('registrationAddPassword', helper::FILTER_PASSWORD, true),
|
||||
// pas de groupe afin de le différencier dans la liste des users
|
||||
'group' => null,
|
||||
'forgot' => 0,
|
||||
'timer' => $userTimer,
|
||||
'auth' => $_SESSION['csrf'],
|
||||
'status' => self::STATUS_AWAITING
|
||||
]
|
||||
]);
|
||||
// Mail d'avertissement aux administrateurs
|
||||
// Utilisateurs dans le groupe admin
|
||||
$to = [];
|
||||
foreach($this->getData(['user']) as $userId => $user) {
|
||||
if($user['group'] == self::GROUP_ADMIN) {
|
||||
$to[] = $user['mail'];
|
||||
}
|
||||
}
|
||||
// Envoi du mail
|
||||
if($to) {
|
||||
$messageAdmin = $this->getdata(['module','registration',$this->getUrl(0),'config','state']) ? 'Une demande d\'inscription attend l`approbation d\'un administrateur.' : 'Un nouveau membre s\'est inscrit.';
|
||||
// Envoi le mail
|
||||
$this->sendMail(
|
||||
$to,
|
||||
'Auto-inscription sur le site ' . $this->getData(['config', 'title']),
|
||||
'<p>' . $messageAdmin . '</p>' .
|
||||
'<p><strong>Identifiant du compte :</strong> ' . $userId .' (' . $userFirstname . ' ' . $userLastname . ')<br>' .
|
||||
'<strong>Email :</strong> ' . $userMail . '</p>' .
|
||||
'<a href="' . helper::baseUrl() . 'user/login/' . strip_tags(str_replace('/', '_', $this->getUrl(0) . '/user')) . '">Validation de l\'inscription</a>'
|
||||
);
|
||||
}
|
||||
|
||||
// Mail de confirmation à l'utilisateur
|
||||
// forger le lien de vérification
|
||||
$validateLink = helper::baseUrl(true) . $this->getUrl() . '/validate/' . $userId . '/' . $_SESSION['csrf'];
|
||||
// Envoi
|
||||
$sentMailtoUser = false;
|
||||
if($check === true) {
|
||||
$sentMailtoUser = $this->sendMail(
|
||||
$userMail,
|
||||
'Confirmation de votre inscription',
|
||||
'<p>' . $this->getdata(['module','registration',$this->getUrl(0),'config','mailRegisterContent']) . '</p>' .
|
||||
'<a href="'. $validateLink . '">Activer votre compte<a/>'
|
||||
);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl(),
|
||||
//'redirect' => $validateLink,
|
||||
'notification' => $sentMailtoUser ? "Consultez votre messagerie, un mail vous a été envoyé." : 'Quelque chose n\'a pas fonctionné !',
|
||||
'state' => $sentMailtoUser ? true : false
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Inscription',
|
||||
'view' => 'index',
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérification de l'email
|
||||
*/
|
||||
public function validate() {
|
||||
// Vérifie la session + l'id + le timer
|
||||
$check = true;
|
||||
$notification = 'Bienvenue sur le site' . $this->getData(['config', 'title']) ;
|
||||
$csrf = $this->getUrl(3);
|
||||
$userId = $this->getUrl(2);
|
||||
// Validité
|
||||
if ( time() - $this->getData(['user',$userId,'timer']) <= (60 * $this->getdata(['module','registration',$this->getUrl(0),'config','pageTimeOut'])) ) {
|
||||
$check = false;
|
||||
$notification = 'Le lien n\'est plus valide';
|
||||
}
|
||||
if (( $csrf !== $this->getData(['user',$userId,'auth']) ) ) {
|
||||
$check = false;
|
||||
$notification = 'Identifiant ou mot de passe inconnu';
|
||||
}
|
||||
if ($check) {
|
||||
$this->setData([
|
||||
'user',
|
||||
$userId,
|
||||
[
|
||||
'firstname' => $this->getData(['user',$userId,'firstname']),
|
||||
'lastname' => $this->getData(['user',$userId,'lastname']),
|
||||
'mail' => $this->getData(['user',$userId,'mail']),
|
||||
'password' => $this->getData(['user',$userId,'password']),
|
||||
'group' => $this->getdata(['module','registration',$this->getUrl(0),'config','state']) === true ? self::STATUS_VALIDATED : self::GROUP_MEMBER,
|
||||
'forgot' => 0,
|
||||
'timer' => $this->getData(['user',$userId,'timer'])
|
||||
]
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => $check ? helper::baseUrl() . $this->getdata(['module','registration',$this->getUrl(0),'config','pageSuccess']) : helper::baseUrl() . $this->getdata(['module','registration',$this->getUrl(0),'config','pageError']) ,
|
||||
'notificaton' => $notification,
|
||||
'state' => $check
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Module de configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Lire les options et les enregistrer
|
||||
$this->setData(['module','registration',$this->getUrl(0),'config', [
|
||||
'timeOut' => $this->getInput('registrationConfigTimeOut',helper::FILTER_INT),
|
||||
'pageSuccess' => $this->getInput('registrationConfigSuccess'),
|
||||
'pageError' => $this->getInput('registrationConfigError'),
|
||||
'state' => $this->getInput('registrationConfigState',helper::FILTER_BOOLEAN),
|
||||
'mailRegisterContent' => $this->getInput('registrationconfigMailRegisterContent', null, true),
|
||||
'mailValidateContent' => $this->getInput('registrationconfigMailValidateContent', null, true),
|
||||
]]);
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration',
|
||||
'view' => 'config',
|
||||
'vendor' => ['tinymce']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
15
module/registration/view/config/config.css
Normal file
15
module/registration/view/config/config.css
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
@import url("core/layout/admin.css");
|
92
module/registration/view/config/config.php
Normal file
92
module/registration/view/config/config.php
Normal file
@ -0,0 +1,92 @@
|
||||
|
||||
<?php echo template::formOpen('registrationConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('registrationConfigBack', [
|
||||
'class' => '',
|
||||
'href' => helper::baseUrl() .'page/edit/' . $this->getUrl(0) ,
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('registrationConfigBack', [
|
||||
'href' => helper::baseUrl() .$this->getUrl(0) . '/user' ,
|
||||
'value' => 'Inscriptions'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('registrationConfigSubmit',[
|
||||
'class' => 'green'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('registrationConfigTimeOut', $module::$timeLimit , [
|
||||
'label' => 'Validité du lien',
|
||||
'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','timeOut'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('registrationConfigSuccess', helper::arraycollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
||||
'label' => 'Redirection après confirmation',
|
||||
'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','pageSuccess'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('registrationConfigError', helper::arraycollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
|
||||
'label' => 'Redirection après erreur',
|
||||
'selected' => $this->getData(['module','registration',$this->getUrl(0),'config','pageError'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php $messageDefault = '<p>Confirmez votre inscription en cliquant sur ce lien dans les ... minutes.</p>'; ?>
|
||||
<?php echo template::textarea('registrationconfigMailRegisterContent', [
|
||||
'label' => 'Corps du mail de confirmation',
|
||||
'value' => !empty($this->getData(['module','registration',$this->getUrl(0),'config','mailRegisterContent'])) ? $this->getData(['module','registration',$this->getUrl(0),'config','mailRegisterContent']) : $messageDefault,
|
||||
'class' => 'editorWysiwyg',
|
||||
'help' => 'Précisez la durée de validité. Le lien sera inséré après ces explications.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Approbation préalable</h4>
|
||||
<div class="row">
|
||||
<div class="col6 verticalAlignMiddle">
|
||||
<?php echo template::checkbox('registrationConfigState', true, 'Activée', [
|
||||
'checked' => $this->getData(['module','registration',$this->getUrl(0),'config','state']),
|
||||
'help' => 'Les comptes sont inactifs tant que les inscriptions ne sont pas approuvées par un administrateur.',
|
||||
'check' => true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php $messageDefault = '<p>Votre inscription a été approuvée par un administrateur.</p>'; ?>
|
||||
<?php echo template::textarea('registrationconfigMailValidateContent', [
|
||||
'label' => 'Corps du mail d\'approbation',
|
||||
'value' =>!empty($this->getData(['module','registration',$this->getUrl(0),'config','mailValidateContent'])) ? $this->getData(['module','registration',$this->getUrl(0),'config','mailValidateContent']) : $messageDefault,
|
||||
'class' => 'editorWysiwyg'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°<?php echo $module::VERSION; ?>
|
||||
</div>
|
16
module/registration/view/edit/edit.css
Normal file
16
module/registration/view/edit/edit.css
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
|
||||
@import url("core/layout/admin.css");
|
19
module/registration/view/edit/edit.js.php
Normal file
19
module/registration/view/edit/edit.js.php
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Droits des groupes
|
||||
*/
|
||||
$("#registrationUserEditGroup").on("change", function() {
|
||||
$(".registrationUserEditGroupDescription").hide();
|
||||
$("#registrationUserEditGroupDescription" + $(this).val()).show();
|
||||
}).trigger("change");
|
111
module/registration/view/edit/edit.php
Normal file
111
module/registration/view/edit/edit.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php echo template::formOpen('registrationUserEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php if($this->getUrl(3)): ?>
|
||||
<?php echo template::button('registrationUserEditBack', [
|
||||
'class' => '',
|
||||
'href' => helper::baseUrl() . $this->geturl(0) . '/user',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::button('registrationUserEditBack', [
|
||||
'class' => '',
|
||||
'href' => helper::baseUrl(false),
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('registrationUserEditSubmit',[
|
||||
'class' => 'green'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Confirmation de l'inscription</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('registrationUserEditFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'firstname']),
|
||||
'disabled'=> true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('registrationUserEditLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'lastname']),
|
||||
'disabled'=> true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::mail('registrationUserEditMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail',
|
||||
'value' => $this->getData(['user', $this->getUrl(2), 'mail']),
|
||||
'disabled'=> true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php $status = $module::$statusGroups[$this->getData(['user', $this->getUrl(2), 'group'])];?>
|
||||
<?php echo template::text('resgistrationUserState', [
|
||||
'label' => 'État de l\'inscription',
|
||||
'value' => $status,
|
||||
'disabled'=> true,
|
||||
'help' => 'En attente : le mail n\'a pas encore été validé<br>Email validé : approbation nécessaire.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('resgistrationUsertimer', [
|
||||
'label' => 'Date',
|
||||
'value' => helper::dateUTF8(date('Y-m-d G:i'), $this->getData(['user', $userId, 'timer'])),
|
||||
'disabled'=> true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col6">
|
||||
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<?php echo template::select('registrationUserEditGroup', self::$groupEdits, [
|
||||
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
|
||||
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
|
||||
'label' => 'Groupe <em>(Banni : en attente d\'approbation)</em>',
|
||||
'selected' => $this->getData(['user', $this->getUrl(2), 'group'])
|
||||
]); ?>
|
||||
Autorisations :
|
||||
<ul id="registrationUserEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="registrationUserEditGroupDescription displayNone">
|
||||
<li>Accès aux pages privées membres</li>
|
||||
</ul>
|
||||
<ul id="registrationUserEditGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="registrationUserEditGroupDescription displayNone">
|
||||
<li>Accès aux pages privées membres et éditeurs</li>
|
||||
<li>Ajout - Édition - Suppression de pages</li>
|
||||
<li>Ajout - Édition - Suppression de fichiers</li>
|
||||
</ul>
|
||||
<ul id="registrationUserEditGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="registrationUserEditGroupDescription displayNone">
|
||||
<li>Accès à toutes les pages privées</li>
|
||||
<li>Ajout - Édition - Suppression de pages</li>
|
||||
<li>Ajout - Édition - Suppression de fichiers</li>
|
||||
<li>Ajout / Édition / Suppression d'utilisateurs</li>
|
||||
<li>Configuration du site</li>
|
||||
<li>Personnalisation du thème</li>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
47
module/registration/view/index/index.js.php
Normal file
47
module/registration/view/index/index.js.php
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Affichage de l'id en simulant FILTER_ID
|
||||
*/
|
||||
$("#registrationAddId").on("change keydown keyup", function(event) {
|
||||
var userId = $(this).val();
|
||||
if(
|
||||
event.keyCode !== 8 // BACKSPACE
|
||||
&& event.keyCode !== 37 // LEFT
|
||||
&& event.keyCode !== 39 // RIGHT
|
||||
&& event.keyCode !== 46 // DELETE
|
||||
&& window.getSelection().toString() !== userId // Texte sélectionné
|
||||
) {
|
||||
var searchReplace = {
|
||||
"á": "a", "à": "a", "â": "a", "ä": "a", "ã": "a", "å": "a", "ç": "c", "é": "e", "è": "e", "ê": "e", "ë": "e", "í": "i", "ì": "i", "î": "i", "ï": "i", "ñ": "n", "ó": "o", "ò": "o", "ô": "o", "ö": "o", "õ": "o", "ú": "u", "ù": "u", "û": "u", "ü": "u", "ý": "y", "ÿ": "y",
|
||||
"Á": "A", "À": "A", "Â": "A", "Ä": "A", "Ã": "A", "Å": "A", "Ç": "C", "É": "E", "È": "E", "Ê": "E", "Ë": "E", "Í": "I", "Ì": "I", "Î": "I", "Ï": "I", "Ñ": "N", "Ó": "O", "Ò": "O", "Ô": "O", "Ö": "O", "Õ": "O", "Ú": "U", "Ù": "U", "Û": "U", "Ü": "U", "Ý": "Y", "Ÿ": "Y",
|
||||
"'": "-", "\"": "-", " ": "-"
|
||||
};
|
||||
userId = userId.replace(/[áàâäãåçéèêëíìîïñóòôöõúùûüýÿ'" ]/ig, function(match) {
|
||||
return searchReplace[match];
|
||||
});
|
||||
userId = userId.replace(/[^a-z0-9-]/ig, "");
|
||||
$(this).val(userId);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Droits des groupes
|
||||
*/
|
||||
$("#registrationAddGroup").on("change", function() {
|
||||
$(".registrationAddGroupDescription").hide();
|
||||
$("#registrationAddGroupDescription" + $(this).val()).show();
|
||||
}).trigger("change");
|
||||
|
||||
|
82
module/registration/view/index/index.php
Normal file
82
module/registration/view/index/index.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php echo template::formOpen('registrationAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col8 offset2">
|
||||
<div class='block'>
|
||||
<h4>Identité</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('registrationAddFirstname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Prénom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('registrationAddLastname', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::mail('registrationAddMail', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Adresse mail'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::hidden('registrationAddGroup', [
|
||||
'value' => self::GROUP_MEMBER
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='block'>
|
||||
<h4>Données de connexion</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('registrationAddId', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Identifiant de connexion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::password('registrationAddPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Mot de passe'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::password('registrationAddConfirmPassword', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Confirmation du mot de passe'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::hidden('registrationAddTimer', [
|
||||
'value' => time()
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('registrationAddSubmit', [
|
||||
'value' => 'Envoyer',
|
||||
'class' => 'green'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
16
module/registration/view/user/user.css
Normal file
16
module/registration/view/user/user.css
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
|
||||
@import url("core/layout/admin.css");
|
21
module/registration/view/user/user.js.php
Normal file
21
module/registration/view/user/user.js.php
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".registrationUserDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cet utilisateur ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
15
module/registration/view/user/user.php
Normal file
15
module/registration/view/user/user.php
Normal file
@ -0,0 +1,15 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('registrationUserBack', [
|
||||
'class' => '',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($module::$users): ?>
|
||||
<?php echo template::table([3, 3, 2,21, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Etat', 'Date', '', '']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Pas d\'inscription en attente.'); ?>
|
||||
<?php endif; ?>
|
2
module/registration/view/validate/validate.php
Normal file
2
module/registration/view/validate/validate.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Page vide
|
1
module/slider/enum.json
Normal file
1
module/slider/enum.json
Normal file
@ -0,0 +1 @@
|
||||
{"name":"slider","realName":"Slider","version":"5.0","update":"0.0","delete":true,"dataDirectory":""}
|
460
module/slider/slider.php
Normal file
460
module/slider/slider.php
Normal file
@ -0,0 +1,460 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*
|
||||
*/
|
||||
|
||||
class slider extends common
|
||||
{
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'update' => self::GROUP_MODERATOR,
|
||||
'theme' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'dirs' => self::GROUP_MODERATOR,
|
||||
'index' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
const VERSION = '5.0';
|
||||
const REALNAME = 'Slider';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
|
||||
public static $directories = [];
|
||||
|
||||
public static $firstPictures = [];
|
||||
|
||||
public static $galleries = [];
|
||||
|
||||
public static $pictures = [];
|
||||
|
||||
public static $pageList = [];
|
||||
|
||||
//Visibilité des boutons de navigation
|
||||
public static $namespace = [
|
||||
'white-btns' => 'Blancs',
|
||||
'centered-btns' => 'Noirs',
|
||||
'transparent-btns' => 'Bandes invisibles',
|
||||
'large-btns' => 'Bandes grises',
|
||||
];
|
||||
|
||||
// Pager
|
||||
public static $pager = [
|
||||
true => 'Puces visibles',
|
||||
false => 'Puces invisibles'
|
||||
];
|
||||
|
||||
public static $auto = [
|
||||
true => 'Active',
|
||||
false => 'Inactive'
|
||||
];
|
||||
|
||||
// Largeur
|
||||
public static $screenWidth = [
|
||||
640 => '640 pixels',
|
||||
720 => '720 pixels',
|
||||
768 => '768 pixels',
|
||||
800 => '800 pixels',
|
||||
854 => '854 pixels',
|
||||
1024 => '1024 pixels',
|
||||
1280 => '1280 pixels',
|
||||
1400 => '1400 pixels',
|
||||
1600 => '1600 pixels',
|
||||
1920 => '1920 pixels',
|
||||
0 => 'Largeur de l\'écran'
|
||||
];
|
||||
public static $selectedMaxwidth = 0;
|
||||
|
||||
// Transition
|
||||
public static $speed = [
|
||||
'500' => '500 ms',
|
||||
'1000' => '1 s',
|
||||
'1500' => '1.5 s',
|
||||
'2000' => '2 s',
|
||||
'2500' => '2.5 s',
|
||||
'3000' => '3 s',
|
||||
'3500' => '3.5 s'
|
||||
];
|
||||
|
||||
// Imeout
|
||||
public static $timeout = [
|
||||
'500' => '500 ms',
|
||||
'1000' => '1 s',
|
||||
'1500' => '1.5 s',
|
||||
'2000' => '2 s',
|
||||
'3000' => '3 s',
|
||||
'5000' => '5 s',
|
||||
'7000' => '7 s',
|
||||
'10000' => '10 s'
|
||||
];
|
||||
|
||||
//Visibilité de la légende
|
||||
public static $visibilite_legende = [
|
||||
'survol' => 'Au survol',
|
||||
'toujours' => 'Toujours visible',
|
||||
'jamais' => 'Jamais visible'
|
||||
];
|
||||
|
||||
//Position de la légende
|
||||
public static $position_legende = [
|
||||
'haut' => 'En haut',
|
||||
'bas' => 'En bas'
|
||||
];
|
||||
|
||||
//Temps d'apparition légende et boutons
|
||||
public static $apparition = [
|
||||
'opacity 0.2s ease-in' => '0.2s',
|
||||
'opacity 0.5s ease-in' => '0.5s',
|
||||
'opacity 1s ease-in' => '1s',
|
||||
'opacity 2s ease-in' => '2s'
|
||||
];
|
||||
|
||||
|
||||
//Choix du tri
|
||||
public static $sort = [
|
||||
'asc' => 'Alphabétique naturel',
|
||||
'dsc' => 'Alphabétique naturel inverse',
|
||||
'rand' => 'Aléatoire',
|
||||
'none' => 'Par défaut, sans tri',
|
||||
];
|
||||
|
||||
/**
|
||||
* Mise à jour du dossier
|
||||
*/
|
||||
public function update()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'directory',
|
||||
$this->getInput('galleryUpdateDirectory', helper::FILTER_STRING_SHORT, true)
|
||||
]);
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration de la galerie',
|
||||
'view' => 'update'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
// Initialise le module
|
||||
$this->init();
|
||||
|
||||
// Liste des pages active à l'exclusion des barres latérales
|
||||
$pagesId = $this->getHierarchy(null, false, null);
|
||||
$excludeBar = $this->getHierarchy(null, false, true);
|
||||
$pagesId = array_diff_key($pagesId, $excludeBar);
|
||||
|
||||
// Construit le tableau pour le select du formulaire
|
||||
foreach ($pagesId as $parentKey => $parentValue) {
|
||||
self::$pageList[$parentKey] = $this->getData(['page', $parentKey, 'title']);
|
||||
foreach ($parentValue as $childKey) {
|
||||
self::$pageList[$childKey] = $this->getData(['page', $childKey, 'title']);
|
||||
}
|
||||
}
|
||||
// Aucun choix
|
||||
self::$pageList = array_merge([0 => ''], self::$pageList);
|
||||
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
|
||||
$inputs['legends'] = $this->getInput('legends', null);
|
||||
$inputs['uri'] = $this->getInput('sliderHref', null);
|
||||
|
||||
// Supprime les points devant les extensions des clés à cause du système de BDD
|
||||
foreach ($inputs as $keyinputs => $valuesinputs) {
|
||||
foreach ($valuesinputs as $keyinput => $valueinput) {
|
||||
$datas[$keyinputs][str_replace('.', '', $keyinput)] = $valueinput;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
[
|
||||
'directory' => $this->getData(['module', $this->getUrl(0), 'directory']),
|
||||
'theme' => $this->getData(['module', $this->getUrl(0), 'theme']),
|
||||
'legends' => $datas['legends'],
|
||||
'uri' => $datas['uri']
|
||||
]
|
||||
]);
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
// Met en forme le tableau
|
||||
$directory = $this->getData(['module', $this->getUrl(0), 'directory']);
|
||||
if ($directory && is_dir($directory)) {
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
foreach ($iterator as $fileInfos) {
|
||||
if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) {
|
||||
self::$pictures[$fileInfos->getFilename()] = [
|
||||
$fileInfos->getFilename(),
|
||||
template::text('legends[' . $fileInfos->getFilename() . ']', [
|
||||
'value' => empty($this->getData(['module', $this->getUrl(0), 'legends', str_replace('.', '', $fileInfos->getFilename())]))
|
||||
? ''
|
||||
: $this->getData(['module', $this->getUrl(0), 'legends', str_replace('.', '', $fileInfos->getFilename())])
|
||||
]),
|
||||
template::select('sliderHref[' . $fileInfos->getFilename() . ']', self::$pageList, [
|
||||
'selected' => empty($this->getData(['module', $this->getUrl(0), 'uri', str_replace('.', '', $fileInfos->getFilename())]))
|
||||
? ''
|
||||
: $this->getData(['module', $this->getUrl(0), 'uri', str_replace('.', '', $fileInfos->getFilename())])
|
||||
]),
|
||||
'<a href="' . str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . $fileInfos->getFilename() . '" rel="data-lity" data-lity=""><img src="' . str_replace('source', 'thumb', $directory) . '/' . $fileInfos->getFilename() . '"></a>'
|
||||
];
|
||||
}
|
||||
}
|
||||
// Tri des images pour affichage de la liste dans la page d'édition
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'theme', 'tri'])) {
|
||||
case 'dsc':
|
||||
krsort(self::$pictures, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
break;
|
||||
case 'asc':
|
||||
ksort(self::$pictures, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
break;
|
||||
case 'rand':
|
||||
case 'none':
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du module',
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
// $url prend l'adresse sans le token
|
||||
// La galerie n'existe pas
|
||||
if ($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Suppression non autorisée'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Galerie supprimée',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des dossiers
|
||||
*/
|
||||
public function dirs()
|
||||
{
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'display' => self::DISPLAY_JSON,
|
||||
'content' => $this->scanSubDir(self::FILE_DIR . 'source')
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Édition
|
||||
*/
|
||||
public function theme()
|
||||
{
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
|
||||
// Adapte la largeur à celle de l'écran :
|
||||
$maxWidth = $this->getInput('sliderThememaxWidth', helper::FILTER_INT) === 0
|
||||
? intval(trim($this->getData(['theme', 'site', 'width']), 'px')) - 40
|
||||
: $this->getInput('sliderThememaxWidth', helper::FILTER_INT);
|
||||
|
||||
// Equilibrer les durées
|
||||
$speed = $this->getInput('sliderThemespeed', helper::FILTER_INT);
|
||||
$timeout = $this->getInput('sliderThemeDiapoTime', helper::FILTER_INT);
|
||||
if ($speed >= $timeout) {
|
||||
// Valeurs en sortie
|
||||
$notification = 'La durée de transition doit inférieure à la durée de l`\'image fixe';
|
||||
$state= false;
|
||||
} else {
|
||||
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
[
|
||||
'theme' => [
|
||||
'pager' => $this->getInput('sliderThemePager', helper::FILTER_BOOLEAN),
|
||||
'auto' => $this->getInput('sliderThemeAuto', helper::FILTER_BOOLEAN),
|
||||
'maxWidth' => $maxWidth,
|
||||
'speed' => $speed,
|
||||
'timeout' => $timeout,
|
||||
'namespace' => $this->getInput('sliderThemeNameSpace', helper::FILTER_STRING_SHORT),
|
||||
'sort' => $this->getInput('sliderThemeTri', helper::FILTER_STRING_SHORT),
|
||||
],
|
||||
'directory' => $this->getData(['module', $this->getUrl(0), 'directory']),
|
||||
'legends' => $this->getData(['module', $this->getUrl(0), 'legends']),
|
||||
'uri' => $this->getData(['module', $this->getUrl(0), 'uri']),
|
||||
]
|
||||
]);
|
||||
$notification = 'Modifications enregistrées';
|
||||
$state = true;
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/theme',
|
||||
'notification' => $notification,
|
||||
'state' => $state
|
||||
]);
|
||||
}
|
||||
|
||||
// Sélection largeur de l'écran
|
||||
self::$selectedMaxwidth = array_key_exists($this->getData(['module', $this->getUrl(0), 'theme', 'maxWidth']), self::$screenWidth)
|
||||
? $this->getData(['module', $this->getUrl(0), 'theme', 'maxWidth'])
|
||||
: 0;
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Thème',
|
||||
'view' => 'theme'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction index() modifiée par rapport au module Gallery
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$galleryId = $this->getUrl(0);
|
||||
$directory = $this->getData(['module', $galleryId, 'directory']);
|
||||
|
||||
// Images de la galerie
|
||||
if (is_dir($directory)) {
|
||||
$iterator = new DirectoryIterator($directory);
|
||||
foreach ($iterator as $fileInfos) {
|
||||
if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) {
|
||||
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = [
|
||||
'legend' => $this->getData(['module', $galleryId, 'legends', str_replace('.', '', $fileInfos->getFilename())]),
|
||||
'uri' => $this->getData(['module', $galleryId, 'uri', str_replace('.', '', $fileInfos->getFilename())]),
|
||||
];
|
||||
//self::$pictures['uri'][$directory . '/' . $fileInfos->getFilename()] = ;
|
||||
}
|
||||
}
|
||||
|
||||
// Tri des images par ordre alphabétique, alphabétique inverse, aléatoire ou pas
|
||||
switch ($this->getData(['module', $galleryId, 'config', 'tri'])) {
|
||||
case 'SORT_DSC':
|
||||
krsort(self::$pictures, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
break;
|
||||
case 'SORT_ASC':
|
||||
ksort(self::$pictures, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
break;
|
||||
case 'RAND':
|
||||
break;
|
||||
case 'NONE':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'showPageContent' => true,
|
||||
'vendor' => [
|
||||
'slider'
|
||||
],
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan le contenu d'un dossier et de ses sous-dossiers
|
||||
* @param string $dir Dossier à scanner
|
||||
* @return array
|
||||
*/
|
||||
private function scanSubDir($dir)
|
||||
{
|
||||
$dirContent = [];
|
||||
$iterator = new DirectoryIterator($dir);
|
||||
foreach ($iterator as $fileInfos) {
|
||||
if ($fileInfos->isDot() === false and $fileInfos->isDir()) {
|
||||
$dirContent[] = $dir . '/' . $fileInfos->getBasename();
|
||||
$dirContent = array_merge($dirContent, $this->scanSubDir($dir . '/' . $fileInfos->getBasename()));
|
||||
}
|
||||
}
|
||||
return $dirContent;
|
||||
}
|
||||
|
||||
private function init()
|
||||
{
|
||||
if (is_null($this->getData(['module', $this->getUrl(0), 'theme']))) {
|
||||
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
[
|
||||
'theme' => [
|
||||
'pager' => true,
|
||||
'auto' => true,
|
||||
'maxWidth' => '1280',
|
||||
'speed' => 1000,
|
||||
'timeout' => 3000,
|
||||
'namespace' => 'centered-btns',
|
||||
'tri' => 'RAND',
|
||||
],
|
||||
'directory' => null,
|
||||
'legends' => [],
|
||||
'uri' => [],
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
3
module/slider/vendor/slider/inc.json
vendored
Normal file
3
module/slider/vendor/slider/inc.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
"slider.js"
|
||||
]
|
10
module/slider/vendor/slider/slider.js
vendored
Normal file
10
module/slider/vendor/slider/slider.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/*! http://responsiveslides.com v1.55 by @arielsalminen */
|
||||
(function(c,K,C){c.fn.responsiveSlides=function(m){var a=c.extend({auto:!0,speed:500,timeout:4E3,pager:!1,nav:!1,random:!1,pause:!1,pauseControls:!0,prevText:"Previous",nextText:"Next",maxwidth:"",navContainer:"",manualControls:"",namespace:"rslides",before:c.noop,after:c.noop},m);return this.each(function(){C++;var f=c(this),u,t,v,n,q,r,p=0,e=f.children(),D=e.length,h=parseFloat(a.speed),E=parseFloat(a.timeout),w=parseFloat(a.maxwidth),g=a.namespace,d=g+C,F=g+"_nav "+d+"_nav",x=g+"_here",k=d+"_on",
|
||||
y=d+"_s",l=c("<ul class='"+g+"_tabs "+d+"_tabs' />"),z={"float":"left",position:"relative",opacity:1,zIndex:2},A={"float":"none",position:"absolute",opacity:0,zIndex:1},G=function(){var b=(document.body||document.documentElement).style,a="transition";if("string"===typeof b[a])return!0;u=["Moz","Webkit","Khtml","O","ms"];var a=a.charAt(0).toUpperCase()+a.substr(1),c;for(c=0;c<u.length;c++)if("string"===typeof b[u[c]+a])return!0;return!1}(),B=function(b){a.before(b);G?(e.removeClass(k).css(A).eq(b).addClass(k).css(z),
|
||||
p=b,setTimeout(function(){a.after(b)},h)):e.stop().fadeOut(h,function(){c(this).removeClass(k).css(A).css("opacity",1)}).eq(b).fadeIn(h,function(){c(this).addClass(k).css(z);a.after(b);p=b})};a.random&&(e.sort(function(){return Math.round(Math.random())-.5}),f.empty().append(e));e.each(function(a){this.id=y+a});f.addClass(g+" "+d);m&&m.maxwidth&&f.css("max-width",w);e.hide().css(A).eq(0).addClass(k).css(z).show();G&&e.show().css({"-webkit-transition":"opacity "+h+"ms ease-in-out","-moz-transition":"opacity "+
|
||||
h+"ms ease-in-out","-o-transition":"opacity "+h+"ms ease-in-out",transition:"opacity "+h+"ms ease-in-out"});if(1<e.length){if(E<h+100)return;if(a.pager&&!a.manualControls){var H=[];e.each(function(a){a+=1;H+="<li><a href='#' class='"+y+a+"'>"+a+"</a></li>"});l.append(H);m.navContainer?c(a.navContainer).append(l):f.after(l)}a.manualControls&&(l=c(a.manualControls),l.addClass(g+"_tabs "+d+"_tabs"));(a.pager||a.manualControls)&&l.find("li").each(function(a){c(this).addClass(y+(a+1))});if(a.pager||a.manualControls)r=
|
||||
l.find("a"),t=function(a){r.closest("li").removeClass(x).eq(a).addClass(x)};a.auto&&(v=function(){q=setInterval(function(){e.stop(!0,!0);var b=p+1<D?p+1:0;(a.pager||a.manualControls)&&t(b);B(b)},E)},v());n=function(){a.auto&&(clearInterval(q),v())};a.pause&&f.hover(function(){clearInterval(q)},function(){n()});if(a.pager||a.manualControls)r.bind("click",function(b){b.preventDefault();a.pauseControls||n();b=r.index(this);p===b||c("."+k).queue("fx").length||(t(b),B(b))}).eq(0).closest("li").addClass(x),
|
||||
a.pauseControls&&r.hover(function(){clearInterval(q)},function(){n()});if(a.nav){g="<a href='#' class='"+F+" prev'>"+a.prevText+"</a><a href='#' class='"+F+" next'>"+a.nextText+"</a>";m.navContainer?c(a.navContainer).append(g):f.after(g);var d=c("."+d+"_nav"),I=d.filter(".prev");d.bind("click",function(b){b.preventDefault();b=c("."+k);if(!b.queue("fx").length){var d=e.index(b);b=d-1;d=d+1<D?p+1:0;B(c(this)[0]===I[0]?b:d);(a.pager||a.manualControls)&&t(c(this)[0]===I[0]?b:d);a.pauseControls||n()}});
|
||||
a.pauseControls&&d.hover(function(){clearInterval(q)},function(){n()})}}if("undefined"===typeof document.body.style.maxWidth&&m.maxwidth){var J=function(){f.css("width","100%");f.width()>w&&f.css("width",w)};J();c(K).bind("resize",function(){J()})}})}})(jQuery,this,0);
|
||||
|
||||
|
22
module/slider/view/config/config.css
Normal file
22
module/slider/view/config/config.css
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
.galleryConfigError {
|
||||
color: #F3674A;
|
||||
font-weight: bold;
|
||||
}
|
54
module/slider/view/config/config.php
Normal file
54
module/slider/view/config/config.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php echo template::formOpen('galleryConfigForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('galleryConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset7">
|
||||
<?php echo template::button('galleryConfigTheme', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/theme',
|
||||
'value' => template::ico('brush')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('galleryConfigUpdate', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/update',
|
||||
'value' => template::ico('folder')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('galleryConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Galerie
|
||||
<?php
|
||||
echo $this->getData(['module', $this->getUrl(0), 'directory']);
|
||||
?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php if ($module::$pictures): ?>
|
||||
<?php echo template::table([3, 4, 4, 1], $module::$pictures, ['Image', 'Texte alternatif', 'Hyperlien vers une page', '']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune image dans ce dossier'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Module Slider version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
BIN
module/slider/view/index/black.gif
Normal file
BIN
module/slider/view/index/black.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 359 B |
236
module/slider/view/index/index.css
Normal file
236
module/slider/view/index/index.css
Normal file
@ -0,0 +1,236 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/*! http://responsiveslides.com v1.55 by @arielsalminen */
|
||||
|
||||
.rslides {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.rslides li {
|
||||
-webkit-backface-visibility: hidden;
|
||||
position: absolute;
|
||||
display: none;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.rslides li:first-child {
|
||||
position: relative;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.rslides img {
|
||||
display: block;
|
||||
height: auto;
|
||||
float: left;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font: 600 28px/36px sans-serif;
|
||||
margin: 50px 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font: 600 18px/24px sans-serif;
|
||||
color: #999;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.rslides {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.rslides_container {
|
||||
margin-bottom: 50px;
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.centered-btns_nav {
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
top: 50%;
|
||||
left: 0;
|
||||
opacity: 0.7;
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
text-decoration: none;
|
||||
height: 61px;
|
||||
width: 38px;
|
||||
background: transparent url("module/slider/view/index/black.gif") no-repeat left top;
|
||||
margin-top: -45px;
|
||||
}
|
||||
|
||||
.centered-btns_nav:active {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
.centered-btns_nav.next {
|
||||
left: auto;
|
||||
background-position: right top;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.transparent-btns_nav {
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: block;
|
||||
background: #fff; /* Fix for IE6-9 */
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=1);
|
||||
width: 48%;
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
height: 91%;
|
||||
}
|
||||
|
||||
.transparent-btns_nav.next {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.large-btns_nav {
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
opacity: 0.6;
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: #000 url("module/slider/view/index/black.gif") no-repeat left 50%;
|
||||
width: 38px;
|
||||
}
|
||||
|
||||
.large-btns_nav:active {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
.large-btns_nav.next {
|
||||
left: auto;
|
||||
background-position: right 50%;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Boutons blancs
|
||||
*/
|
||||
.white-btns_nav {
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
opacity: 0.6;
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background: transparent url("module/slider/view/index/white.gif") no-repeat left 50%;
|
||||
width: 38px;
|
||||
}
|
||||
|
||||
.white-btns_nav:active {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
.white-btns_nav.next {
|
||||
left: auto;
|
||||
background-position: right 50%;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Boutons blancs
|
||||
*/
|
||||
.centered-btns_nav:focus,
|
||||
.transparent-btns_nav:focus,
|
||||
.large-btns_nav:focus,
|
||||
.white-btns_nav:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.centered-btns_tabs,
|
||||
.transparent-btns_tabs,
|
||||
.large-btns_tabs,
|
||||
.white-btns_tabs {
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.centered-btns_tabs li,
|
||||
.transparent-btns_tabs li,
|
||||
.large-btns_tabs li,
|
||||
.white-btns_tabs li {
|
||||
display: inline;
|
||||
float: none;
|
||||
_float: left;
|
||||
*float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.centered-btns_tabs a,
|
||||
.transparent-btns_tabs a,
|
||||
.large-btns_tabs a,
|
||||
.white-btns_tabs a {
|
||||
text-indent: -9999px;
|
||||
overflow: hidden;
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
background: #ccc;
|
||||
background: rgba(0, 0, 0, .2);
|
||||
display: inline-block;
|
||||
_display: block;
|
||||
*display: block;
|
||||
-webkit-box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, .3);
|
||||
-moz-box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, .3);
|
||||
box-shadow: inset 0 0 2px 0 rgba(0, 0, 0, .3);
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
}
|
||||
|
||||
.centered-btns_here a,
|
||||
.transparent-btns_here a,
|
||||
.large-btns_here a,
|
||||
.white-btns_here a {
|
||||
background: #222;
|
||||
background: rgba(0,0,0, .8);
|
||||
}
|
||||
|
61
module/slider/view/index/index.js.php
Normal file
61
module/slider/view/index/index.js.php
Normal file
@ -0,0 +1,61 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
auto: true, // Boolean: Animate automatically, true or false
|
||||
speed: 500, // Integer: Speed of the transition, in milliseconds
|
||||
timeout: 4000, // Integer: Time between slide transitions, in milliseconds
|
||||
pager: false, // Boolean: Show pager, true or false
|
||||
nav: false, // Boolean: Show navigation, true or false
|
||||
random: false, // Boolean: Randomize the order of the slides, true or false
|
||||
pause: false, // Boolean: Pause on hover, true or false
|
||||
pauseControls: true, // Boolean: Pause when hovering controls, true or false
|
||||
prevText: "Previous", // String: Text for the "previous" button
|
||||
nextText: "Next", // String: Text for the "next" button
|
||||
maxwidth: "", // Integer: Max-width of the slideshow, in pixels
|
||||
navContainer: "", // Selector: Where controls should be appended to, default is after the 'ul'
|
||||
manualControls: "", // Selector: Declare custom pager navigation
|
||||
namespace: "rslides", // String: Change the default namespace used
|
||||
before: function(){}, // Function: Before callback
|
||||
after: function(){} // Function: After callback
|
||||
*/
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
var maxWidth = "<?php echo $this->getData(['module', $this->getUrl(0),'theme', 'maxWidth']); ?>";
|
||||
var sort = "<?php echo $this->getData(['module', $this->getUrl(0),'theme', 'sort']); ?>";
|
||||
// Réduction de la taille maximale selon la largeur de la section
|
||||
var screenSize = $("section").width() - 40;
|
||||
maxWidth = maxWidth < screenSize ? maxWidth : screenSize;
|
||||
$("#wrapper").css('width', maxWidth);
|
||||
$(function() {
|
||||
$("#sliders").responsiveSlides({
|
||||
pager: "<?php echo (bool)$this->getData(['module', $this->getUrl(0), 'theme', 'pager']); ?>",
|
||||
auto: "<?php echo (bool)$this->getData(['module', $this->getUrl(0), 'theme', 'auto']); ?>",
|
||||
maxwidth: maxWidth,
|
||||
speed: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'speed']); ?>",
|
||||
timeout: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'timeout']); ?>",
|
||||
namespace: "<?php echo $this->getData(['module', $this->getUrl(0), 'theme', 'namespace']); ?>",
|
||||
nav: true,
|
||||
random: sort == "random" ? true : false,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
26
module/slider/view/index/index.php
Normal file
26
module/slider/view/index/index.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php if ($module::$pictures): ?>
|
||||
<div id="wrapper">
|
||||
<div class="rslides_container">
|
||||
<ul class="rslides" id="sliders">
|
||||
<!--id="<?php echo $this->getData(['module', $this->getUrl(0), 'config', 'boutonsVisibles']); ?>"> -->
|
||||
<?php foreach ($module::$pictures as $picture => $options): ?>
|
||||
<?php if (!empty($options['uri'])): ?>
|
||||
<a href="<?php echo helper::baseUrl() . $options['uri']; ?>">
|
||||
<?php endif; ?>
|
||||
<li>
|
||||
<img src="<?php echo helper::baseUrl(false) . $picture; ?>" alt="<?php echo $options['legend']; ?>">
|
||||
</li>
|
||||
<?php if (!empty($options['uri'])): ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune image dans le dossier sélectionné.'); ?>
|
||||
<?php endif; ?>
|
||||
<div id="div1">
|
||||
</div>
|
||||
<!--Pour liaison entre variables php et javascript-->
|
BIN
module/slider/view/index/white.gif
Normal file
BIN
module/slider/view/index/white.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
17
module/slider/view/theme/theme.css
Normal file
17
module/slider/view/theme/theme.css
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
51
module/slider/view/theme/theme.js.php
Normal file
51
module/slider/view/theme/theme.js.php
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Liste des dossiers
|
||||
*/
|
||||
var oldResult = [];
|
||||
var directoryDOM = $("#galleryEditDirectory");
|
||||
var directoryOldDOM = $("#galleryEditDirectoryOld");
|
||||
function dirs() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/dirs",
|
||||
success: function(result) {
|
||||
if($(result).not(oldResult).length !== 0 || $(oldResult).not(result).length !== 0) {
|
||||
directoryDOM.empty();
|
||||
for(var i = 0; i < result.length; i++) {
|
||||
directoryDOM.append(function(i) {
|
||||
var option = $("<option>").val(result[i]).text(result[i]);
|
||||
if(directoryOldDOM.val() === result[i]) {
|
||||
option.prop("selected", true);
|
||||
}
|
||||
return option;
|
||||
}(i))
|
||||
}
|
||||
oldResult = result;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
dirs();
|
||||
// Actualise la liste des dossiers toutes les trois secondes
|
||||
setInterval(function() {
|
||||
dirs();
|
||||
}, 3000);
|
||||
|
||||
/**
|
||||
* Stock le dossier choisi pour le re-sélectionner en cas d'actualisation ajax de la liste des dossiers
|
||||
*/
|
||||
directoryDOM.on("change", function() {
|
||||
directoryOldDOM.val($(this).val());
|
||||
});
|
78
module/slider/view/theme/theme.php
Normal file
78
module/slider/view/theme/theme.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php echo template::formOpen('sliderThemeForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('sliderThemeBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('sliderThemeSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres</h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('sliderThememaxWidth', $module::$screenWidth, [
|
||||
'label' => 'Largeur',
|
||||
'selected' => $module::$selectedMaxwidth,
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('sliderThemeAuto', $module::$auto, [
|
||||
'label' => 'Automatisation',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'auto']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('sliderThemeDiapoTime', $module::$timeout, [
|
||||
'label' => 'Image fixe',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'timeout'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('sliderThemespeed', $module::$speed, [
|
||||
'label' => 'Transition ',
|
||||
'help' => 'Cette durée doit être inférieure au temps fixe',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'speed'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Navigation</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('sliderThemeTri', $module::$sort, [
|
||||
'label' => 'Tri des images',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'sort'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('sliderThemePager', $module::$pager, [
|
||||
'label' => 'Puces horizontales',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'pager']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('sliderThemeNameSpace', $module::$namespace, [
|
||||
'label' => 'Boutons latéraux',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'theme', 'namespace'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
22
module/slider/view/update/update.css
Normal file
22
module/slider/view/update/update.css
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
|
||||
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
.galleryConfigError {
|
||||
color: #F3674A;
|
||||
font-weight: bold;
|
||||
}
|
52
module/slider/view/update/update.js.php
Normal file
52
module/slider/view/update/update.js.php
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.com/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Liste des dossiers
|
||||
*/
|
||||
var oldResult = [];
|
||||
var directoryDOM = $("#galleryUpdateDirectory");
|
||||
var directoryOldDOM = $("#galleryUpdateDirectoryOld");
|
||||
function dirs() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/dirs",
|
||||
success: function(result) {
|
||||
if($(result).not(oldResult).length !== 0 || $(oldResult).not(result).length !== 0) {
|
||||
directoryDOM.empty();
|
||||
for(var i = 0; i < result.length; i++) {
|
||||
directoryDOM.append(function(i) {
|
||||
var option = $("<option>").val(result[i]).text(result[i]);
|
||||
if(directoryOldDOM.val() === result[i]) {
|
||||
option.prop("selected", true);
|
||||
}
|
||||
return option;
|
||||
}(i))
|
||||
}
|
||||
oldResult = result;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
dirs();
|
||||
// Actualise la liste des dossiers toutes les trois secondes
|
||||
setInterval(function() {
|
||||
dirs();
|
||||
}, 3000);
|
||||
|
||||
/**
|
||||
* Stock le dossier choisi pour le re-sélectionner en cas d'actualisation ajax de la liste des dossiers
|
||||
*/
|
||||
directoryDOM.on("change", function() {
|
||||
directoryOldDOM.val($(this).val());
|
||||
});
|
36
module/slider/view/update/update.php
Normal file
36
module/slider/view/update/update.php
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
<?php echo template::formOpen('galleryUpdateForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('galleryUpdateBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('galleryUpdateSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Dossier de la galerie</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::hidden('galleryUpdateDirectoryOld', [
|
||||
'noDirty' => true, // Désactivé à cause des modifications en ajax
|
||||
]); ?>
|
||||
<?php echo template::select('galleryUpdateDirectory', [], [
|
||||
'label' => 'Dossier cible',
|
||||
'noDirty' => true, // Désactivé à cause des modifications en ajax,
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Module Slider version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user