Skip to content

Commit

Permalink
Fixed displaying of Poll Topic Description and Question Description
Browse files Browse the repository at this point in the history
For bug #976

- Topic Description now displayed in a tooltip for blocks since it can be a long description.
- Fixed Topic Description displaying right after Topic Title on Poll results.
- Fixed Question Descriptions layout and removed counter for description since question already has one.
- Updated layout in editor to make it easier to see what topic description is for
  • Loading branch information
eSilverStrike committed Oct 23, 2019
1 parent 67c603e commit 0805806
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 35 deletions.
12 changes: 11 additions & 1 deletion plugins/polls/functions.inc
Expand Up @@ -478,6 +478,11 @@ function POLLS_pollVote($pid, $showall = true, $displaytype = 0, $order = '', $m
$poll->set_var('poll_id', $pid);
$poll->set_var('poll_topic', $P['topic']);
$poll->set_var('poll_topic_description', $P['description']);
if (!empty($P['description'])) {
$poll->set_var('poll_topic_description_tooltip', COM_getTooltip('', $P['description']));
} else {
$poll->set_var('poll_topic_description_tooltip', '');
}
$poll->set_var('num_votes', COM_numberFormat($P['voters']));
$poll->set_var('poll_vote_url', $_CONF['site_url']
. '/polls/index.php');
Expand Down Expand Up @@ -815,6 +820,11 @@ function POLLS_pollResults($pid, $scale = 100, $order = '', $mode = '', $page =
$poll->set_var('display_type', $displaytype);
$poll->set_var('poll_topic', $P['topic']);
$poll->set_var('poll_topic_description', $P['description']);
if (!empty($P['description'])) {
$poll->set_var('poll_topic_description_tooltip', COM_getTooltip('', $P['description']));
} else {
$poll->set_var('poll_topic_description_tooltip', '');
}
$poll->set_var('poll_id', $pid);
$poll->set_var('num_votes', COM_numberFormat($P['voters']));
$poll->set_var('lang_voters', $LANG_POLLS['voters']);
Expand Down Expand Up @@ -847,7 +857,7 @@ function POLLS_pollResults($pid, $scale = 100, $order = '', $mode = '', $page =
$counter = ($j + 1) . "/$nquestions: ";
}
$poll->set_var('poll_question_text', $counter . $Q['question']);
$poll->set_var('poll_description', $counter . $Q['description']);
$poll->set_var('poll_description', $Q['description']);

$answer_sql = "SELECT votes, answer, remark FROM {$_TABLES['pollanswers']} "
. "WHERE pid = '" . DB_escapeString($pid) . "' AND qid = '" . DB_escapeString($Q['qid']) . "' "
Expand Down
2 changes: 1 addition & 1 deletion plugins/polls/language/english.php
Expand Up @@ -108,7 +108,7 @@
40 => 'See all answers to this poll',
1001 => 'Allow multiple answers',
1002 => 'Description',
1003 => 'Description',
1003 => 'Topic Description',
);

$PLG_polls_MESSAGE15 = 'Your comment has been submitted for review and will be published when approved by a moderator.';
Expand Down
2 changes: 1 addition & 1 deletion plugins/polls/language/english_utf-8.php
Expand Up @@ -108,7 +108,7 @@
40 => 'See all answers to this poll',
1001 => 'Allow multiple answers',
1002 => 'Description',
1003 => 'Description',
1003 => 'Topic Description',
);

$PLG_polls_MESSAGE15 = 'Your comment has been submitted for review and will be published when approved by a moderator.';
Expand Down
10 changes: 5 additions & 5 deletions plugins/polls/templates/default/admin/polleditor.thtml
Expand Up @@ -7,10 +7,13 @@
<dl class="form_block">
<dt><label for="polls-polleditor-topic">{lang_topic}</label></dt>
<dd><input type="text" name="topic" value="{poll_topic}" maxlength="255" {!if titletoid}onkeyup="TitleToId('polls-polleditor-topic','polls-polleditor-pid');" {!endif}id="polls-polleditor-topic" class="size6"{xhtml}><br{xhtml}>{poll_topic_info}</dd>

<dt><label for="polls-polleditor-pid">{lang_pollid}</label></dt>
<dd><input type="text" dir="ltr" name="pid" value="{poll_id}" maxlength="128" id="polls-polleditor-pid" class="size6"{xhtml}> {lang_donotusespaces}</dd>

<dt><label for="polls-polleditor-topic_description">{lang_topic_description}</label></dt>
<dd><textarea name="topic_description" rows="2" id="polls-polleditor-topic_description" class="wide">{topic_description}</textarea></dd>

