Skip to content

Commit

Permalink
Merge pull request #2 from nstueber/feature-update-printName-Option
Browse files Browse the repository at this point in the history
Feature update print name option
  • Loading branch information
nstueber committed Apr 2, 2019
2 parents fa33768 + 965881d commit cd854cf
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
31 changes: 27 additions & 4 deletions doodle_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@

<?php foreach ($template['doodleData'] as $fullname => $userData) { ?>
<tr>
<td class="rightalign">
<?php echo $userData['editLinks'].$fullname.$userData['username'] ?>
<td class="rightalign">
<?php
if ($template['printName'] == 'both'){
echo $userData['editLinks'].$fullname.' ('.$userData['username'].')';
} elseif ($template['printName'] == 'fullname'){
echo $userData['editLinks'].$fullname;
}elseif ($template['printName'] == 'username'){
echo $userData['editLinks'].$userData['username'];
}
?>
</td>
<?php for ($col = 0; $col < $c; $col++) {
echo $userData['choice'][$col];
Expand Down Expand Up @@ -128,8 +136,23 @@
if($durchlauf == 1){
foreach ($template['doodleData'] as $fullname => $userData) { ?>
<td class="centeralign" style="width:<?php echo $template['fieldwidth'] ?>">
<?php echo $userData['editLinks'].$fullname; ?>
</td>


<?php
if ($template['printName'] == 'both'){
echo $userData['editLinks'].$fullname.' ('.$userData['username'].')';
} elseif ($template['printName'] == 'fullname'){
echo $userData['editLinks'].$fullname;
}elseif ($template['printName'] == 'username'){
echo $userData['editLinks'].$userData['username'];
}
?>





</td>
<?php
for ($col = 0; $col < $c; $col++) {
$userAuswahl[$userZahl][$col] = $userData['choice'][$col];
Expand Down
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base doodle4
author Nico Stueber, Matthias Jung
email nstueber@v-markt.de
date 2019-02-21
date 2019-04-02
name Doodle4 Plugin
desc Let users vote for given choices, e.g. to schedule a meeting. Sequel of doodle3.
url http://www.dokuwiki.org/plugin:doodle4
27 changes: 26 additions & 1 deletion syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
* showMode="all|own"
* showSum="true|false"
* userlist="vertical|horizontal"
* printUser="both|fullname|username"
* closed="true|false" >
* * Option 1
* * Option 2 **some wikimarkup** \\ is __allowed__!
Expand Down Expand Up @@ -70,6 +71,11 @@
* vertical - User displayed in Rows
* horizontal - User displayed in Columns
*
* <h3>printname</h3>
* both - Fullname & Username
* fullname - Fullname
* username - Username
*
* If closed=="true", then no one can vote anymore. The result will still be shown on the page.
*
* The doodle's data is saved in '<dokuwiki>/data/meta/title_of_vote.doodle'. The filename is the (masked) title.
Expand Down Expand Up @@ -122,6 +128,7 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
'showMode' => 'all',
'showSum' => TRUE,
'adminMail' => null,
'printName' => 'both',
'voteType' => 'default',
'closed' => FALSE,
'fieldwidth' => 'auto',
Expand Down Expand Up @@ -177,6 +184,12 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
} else {
$params['closed'] = 0;
}
}
else
if (strcmp($name, "PRINTNAME") == 0) {
if ($value == 'fullname' || $value == 'username' || $value == 'both'){
$params['printName'] = $value;
}
} else
if (strcmp($name, "SHOWMODE") == 0) {
if ($value == 'all' || $value == 'own'){
Expand Down Expand Up @@ -336,6 +349,7 @@ function render($mode, Doku_Renderer $renderer, $data) {
$this->template['msg'] = $this->getLang('poll_closed');
}
$this->template['showSum'] = $this->params['showSum'];
$this->template['printName'] = $this->params['printName'];
$this->template['userlist'] = $this->params['userlist'];

for($col = 0; $col < count($this->choices); $col++) {
Expand Down Expand Up @@ -583,7 +597,18 @@ function getInputTR() {
$TR .= '<td class="rightalign">';
if ($fullname) {
if ($editMode) $TR .= $this->getLang('edit').':&nbsp;';
$TR .= $fullname.'&nbsp;('.$_SERVER['REMOTE_USER'].')';

if ($this->params['printName'] == 'both'){
$TR .= $fullname.'&nbsp;('.$_SERVER['REMOTE_USER'].')';
} elseif ($this->params['printName'] == 'fullname'){
$TR .= $fullname;
}elseif ($this->params['printName'] == 'username'){
$TR .= $_SERVER['REMOTE_USER'];
}




$TR .= '<input type="hidden" name="fullname" value="'.$fullname.'">';
} else {
$TR .= '<input type="text" name="fullname" value="">';
Expand Down

0 comments on commit cd854cf

Please sign in to comment.