Author: Derick Rethans (derickr)
Date: 2025-09-10T10:07:36+01:00

Commit: 
https://github.com/php/web-wiki/commit/7ae067756271b2daa92f50eb43cb130e9f239b7a
Raw diff: 
https://github.com/php/web-wiki/commit/7ae067756271b2daa92f50eb43cb130e9f239b7a.diff

Show vote closure time

Changed paths:
  M  dokuwiki/lib/plugins/doodle/lang/en/lang.php
  M  dokuwiki/lib/plugins/doodle/syntax.php


Diff:

diff --git a/dokuwiki/lib/plugins/doodle/lang/en/lang.php 
b/dokuwiki/lib/plugins/doodle/lang/en/lang.php
index 39f2388e..e8505078 100644
--- a/dokuwiki/lib/plugins/doodle/lang/en/lang.php
+++ b/dokuwiki/lib/plugins/doodle/lang/en/lang.php
@@ -9,6 +9,7 @@
 
 // info messages
 $lang['poll_closed']           = 'This poll has been closed.';
+$lang['poll_close_time']       = 'This poll will close on %s.';
 $lang['vote_saved']            = 'Vote has been saved.';
 $lang['vote_deleted']          = 'Vote has been deleted.';
 
diff --git a/dokuwiki/lib/plugins/doodle/syntax.php 
b/dokuwiki/lib/plugins/doodle/syntax.php
index 5843901d..fcf07cff 100755
--- a/dokuwiki/lib/plugins/doodle/syntax.php
+++ b/dokuwiki/lib/plugins/doodle/syntax.php
@@ -99,7 +99,8 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
             'adminGroups'    => '',
             'adminMail'      => null,
             'voteType'       => 'default',
-            'closed'         => FALSE
+            'closed'         => FALSE,
+            'close_on_ts'    => FALSE,
         );
 
         //----- parse parameteres into name="value" pairs
@@ -137,11 +138,14 @@ function handle($match, $state, $pos, Doku_Handler 
$handler) {
                     $params['voteType'] = $value;
                 }
             } else
-            if ((strcmp($name, "CLOSEON") == 0) &&
-                (($timestamp = strtotime($value)) !== false) &&
-                (time() > $timestamp)   )
-            {
-                $params['closed'] = 1;
+            if (strcmp($name, "CLOSEON") == 0) {
+                if (($timestamp = strtotime($value)) !== false) {
+                    $params['close_on_ts'] = $timestamp;
+
+                    if (time() > $timestamp) {
+                        $params['closed'] = 1;
+                    }
+                }
             } else
             if (strcmp($name, "CLOSED") == 0) {
                 $params['closed'] = strcasecmp($value, "TRUE") == 0;
@@ -284,6 +288,8 @@ function render($mode, Doku_Renderer $renderer, $data) {
         $this->template['formId']     = $formId;
         if ($this->params['closed']) {
             $this->template['msg'] = $this->getLang('poll_closed');
+        } else if ($this->params['close_on_ts']) {
+            $this->template['msg'] = 
sprintf($this->getLang('poll_close_time'), date('Y-m-d H:i:s e', 
$this->params['close_on_ts']));
         }
 
         for($col = 0; $col < count($this->choices); $col++) {

Reply via email to