Compare commits

..

2 Commits

Author SHA1 Message Date
Jean-Christian Paul Denis 7d153a0ccf
release 2023.08.13 2023-08-13 18:30:59 +02:00
Jean-Christian Paul Denis 899a61ed5f
upgrade to Dotclear 2.27 2023-08-13 18:30:22 +02:00
7 changed files with 103 additions and 74 deletions

View File

@ -1,23 +1,37 @@
2023.04.23
- require dotclear 2.26
- use latest dotclear namespace
- remove magic
- fix nullsafe warnings
postslistOptions 2023.08.13
===========================================================
* Require Dotclear 2.27
* Require PHP 7.4
* Upgrade to Dotclear 2.27
* Move third party repository
* Use Dotclear style for CHANGELOG
2023.03.21
- require Dotclear 2.25
- use namespace
postslistOptions 2023.04.23
===========================================================
* require dotclear 2.26
* use latest dotclear namespace
* remove magic
* fix nullsafe warnings
2022.12.23
- fix permissions
- use anonymous function
postslistOptions 2023.03.21
===========================================================
* require Dotclear 2.25
* use namespace
2022.11.28
postslistOptions 2022.12.23
===========================================================
* fix permissions
* use anonymous function
postslistOptions 2022.11.28
===========================================================
* Use SVG icon
* Update to Dotclear 2.24
2013.07.10
postslistOptions 2013.07.10
===========================================================
* Fixed action on multiple posts
0.1 20100910
postslistOptions 0.1 20100910
===========================================================
* First lab release (closes #557)

View File

@ -1,15 +1,14 @@
# README
[![Release](https://img.shields.io/github/v/release/JcDenis/postslistOptions)](https://github.com/JcDenis/postslistOptions/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/postslistOptions)](https://github.com/JcDenis/postslistOptions/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/postslistOptions)](https://github.com/JcDenis/postslistOptions/issues)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/postslistOptions)
[![License](https://img.shields.io/github/license/JcDenis/postslistOptions)](https://github.com/JcDenis/postslistOptions/blob/master/LICENSE)
[![Release](https://img.shields.io/badge/release-2023.08.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/postslistOptions/releases)
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/postslistOptions/releases)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/postslistOptions)
[![License](https://img.shields.io/github/license/JcDenis/postslistOptions)](https://git.dotclear.watch/JcDenis/postslistOptions/blob/master/LICENSE)
## WHAT IS POSTsLISTOPTIONS ?
_Posts list options_ is a plugin for the open-source
"Posts list options" is a plugin for the open-source
web publishing software called Dotclear.
It add options on the posts list action box like
@ -17,26 +16,27 @@ open/close/delete comments/trackbacks on multiple posts.
## REQUIREMENTS
_PostslistOptions_ requires:
_postslistOptions_ requires:
* admin permissions
* Dotclear 2.26
* admin permissions
* Dotclear 2.27
* PHP 7.4
## USAGE
First install _PostslistOptions_, manualy from a zip package or from
First install _postslistOptions_, manualy from a zip package or from
Dotaddict repository. (See Dotclear's documentation to know how do this)
Then this plugin adds options de the posts list actions box.
## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [GitHub Page](https://github.com/JcDenis/postslistOptions)
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postslistOptions)
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/postslistOptions) or [GitHub Page](https://github.com/JcDenis/postslistOptions)
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/postslistOptions/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/postslistOptions)
## CONTRIBUTORS
* Jean-Christian Denis
* Jean-Christian Denis
You are welcome to contribute to this code.
You are welcome to contribute to this code.

View File

@ -10,7 +10,7 @@
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
if (!defined('DC_RC_PATH')) {
return null;
}
@ -18,15 +18,15 @@ $this->registerModule(
'Posts list options',
'Add some options on admin posts list',
'Jean-Christian Denis and Contributors',
'2023.04.23',
'2023.08.13',
[
'requires' => [['core', '2.26']],
'requires' => [['core', '2.27']],
'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_ADMIN,
]),
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
]
);

View File

@ -2,12 +2,12 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="postslistOptions">
<name>Posts list options</name>
<version>2023.04.23</version>
<version>2023.08.13</version>
<author>Jean-Christian Denis and Contributors</author>
<desc>Add some options on admin posts list</desc>
<file>https://github.com/JcDenis/postslistOptions/releases/download/v2023.04.23/plugin-postslistOptions.zip</file>
<da:dcmin>2.26</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/postslistOptions</da:details>
<da:support>https://github.com/JcDenis/postslistOptions</da:support>
<file>https://git.dotclear.watch/JcDenis/postslistOptions/releases/download/v2023.08.13/plugin-postslistOptions.zip</file>
<da:dcmin>2.27</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/postslistOptions/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/postslistOptions/issues</da:support>
</module>
</modules>

View File

@ -16,37 +16,28 @@ namespace Dotclear\Plugin\postslistOptions;
use ArrayObject;
use dcCore;
use dcNsProcess;
use dcPostsActions;
use Dotclear\Core\Backend\Action\ActionsPosts;
use Dotclear\Core\Process;
/**
* Improve admin class
*
* Add menu and dashboard icons, load Improve action modules.
*/
class Backend extends dcNsProcess
class Backend extends Process
{
public static function init(): bool
{
static::$init = defined('DC_CONTEXT_ADMIN')
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
&& dcCore::app()->auth->check(
dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_ADMIN,
]),
dcCore::app()->blog->id
);
return static::$init;
return self::status(My::checkContext(My::BACKEND));
}
public static function process(): bool
{
if (!static::$init) {
if (!self::status()) {
return false;
}
dcCore::app()->addBehavior('adminPostsActions', function (dcPostsActions $pa) {
dcCore::app()->addBehavior('adminPostsActions', function (ActionsPosts $pa) {
$pa->addAction(
[
__('Comments') => [
@ -60,7 +51,7 @@ class Backend extends dcNsProcess
__('Delete all trackbacks') => 'trackbacksdelete',
],
],
function (dcPostsActions $pa, ArrayObject $post) {
function (ActionsPosts $pa, ArrayObject $post) {
$actions = [
'commentsopen',
'commentsclose',

View File

@ -17,8 +17,11 @@ namespace Dotclear\Plugin\postslistOptions;
use ArrayObject;
use dcBlog;
use dcCore;
use dcPage;
use dcPostsActions;
use Dotclear\Core\Backend\{
Notices,
Page
};
use Dotclear\Core\Backend\Action\ActionsPosts;
use Dotclear\Helper\Html\Form\{
Form,
Hidden,
@ -31,25 +34,25 @@ use Exception;
class BackendBehaviors
{
public static function commentsOpen(dcPostsActions $pa, ArrayObject $post): void
public static function commentsOpen(ActionsPosts $pa, ArrayObject $post): void
{
foreach (self::getPostsIds($pa) as $post_id) {
self::updPostOption($post_id, 'post_open_comment', 1);
}
dcPage::addSuccessNotice(__('Comments successfully opened.'));
Notices::addSuccessNotice(__('Comments successfully opened.'));
$pa->redirect(true);
}
public static function commentsClose(dcPostsActions $pa, ArrayObject $post): void
public static function commentsClose(ActionsPosts $pa, ArrayObject $post): void
{
foreach (self::getPostsIds($pa) as $post_id) {
self::updPostOption($post_id, 'post_open_comment', 0);
}
dcPage::addSuccessNotice(__('Comments successfully closed.'));
Notices::addSuccessNotice(__('Comments successfully closed.'));
$pa->redirect(true);
}
public static function commentsDelete(dcPostsActions $pa, ArrayObject $post): void
public static function commentsDelete(ActionsPosts $pa, ArrayObject $post): void
{
//nullsafe
if (is_null(dcCore::app()->blog)) {
@ -60,7 +63,7 @@ class BackendBehaviors
if (empty($_POST['confirmdeletecomments'])) {
$pa->beginPage(
dcPage::breadcrumb([
Page::breadcrumb([
Html::escapeHTML(dcCore::app()->blog->name) => '',
$pa->getCallerTitle() => $pa->getRedirection(true),
__('Delete posts comments') => '',
@ -94,30 +97,30 @@ class BackendBehaviors
self::delPostComments($post_id, false);
self::updPostOption($post_id, 'nb_comment', 0);
}
dcPage::addSuccessNotice(__('Comments successfully deleted.'));
Notices::addSuccessNotice(__('Comments successfully deleted.'));
$pa->redirect(true);
}
}
public static function trackbacksOpen(dcPostsActions $pa, ArrayObject $post): void
public static function trackbacksOpen(ActionsPosts $pa, ArrayObject $post): void
{
foreach (self::getPostsIds($pa) as $post_id) {
self::updPostOption($post_id, 'post_open_tb', 1);
}
dcPage::addSuccessNotice(__('Trackbacks successfully opened.'));
Notices::addSuccessNotice(__('Trackbacks successfully opened.'));
$pa->redirect(true);
}
public static function trackbacksClose(dcPostsActions $pa, ArrayObject $post): void
public static function trackbacksClose(ActionsPosts $pa, ArrayObject $post): void
{
foreach (self::getPostsIds($pa) as $post_id) {
self::updPostOption($post_id, 'post_open_tb', 0);
}
dcPage::addSuccessNotice(__('Trackbacks successfully closed.'));
Notices::addSuccessNotice(__('Trackbacks successfully closed.'));
$pa->redirect(true);
}
public static function trackbacksDelete(dcPostsActions $pa, ArrayObject $post): void
public static function trackbacksDelete(ActionsPosts $pa, ArrayObject $post): void
{
//nullsafe
if (is_null(dcCore::app()->blog)) {
@ -128,7 +131,7 @@ class BackendBehaviors
if (empty($_POST['confirmdeletetrackbacks'])) {
$pa->beginPage(
dcPage::breadcrumb([
Page::breadcrumb([
Html::escapeHTML(dcCore::app()->blog->name) => '',
$pa->getCallerTitle() => $pa->getRedirection(true),
__('Delete posts trackbacks') => '',
@ -159,12 +162,12 @@ class BackendBehaviors
self::delPostComments($post_id, true);
self::updPostOption($post_id, 'nb_trackback', 0);
}
dcPage::addSuccessNotice(__('Trackbacks successfully deleted.'));
Notices::addSuccessNotice(__('Trackbacks successfully deleted.'));
$pa->redirect(true);
}
}
private static function getPostsIds(dcPostsActions $pa): array
private static function getPostsIds(ActionsPosts $pa): array
{
$posts_ids = $pa->getIDs();
if (empty($posts_ids)) {

21
src/My.php 100644
View File

@ -0,0 +1,21 @@
<?php
/**
* @brief postslistOptions, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis and Contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
namespace Dotclear\Plugin\postslistOptions;
use Dotclear\Module\MyPlugin;
class My extends MyPlugin
{
}