Commit:    2c8876d460f8731afffcaa9d83f50da535616a0e
Author:    Peter Cowburn <[email protected]>         Fri, 3 Jan 2014 
10:57:12 +0000
Parents:   571d08492a5239114663667eb947a98aaa76b172
Branches:  master

Link:       
http://git.php.net/?p=web/wiki.git;a=commitdiff;h=2c8876d460f8731afffcaa9d83f50da535616a0e

Log:
Hide vote choices for in-progress votes

Changed paths:
  M  dokuwiki/lib/plugins/doodle/doodle_template.php
  M  dokuwiki/lib/plugins/doodle/style.css
  A  systems/doodle-hide-votes-in-progress.diff


Diff:
diff --git a/dokuwiki/lib/plugins/doodle/doodle_template.php 
b/dokuwiki/lib/plugins/doodle/doodle_template.php
index 0dafba4..843a7cd 100755
--- a/dokuwiki/lib/plugins/doodle/doodle_template.php
+++ b/dokuwiki/lib/plugins/doodle/doodle_template.php
@@ -9,6 +9,7 @@
   global $ID;
 
   $template = $this->template;
+  $is_closed = $this->params['closed'];
   $c = count($template['choices']);
 ?>
 
@@ -42,18 +43,30 @@
           <?php $fullname = '<a href="//people.php.net/user.php?username=' . 
$fullname.'">' .$fullname. '</a>';?>
           <?php echo $userData['editLinks'].$fullname.$userData['username'] ?>
         </td>
-        <?php for ($col = 0; $col < $c; $col++) {
-            echo $userData['choice'][$col];
-        } ?>        
+        <?php
+        if ($is_closed || $INFO['userinfo']['name'] == $fullname) {
+            for ($col = 0; $col < $c; $col++) {
+                echo $userData['choice'][$col];
+            }
+        } else {
+            ?><td class="votehidden" colspan="<?php echo $c 
?>">&nbsp;</td><?php
+        }
+        ?>
     </tr>
 <?php } ?>
  
     <!-- Results / sum per column -->
     <tr>
         <th class="rightalign"><b><?php echo $template['result'] ?></b></th>
-<?php for ($col = 0; $col < $c; $col++) { ?>
-        <th class="centeralign"><b><?php echo $template['count'][$col] 
?></b></th>
-<?php } ?>
+        <?php
+        if ($is_closed) {
+            for ($col = 0; $col < $c; $col++) {
+                ?><th class="centeralign"><b><?php echo 
$template['count'][$col] ?></b></th><?php
+            }
+        } else {
+            ?><th class="centeralign" colspan="<?php echo $c ?>"><?php echo 
count($template['doodleData']) ?></th><?php
+        }
+        ?>
     </tr>
 
 <?php
diff --git a/dokuwiki/lib/plugins/doodle/style.css 
b/dokuwiki/lib/plugins/doodle/style.css
index 0db25ee..661dfbc 100644
--- a/dokuwiki/lib/plugins/doodle/style.css
+++ b/dokuwiki/lib/plugins/doodle/style.css
@@ -27,3 +27,8 @@ div.dokuwiki table.inline td.notokay {
   border: 0;
   color: rgba(0, 0, 0, 0);
 }
+
+div.dokuwiki table.inline td.votehidden {
+  background-color: #f3f3f3;
+  text-align: center;
+}
diff --git a/systems/doodle-hide-votes-in-progress.diff 
b/systems/doodle-hide-votes-in-progress.diff
new file mode 100644
index 0000000..9a6da8f
--- /dev/null
+++ b/systems/doodle-hide-votes-in-progress.diff
@@ -0,0 +1,62 @@
+diff --git a/dokuwiki/lib/plugins/doodle/doodle_template.php 
b/dokuwiki/lib/plugins/doodle/doodle_template.php
+index 0dafba4..843a7cd 100755
+--- a/dokuwiki/lib/plugins/doodle/doodle_template.php
++++ b/dokuwiki/lib/plugins/doodle/doodle_template.php
+@@ -9,6 +9,7 @@
+   global $ID;
+ 
+   $template = $this->template;
++  $is_closed = $this->params['closed'];
+   $c = count($template['choices']);
+ ?>
+ 
+@@ -42,18 +43,30 @@
+           <?php $fullname = '<a href="//people.php.net/user.php?username=' . 
$fullname.'">' .$fullname. '</a>';?>
+           <?php echo $userData['editLinks'].$fullname.$userData['username'] ?>
+         </td>
+-        <?php for ($col = 0; $col < $c; $col++) {
+-            echo $userData['choice'][$col];
+-        } ?>        
++        <?php
++        if ($is_closed || $INFO['userinfo']['name'] == $fullname) {
++            for ($col = 0; $col < $c; $col++) {
++                echo $userData['choice'][$col];
++            }
++        } else {
++            ?><td class="votehidden" colspan="<?php echo $c 
?>">&nbsp;</td><?php
++        }
++        ?>
+     </tr>
+ <?php } ?>
+  
+     <!-- Results / sum per column -->
+     <tr>
+         <th class="rightalign"><b><?php echo $template['result'] ?></b></th>
+-<?php for ($col = 0; $col < $c; $col++) { ?>
+-        <th class="centeralign"><b><?php echo $template['count'][$col] 
?></b></th>
+-<?php } ?>
++        <?php
++        if ($is_closed) {
++            for ($col = 0; $col < $c; $col++) {
++                ?><th class="centeralign"><b><?php echo 
$template['count'][$col] ?></b></th><?php
++            }
++        } else {
++            ?><th class="centeralign" colspan="<?php echo $c ?>"><?php echo 
count($template['doodleData']) ?></th><?php
++        }
++        ?>
+     </tr>
+ 
+ <?php
+diff --git a/dokuwiki/lib/plugins/doodle/style.css 
b/dokuwiki/lib/plugins/doodle/style.css
+index 0db25ee..661dfbc 100644
+--- a/dokuwiki/lib/plugins/doodle/style.css
++++ b/dokuwiki/lib/plugins/doodle/style.css
+@@ -27,3 +27,8 @@ div.dokuwiki table.inline td.notokay {
+   border: 0;
+   color: rgba(0, 0, 0, 0);
+ }
++
++div.dokuwiki table.inline td.votehidden {
++  background-color: #f3f3f3;
++  text-align: center;
++}


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to