Compare commits
No commits in common. "master" and "v2023.08.13" have entirely different histories.
master
...
v2023.08.1
@ -1,9 +1,3 @@
|
|||||||
postslistOptions 2023.10.20
|
|
||||||
===========================================================
|
|
||||||
* Require Dotclear 2.28
|
|
||||||
* Require PHP 8.1
|
|
||||||
* Upgrade to Dotclear 2.28
|
|
||||||
|
|
||||||
postslistOptions 2023.08.13
|
postslistOptions 2023.08.13
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
28
README.md
28
README.md
@ -1,23 +1,26 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2023.08.13-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/postslistOptions/releases)
|
[![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)
|
[![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)
|
[![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)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/postslistOptions)
|
||||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/postslistOptions/src/branch/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/postslistOptions)](https://git.dotclear.watch/JcDenis/postslistOptions/blob/master/LICENSE)
|
||||||
|
|
||||||
## ABOUT
|
## WHAT IS POSTsLISTOPTIONS ?
|
||||||
|
|
||||||
_postslistOptions_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
"Posts list options" is a plugin for the open-source
|
||||||
|
web publishing software called Dotclear.
|
||||||
|
|
||||||
> Add options on the posts list action box like
|
It add options on the posts list action box like
|
||||||
open/close/delete comments/trackbacks on multiple posts.
|
open/close/delete comments/trackbacks on multiple posts.
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
* Dotclear 2.28
|
_postslistOptions_ requires:
|
||||||
* PHP 8.1
|
|
||||||
* Dotclear admin permissions
|
* admin permissions
|
||||||
|
* Dotclear 2.27
|
||||||
|
* PHP 7.4
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
@ -28,13 +31,12 @@ Then this plugin adds options de the posts list actions box.
|
|||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* [License](https://git.dotclear.watch/JcDenis/postslistOptions/src/branch/master/LICENSE)
|
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||||
* [Packages & details](https://git.dotclear.watch/JcDenis/postslistOptions/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/postslistOptions))
|
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/postslistOptions) or [GitHub Page](https://github.com/JcDenis/postslistOptions)
|
||||||
* [Sources & contributions](https://git.dotclear.watch/JcDenis/postslistOptions) (or on [GitHub](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)
|
||||||
* [Issues & security](https://git.dotclear.watch/JcDenis/postslistOptions/issues) (or on [GitHub](https://github.com/JcDenis/postslistOptions/issues))
|
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Jean-Christian Denis (author)
|
* Jean-Christian Denis
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
33
_define.php
33
_define.php
@ -1,29 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file
|
* @brief postslistOptions, a plugin for Dotclear 2
|
||||||
* @brief The plugin postslistOptions definition
|
|
||||||
* @ingroup postslistOptions
|
|
||||||
*
|
*
|
||||||
* @defgroup postslistOptions Plugin dcLog.
|
* @package Dotclear
|
||||||
|
* @subpackage Plugin
|
||||||
*
|
*
|
||||||
* Add some options on admin posts list.
|
* @author Jean-Christian Denis and Contributors
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Posts list options',
|
'Posts list options',
|
||||||
'Add some options on admin posts list',
|
'Add some options on admin posts list',
|
||||||
'Jean-Christian Denis and Contributors',
|
'Jean-Christian Denis and Contributors',
|
||||||
'2023.10.20',
|
'2023.08.13',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.28']],
|
'requires' => [['core', '2.27']],
|
||||||
'permissions' => 'My',
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
'type' => 'plugin',
|
dcCore::app()->auth::PERMISSION_ADMIN,
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
]),
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'type' => 'plugin',
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/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',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="postslistOptions">
|
<module id="postslistOptions">
|
||||||
<name>Posts list options</name>
|
<name>Posts list options</name>
|
||||||
<version>2023.10.20</version>
|
<version>2023.08.13</version>
|
||||||
<author>Jean-Christian Denis and Contributors</author>
|
<author>Jean-Christian Denis and Contributors</author>
|
||||||
<desc>Add some options on admin posts list</desc>
|
<desc>Add some options on admin posts list</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/postslistOptions/releases/download/v2023.10.20/plugin-postslistOptions.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/postslistOptions/releases/download/v2023.08.13/plugin-postslistOptions.zip</file>
|
||||||
<da:dcmin>2.28</da:dcmin>
|
<da:dcmin>2.27</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/postslistOptions/src/branch/master/README.md</da:details>
|
<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>
|
<da:support>https://git.dotclear.watch/JcDenis/postslistOptions/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
@ -1,20 +1,28 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\postslistOptions;
|
namespace Dotclear\Plugin\postslistOptions;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use Dotclear\App;
|
use dcCore;
|
||||||
use Dotclear\Core\Backend\Action\ActionsPosts;
|
use Dotclear\Core\Backend\Action\ActionsPosts;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief postslistOptions backend class.
|
* Improve admin class
|
||||||
* @ingroup postslistOptions
|
|
||||||
*
|
*
|
||||||
* @author Jean-Christian Denis
|
* Add menu and dashboard icons, load Improve action modules.
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
*/
|
||||||
class Backend extends Process
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
@ -29,7 +37,7 @@ class Backend extends Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
App::behavior()->addBehavior('adminPostsActions', function (ActionsPosts $pa) {
|
dcCore::app()->addBehavior('adminPostsActions', function (ActionsPosts $pa) {
|
||||||
$pa->addAction(
|
$pa->addAction(
|
||||||
[
|
[
|
||||||
__('Comments') => [
|
__('Comments') => [
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
<?php
|
<?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);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\postslistOptions;
|
namespace Dotclear\Plugin\postslistOptions;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use Dotclear\App;
|
use dcBlog;
|
||||||
|
use dcCore;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
Page
|
Page
|
||||||
@ -21,13 +32,6 @@ use Dotclear\Helper\Html\Form\{
|
|||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief postslistOptions backend behaviors class.
|
|
||||||
* @ingroup postslistOptions
|
|
||||||
*
|
|
||||||
* @author Jean-Christian Denis
|
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*/
|
|
||||||
class BackendBehaviors
|
class BackendBehaviors
|
||||||
{
|
{
|
||||||
public static function commentsOpen(ActionsPosts $pa, ArrayObject $post): void
|
public static function commentsOpen(ActionsPosts $pa, ArrayObject $post): void
|
||||||
@ -50,7 +54,8 @@ class BackendBehaviors
|
|||||||
|
|
||||||
public static function commentsDelete(ActionsPosts $pa, ArrayObject $post): void
|
public static function commentsDelete(ActionsPosts $pa, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
if (!App::blog()->isDefined()) {
|
//nullsafe
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,9 +64,9 @@ class BackendBehaviors
|
|||||||
if (empty($_POST['confirmdeletecomments'])) {
|
if (empty($_POST['confirmdeletecomments'])) {
|
||||||
$pa->beginPage(
|
$pa->beginPage(
|
||||||
Page::breadcrumb([
|
Page::breadcrumb([
|
||||||
Html::escapeHTML(App::blog()->name()) => '',
|
Html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||||
$pa->getCallerTitle() => $pa->getRedirection(true),
|
$pa->getCallerTitle() => $pa->getRedirection(true),
|
||||||
__('Delete posts comments') => '',
|
__('Delete posts comments') => '',
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -73,14 +78,16 @@ class BackendBehaviors
|
|||||||
(new Text('', $pa->getCheckboxes())),
|
(new Text('', $pa->getCheckboxes())),
|
||||||
(new Text('p', __('Are you sure you want to delete all comments?'))),
|
(new Text('p', __('Are you sure you want to delete all comments?'))),
|
||||||
(new Para())
|
(new Para())
|
||||||
->__call('items', [
|
->__call('items', [array_merge(
|
||||||
(new Submit(['do']))
|
[
|
||||||
->__call('value', [__('yes')]),
|
(new Submit(['do']))
|
||||||
App::nonce()->formNonce(),
|
->__call('value', [__('yes')]),
|
||||||
(new Hidden(['action'], 'commentsdelete')),
|
dcCore::app()->formNonce(false),
|
||||||
(new Hidden(['confirmdeletecomments'], '1')),
|
(new Hidden(['action'], 'commentsdelete')),
|
||||||
... $pa->hiddenFields(),
|
(new Hidden(['confirmdeletecomments'], '1')),
|
||||||
]),
|
],
|
||||||
|
$pa->hiddenFields(),
|
||||||
|
)]),
|
||||||
]])
|
]])
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
@ -115,7 +122,8 @@ class BackendBehaviors
|
|||||||
|
|
||||||
public static function trackbacksDelete(ActionsPosts $pa, ArrayObject $post): void
|
public static function trackbacksDelete(ActionsPosts $pa, ArrayObject $post): void
|
||||||
{
|
{
|
||||||
if (!App::blog()->isDefined()) {
|
//nullsafe
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,9 +132,9 @@ class BackendBehaviors
|
|||||||
if (empty($_POST['confirmdeletetrackbacks'])) {
|
if (empty($_POST['confirmdeletetrackbacks'])) {
|
||||||
$pa->beginPage(
|
$pa->beginPage(
|
||||||
Page::breadcrumb([
|
Page::breadcrumb([
|
||||||
Html::escapeHTML(App::blog()->name()) => '',
|
Html::escapeHTML(dcCore::app()->blog->name) => '',
|
||||||
$pa->getCallerTitle() => $pa->getRedirection(true),
|
$pa->getCallerTitle() => $pa->getRedirection(true),
|
||||||
__('Delete posts trackbacks') => '',
|
__('Delete posts trackbacks') => '',
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -138,13 +146,13 @@ class BackendBehaviors
|
|||||||
(new Text('', $pa->getCheckboxes())),
|
(new Text('', $pa->getCheckboxes())),
|
||||||
(new Text('p', __('Are you sure you want to delete all trackbacks?'))),
|
(new Text('p', __('Are you sure you want to delete all trackbacks?'))),
|
||||||
(new Para())
|
(new Para())
|
||||||
->__call('items', [
|
->__call('items', [array_merge([
|
||||||
(new Submit(['do']))
|
(new Submit(['do']))
|
||||||
->__call('value', [__('yes')]),
|
->__call('value', [__('yes')]),
|
||||||
App::nonce()->formNonce(),
|
dcCore::app()->formNonce(false),
|
||||||
(new Hidden(['action'], 'trackbacksdelete')),
|
(new Hidden(['action'], 'trackbacksdelete')),
|
||||||
(new Hidden(['confirmdeletetrackbacks'], '1')),
|
(new Hidden(['confirmdeletetrackbacks'], '1')),
|
||||||
... $pa->hiddenFields()]),
|
], $pa->hiddenFields())]),
|
||||||
]])
|
]])
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
@ -171,26 +179,28 @@ class BackendBehaviors
|
|||||||
|
|
||||||
private static function updPostOption(int $id, string $option, int $value): void
|
private static function updPostOption(int $id, string $option, int $value): void
|
||||||
{
|
{
|
||||||
if (!App::blog()->isDefined()) {
|
//nullsafe
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = abs((int) $id);
|
$id = abs((int) $id);
|
||||||
$cur = App::blog()->openPostCursor();
|
$cur = dcCore::app()->con->openCursor(dcCore::app()->prefix . dcBlog::POST_TABLE_NAME);
|
||||||
|
|
||||||
$cur->setField($option, $value);
|
$cur->setField($option, $value);
|
||||||
$cur->setField('post_upddt', date('Y-m-d H:i:s'));
|
$cur->setField('post_upddt', date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
$cur->update(
|
$cur->update(
|
||||||
'WHERE post_id = ' . $id . ' ' .
|
'WHERE post_id = ' . $id . ' ' .
|
||||||
"AND blog_id = '" . App::con()->escapeStr(App::blog()->id()) . "' "
|
"AND blog_id = '" . dcCore::app()->con->escapeStr((string) dcCore::app()->blog->id) . "' "
|
||||||
);
|
);
|
||||||
App::blog()->triggerBlog();
|
dcCore::app()->blog->triggerBlog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function delPostComments(int $id, bool $tb = false): void
|
private static function delPostComments(int $id, bool $tb = false): void
|
||||||
{
|
{
|
||||||
if (!App::blog()->isDefined()) {
|
//nullsafe
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,11 +209,11 @@ class BackendBehaviors
|
|||||||
'post_id' => abs((int) $id),
|
'post_id' => abs((int) $id),
|
||||||
'comment_trackback' => $tb ? 1 : 0,
|
'comment_trackback' => $tb ? 1 : 0,
|
||||||
];
|
];
|
||||||
$comments = App::blog()->getComments($params);
|
$comments = dcCore::app()->blog->getComments($params);
|
||||||
|
|
||||||
while ($comments->fetch()) {
|
while ($comments->fetch()) {
|
||||||
// slower but preserve behaviors
|
// slower but preserve behaviors
|
||||||
App::blog()->delComment($comments->f('comment_id'));
|
dcCore::app()->blog->delComment($comments->f('comment_id'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,4 @@ use Dotclear\Module\MyPlugin;
|
|||||||
|
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
// Use defautl permissions
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user