<dt{hide_meta}><label for="polls-polleditor-meta_description">{lang_metadescription}</label></dt>
<dd{hide_meta}><textarea name="meta_description" cols="45" rows="2" id="polls-polleditor-meta_description" class="wide">{meta_description}</textarea></dd>

Expand All @@ -28,9 +31,6 @@

<dt><label for="polls-polleditor-hideresults">{lang_hideresults}</label></dt>
<dd><input type="checkbox" name="hideresults" id="polls-polleditor-hideresults" {poll_hideresults}{xhtml}> {poll_hideresults_explain}</dd>

<dt><label for="polls-polleditor-topic_description">{lang_topic_description}</label></dt>
<dd><textarea name="topic_description" rows="2" id="polls-polleditor-topic_description" class="wide">{topic_description}</textarea></dd>
</dl>

<div id="po_navbar" class="jsenabled_show">
Expand Down Expand Up @@ -60,7 +60,7 @@
<input type="submit" name="mode" value="{lang_cancel}" class="submit"{xhtml}>
{!if allow_delete}
<input type="submit" name="mode" value="{lang_delete}" class="submit" onclick="return confirm('{confirm_message}');"{xhtml}>
{!endif}
{!endif}
<input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
<input type="hidden" value="{poll_id}" name="old_pid"{xhtml}>
</div>
Expand Down
14 changes: 11 additions & 3 deletions plugins/polls/templates/default/pollblock.thtml
@@ -1,7 +1,13 @@
{# begin {templatelocation} #}

<span class="floatright">{edit_icon}</span><div class="poll-topic">{poll_topic}</div>
{# display_type possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{# Only display Topic Description as a Tooltip for when poll in block #}
<div class="poll-topic">{poll_topic}{!!if {display_type} == '1' !!}{poll_topic_description_tooltip}{!endif}</div>
<span class="floatright">{edit_icon}</span>
{!!if {display_type} == '0' !!}
<div class="poll-topic_description">{poll_topic_description}</div>
{!endif}

<form action="{poll_vote_url}" name="Vote" method="post">
<div>
<input type="hidden" name="pid" value="{poll_id}"{xhtml}>
Expand All @@ -25,8 +31,10 @@

<!-- BEGIN poll_questions -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question}</p>
<p class="poll-question">{lang_question}{lang_question_number} {poll_question}</p>
{!if poll_description}
<p class="poll-description">{poll_description}</p>
{!endif}
<ul>
{poll_answers}
</ul>
Expand All @@ -37,4 +45,4 @@
<li><input type="{input_type}" name="aid[{question_id}][]" value="{answer_id}"{selected}{xhtml}>&nbsp;{answer_text}</li>
<!-- END poll_answer -->

{# end {templatelocation} #}
{# end {templatelocation} #}
16 changes: 13 additions & 3 deletions plugins/polls/templates/default/pollresult.thtml
@@ -1,6 +1,13 @@
{# begin {templatelocation} #}

<span class="floatright">{edit_icon}</span><div class="poll-topic">{poll_topic}{poll_topic_description}</div>
{# display_type Possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{# Only display Topic Description as a Tooltip for when poll in block #}
<div class="poll-topic">{poll_topic}{!!if {display_type} == '1' !!}{poll_topic_description_tooltip}{!endif}</div>
<span class="floatright">{edit_icon}</span>
{!!if {display_type} == '0' !!}
<div class="poll-topic_description">{poll_topic_description}</div>
{!endif}

{poll_questions}

{# display_type possible values 0 = Normal, 1 = In Block, 2 = autotag #}
Expand All @@ -16,7 +23,10 @@

<!-- BEGIN poll_question -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question_text}{poll_description}</p>
<p class="poll-question">{lang_question}{lang_question_number}{poll_question_text}</p>
{!if poll_description}
<p class="poll-description">{poll_description}</p>
{!endif}
<table width="100%">
{poll_votes}
</table>
Expand Down Expand Up @@ -44,4 +54,4 @@
</tr>
<!-- END poll_votes_num -->

{# end {templatelocation} #}
{# end {templatelocation} #}
8 changes: 4 additions & 4 deletions plugins/polls/templates/denim/admin/polleditor.thtml
Expand Up @@ -7,10 +7,13 @@
<dl class="form_block">
<dt><label for="polls-polleditor-topic">{lang_topic}</label></dt>
<dd><input type="text" name="topic" value="{poll_topic}" maxlength="255" {!if titletoid}onkeyup="TitleToId('polls-polleditor-topic','polls-polleditor-pid');" {!endif}id="polls-polleditor-topic" class="size6"{xhtml}><br{xhtml}>{poll_topic_info}</dd>

<dt><label for="polls-polleditor-pid">{lang_pollid}</label></dt>
<dd><input type="text" dir="ltr" name="pid" value="{poll_id}" maxlength="128" id="polls-polleditor-pid" class="size6"{xhtml}> {lang_donotusespaces}</dd>

<dt><label for="polls-polleditor-topic_description">{lang_topic_description}</label></dt>
<dd><textarea name="topic_description" rows="2" id="polls-polleditor-topic_description" class="wide">{topic_description}</textarea></dd>

<dt{hide_meta}><label for="polls-polleditor-meta_description">{lang_metadescription}</label></dt>
<dd{hide_meta}><textarea name="meta_description" cols="45" rows="2" id="polls-polleditor-meta_description" class="wide">{meta_description}</textarea></dd>

Expand All @@ -28,9 +31,6 @@

<dt><label for="polls-polleditor-hideresults">{lang_hideresults}</label></dt>
<dd class="controls_text"><input type="checkbox" name="hideresults" id="polls-polleditor-hideresults" {poll_hideresults}{xhtml}> {poll_hideresults_explain}</dd>

<dt><label for="polls-polleditor-topic_description">{lang_topic_description}</label></dt>
<dd><textarea name="topic_description" rows="2" id="polls-polleditor-topic_description" class="wide">{topic_description}</textarea></dd>
</dl>

<div id="po_navbar" class="jsenabled_show">
Expand Down
13 changes: 9 additions & 4 deletions plugins/polls/templates/denim/pollblock.thtml
@@ -1,7 +1,13 @@
{# begin {templatelocation} #}

<span class="floatright">{edit_icon}</span><div class="poll-topic">{poll_topic}</div>
{# display_type possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{# Only display Topic Description as a Tooltip for when poll in block #}
<div class="poll-topic">{poll_topic}{!!if {display_type} == '1' !!}{poll_topic_description_tooltip}{!endif}</div>
<span class="uk-align-right">{edit_icon}</span>
{!!if {display_type} == '0' !!}
<div class="poll-topic_description">{poll_topic_description}</div>
{!endif}

<form action="{poll_vote_url}" name="Vote" method="post" class="uk-form">
<div>
<input type="hidden" name="pid" value="{poll_id}"{xhtml}>
Expand All @@ -12,7 +18,6 @@
</div>
</form>

{# display_type possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{!!if {display_type} == '0' !!}
<div>
<a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters}
Expand All @@ -25,7 +30,7 @@

<!-- BEGIN poll_questions -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question}</p>
<p class="poll-question">{lang_question}{lang_question_number} {poll_question}</p>
<p class="poll-description">{poll_description}</p>
<ul>
{poll_answers}
Expand All @@ -37,4 +42,4 @@
<li><input type="{input_type}" name="aid[{question_id}][]" value="{answer_id}"{selected}{xhtml}>&nbsp;{answer_text}</li>
<!-- END poll_answer -->

{# end {templatelocation} #}
{# end {templatelocation} #}
15 changes: 12 additions & 3 deletions plugins/polls/templates/denim/pollresult.thtml
@@ -1,9 +1,15 @@
{# begin {templatelocation} #}

<span class="uk-align-right">{edit_icon}</span><div class="poll-topic">{poll_topic}{poll_topic_description}</div>
{# display_type Possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{# Only display Topic Description as a Tooltip for when poll in block #}
<div class="poll-topic">{poll_topic}{!!if {display_type} == '1' !!}{poll_topic_description_tooltip}{!endif}</div>
<span class="uk-align-right">{edit_icon}</span>
{!!if {display_type} == '0' !!}
<div class="poll-topic_description">{poll_topic_description}</div>
{!endif}

{poll_questions}

{# display_type Possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{!!if {display_type} == '0' !!}
<div>
{notification} <a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters}
Expand All @@ -17,6 +23,9 @@
<!-- BEGIN poll_question -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question_text}</p>
{!if poll_description}
<p class="poll-description">{poll_description}</p>
{!endif}
<table class="uk-table uk-table-striped">
<tbody>
{poll_votes}
Expand Down Expand Up @@ -49,4 +58,4 @@
</tr>
<!-- END poll_votes_num -->

{# end {templatelocation} #}
{# end {templatelocation} #}
8 changes: 4 additions & 4 deletions plugins/polls/templates/denim_three/admin/polleditor.thtml
Expand Up @@ -7,10 +7,13 @@
<dl class="form_block">
<dt><label for="polls-polleditor-topic">{lang_topic}</label></dt>
<dd><input type="text" name="topic" value="{poll_topic}" {!if titletoid}onkeyup="TitleToId('polls-polleditor-topic','polls-polleditor-pid');" {!endif}id="polls-polleditor-topic" class="uk-input uk-form-width-large" maxlength="255"{xhtml}><br{xhtml}>{poll_topic_info}</dd>

<dt><label for="polls-polleditor-pid">{lang_pollid}</label></dt>
<dd><input type="text" dir="ltr" name="pid" value="{poll_id}" maxlength="128" id="polls-polleditor-pid" class="uk-input uk-form-width-large"{xhtml}> {lang_donotusespaces}</dd>

<dt><label for="polls-polleditor-topic_description">{lang_topic_description}</label></dt>
<dd><textarea name="topic_description" rows="2" id="polls-polleditor-topic_description" class="uk-textarea">{topic_description}</textarea></dd>

<dt{hide_meta}><label for="polls-polleditor-meta_description">{lang_metadescription}</label></dt>
<dd{hide_meta}><textarea name="meta_description" rows="2" id="polls-polleditor-meta_description" class="uk-textarea">{meta_description}</textarea></dd>

Expand All @@ -28,9 +31,6 @@

<dt><label for="polls-polleditor-hideresults">{lang_hideresults}</label></dt>
<dd class="controls_text"><input type="checkbox" name="hideresults" id="polls-polleditor-hideresults" {poll_hideresults} class="uk-checkbox"{xhtml}> {poll_hideresults_explain}</dd>

<dt><label for="polls-polleditor-topic_description">{lang_topic_description}</label></dt>
<dd><textarea name="topic_description" rows="2" id="polls-polleditor-topic_description" class="uk-textarea">{topic_description}</textarea></dd>
</dl>

<div id="po_navbar" class="jsenabled_show">
Expand Down
13 changes: 9 additions & 4 deletions plugins/polls/templates/denim_three/pollblock.thtml
@@ -1,7 +1,13 @@
{# begin {templatelocation} #}

<span class="floatright">{edit_icon}</span><div class="poll-topic">{poll_topic}</div>
{# display_type possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{# Only display Topic Description as a Tooltip for when poll in block #}
<div class="poll-topic">{poll_topic}{!!if {display_type} == '1' !!}{poll_topic_description_tooltip}{!endif}</div>
<span class="uk-align-right">{edit_icon}</span>
{!!if {display_type} == '0' !!}
<div class="poll-topic_description">{poll_topic_description}</div>
{!endif}

<form action="{poll_vote_url}" name="Vote" method="post">
<div>
<input type="hidden" name="pid" value="{poll_id}"{xhtml}>
Expand All @@ -12,7 +18,6 @@
</div>
</form>

{# display_type possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{!!if {display_type} == '0' !!}
<div>
<a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters}
Expand All @@ -25,7 +30,7 @@

<!-- BEGIN poll_questions -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question}</p>
<p class="poll-question">{lang_question}{lang_question_number} {poll_question}</p>
<p class="poll-description">{poll_description}</p>
<ul>
{poll_answers}
Expand All @@ -37,4 +42,4 @@
<li><input type="{input_type}" class="uk-{input_type}" name="aid[{question_id}][]" value="{answer_id}"{selected}{xhtml}>&nbsp;{answer_text}</li>
<!-- END poll_answer -->

{# end {templatelocation} #}
{# end {templatelocation} #}
14 changes: 12 additions & 2 deletions plugins/polls/templates/denim_three/pollresult.thtml
@@ -1,6 +1,13 @@
{# begin {templatelocation} #}

<span class="uk-align-right">{edit_icon}</span><div class="poll-topic">{poll_topic}{poll_topic_description}</div>
{# display_type Possible values 0 = Normal, 1 = In Block, 2 = autotag #}
{# Only display Topic Description as a Tooltip for when poll in block #}
<div class="poll-topic">{poll_topic}{!!if {display_type} == '1' !!}{poll_topic_description_tooltip}{!endif}</div>
<span class="uk-align-right">{edit_icon}</span>
{!!if {display_type} == '0' !!}
<div class="poll-topic_description">{poll_topic_description}</div>
{!endif}

{poll_questions}

{# display_type Possible values 0 = Normal, 1 = In Block, 2 = autotag #}
Expand All @@ -17,6 +24,9 @@
<!-- BEGIN poll_question -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question_text}</p>
{!if poll_description}
<p class="poll-description">{poll_description}</p>
{!endif}
<table class="uk-table uk-table-striped">
<tbody>
{poll_votes}
Expand Down Expand Up @@ -47,4 +57,4 @@
</tr>
<!-- END poll_votes_num -->

{# end {templatelocation} #}
{# end {templatelocation} #}

0 comments on commit 0805806

Please sign in to comment.