fix browser date picker, fix sql query (fix #1 )

This commit is contained in:
Jean-Christian Paul Denis 2022-04-27 11:16:43 +02:00
parent ad565493ff
commit 5d0aa39561
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
7 changed files with 31 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2022.04.27
- require Dotclear 2.21.3
- fix browser date picker
- fix sql query on posts
2021.10.30
- required Dotclear 2.20
- add user pref filters for periods list

View File

@ -22,7 +22,7 @@ and they will be publish ones after the others every week.
* admin permissions to configure plugin
* usage,contentadmin permissions to link feeds
* Dotclear 2.19
* Dotclear 2.21.3
## NOTICE

View File

@ -19,9 +19,9 @@ $this->registerModule(
'Periodical',
'Published periodically entries',
'Jean-Christian Denis and contributors',
'2021.10.30',
'2022.04.27',
[
'requires' => [['core', '2.20']],
'requires' => [['core', '2.21']],
'permissions' => 'usage,contentadmin',
'type' => 'plugin',
'support' => 'https://github.com/JcDenis/periodical',

View File

@ -15,7 +15,7 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null;
}
$dc_min = '2.19';
$dc_min = '2.21';
$new_version = $core->plugins->moduleInfo('periodical', 'version');
$old_version = $core->getVersion('periodical');

View File

@ -1,11 +1,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="periodical">
<name>Periodical</name>
<version>2021.10.30</version>
<version>2022.04.27</version>
<author>Jean-Christian Denis and contributors</author>
<desc>Published periodically entries</desc>
<file>https://github.com/JcDenis/periodical/releases/download/v2021.10.30/plugin-periodical.zip</file>
<da:dcmin>2.20</da:dcmin>
<file>https://github.com/JcDenis/periodical/releases/download/v2022.04.27/plugin-periodical.zip</file>
<da:dcmin>2.21</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/periodical</da:details>
<da:support>https://github.com/JcDenis/periodical</da:support>
</module>

View File

@ -198,6 +198,9 @@ class periodical
if (!isset($params['from'])) {
$params['from'] = '';
}
if (!isset($params['join'])) {
$params['join'] = '';
}
if (!isset($params['sql'])) {
$params['sql'] = '';
}
@ -211,8 +214,8 @@ class periodical
$params['columns'][] = 'T.periodical_pub_int';
$params['columns'][] = 'T.periodical_pub_nb';
$params['from'] .= 'LEFT JOIN ' . $this->core->prefix . 'meta R ON P.post_id = R.post_id ';
$params['from'] .= 'LEFT JOIN ' . $this->table . ' T ON CAST(T.periodical_id as char)=R.meta_id ';
$params['join'] .= 'LEFT JOIN ' . $this->core->prefix . 'meta R ON P.post_id = R.post_id ';
$params['join'] .= 'LEFT JOIN ' . $this->table . ' T ON CAST(T.periodical_id as char) = CAST(R.meta_id as char) ';
$params['sql'] .= "AND R.meta_type = 'periodical' ";
$params['sql'] .= "AND T.periodical_type = 'post' ";

View File

@ -30,8 +30,8 @@ $period_id = null;
$period_title = __('One post per day');
$period_pub_nb = 1;
$period_pub_int = 'day';
$period_curdt = date('Y-m-d H:i:00', time());
$period_enddt = date('Y-m-d H:i:00', time() + 31536000); //one year
$period_curdt = time();
$period_enddt = time() + 31536000; //one year
# Get period
if (!empty($_REQUEST['period_id'])) {
@ -46,8 +46,8 @@ if (!empty($_REQUEST['period_id'])) {
$period_title = $rs->periodical_title;
$period_pub_nb = $rs->periodical_pub_nb;
$period_pub_int = $rs->periodical_pub_int;
$period_curdt = date('Y-m-d H:i', strtotime($rs->periodical_curdt));
$period_enddt = date('Y-m-d H:i', strtotime($rs->periodical_enddt));
$period_curdt = strtotime($rs->periodical_curdt);
$period_enddt = strtotime($rs->periodical_enddt);
}
}
@ -66,10 +66,10 @@ if ($action == 'setperiod') {
$period_pub_int = $_POST['period_pub_int'];
}
if (!empty($_POST['period_curdt'])) {
$period_curdt = date('Y-m-d H:i:00', strtotime($_POST['period_curdt']));
$period_curdt = strtotime($_POST['period_curdt']);
}
if (!empty($_POST['period_enddt'])) {
$period_enddt = date('Y-m-d H:i:00', strtotime($_POST['period_enddt']));
$period_enddt = strtotime($_POST['period_enddt']);
}
# Check period title and dates
@ -247,10 +247,16 @@ form::field('period_title', 60, 255, html::escapeHTML($period_title), 'maximal')
<div class="two-boxes">
<p><label for="period_curdt">' . __('Next update:') . '</label>' .
form::field('period_curdt', 16, 16, date('Y-m-d H:i', strtotime($period_curdt))) . '</p>
form::datetime('period_curdt', [
'default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', strtotime($period_curdt))),
'class' => (!$period_curdt ? 'invalid' : ''),
]) . '</p>
<p><label for="period_enddt">' . __('End date:') . '</label>' .
form::field('period_enddt', 16, 16, date('Y-m-d H:i', strtotime($period_enddt))) . '</p>
form::datetime('period_enddt', [
'default' => html::escapeHTML(dt::str('%Y-%m-%dT%H:%M', strtotime($period_enddt))),
'class' => (!$period_enddt ? 'invalid' : ''),
]) .'</p>
</div><div class="two-boxes">