Skip to content

Commit

Permalink
Updated Poll templates to use blocks instead of additional template f…
Browse files Browse the repository at this point in the history
…iles.
  • Loading branch information
eSilverStrike committed May 15, 2017
1 parent 3b05049 commit 7eb0b9d
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 116 deletions.
31 changes: 19 additions & 12 deletions plugins/polls/functions.inc
Expand Up @@ -467,11 +467,15 @@ function POLLS_pollVote($pid, $showall = true, $displaytype = 0, $order = '', $m
if ($nquestions > 0) {
$poll = COM_newTemplate(CTL_plugin_templatePath('polls'));
$poll->set_file(array(
'panswer' => 'pollanswer.thtml',
'block' => 'pollblock.thtml',
'pquestions' => 'pollquestions.thtml',
'comments' => 'pollcomments.thtml',
));

$blocks = array('poll_questions', 'poll_answer');
foreach ($blocks as $block) {
$poll->set_block('block', $block);
}

$poll->set_var('poll_id', $pid);
$poll->set_var('poll_topic', $P['topic']);
$poll->set_var('poll_topic_description', $P['description']);
Expand Down Expand Up @@ -557,10 +561,10 @@ function POLLS_pollVote($pid, $showall = true, $displaytype = 0, $order = '', $m
}
$poll->set_var('answer_id', $A['aid']);
$poll->set_var('answer_text', $A['answer']);
$poll->parse('poll_answers', 'panswer', true);
$poll->parse('poll_answers', 'poll_answer', true);
$poll->clear_var('selected');
}
$poll->parse('poll_questions', 'pquestions', true);
$poll->parse('poll_questions', 'poll_questions', true);
$poll->clear_var('poll_answers');
}
if ($nquestions > 1) {
Expand Down Expand Up @@ -800,11 +804,14 @@ function POLLS_pollResults($pid, $scale = 100, $order = '', $mode = '', $page =
$poll = COM_newTemplate(CTL_plugin_templatePath('polls'));
$poll->set_file(array(
'result' => 'pollresult.thtml',
'question' => 'pollquestion.thtml',
'comments' => 'pollcomments.thtml',
'votes_bar' => 'pollvotes_bar.thtml',
'votes_num' => 'pollvotes_num.thtml',
'comments' => 'pollcomments.thtml'
));

$blocks = array('poll_question', 'poll_votes_bar', 'poll_votes_num');
foreach ($blocks as $block) {
$poll->set_block('result', $block);
}

$poll->set_var('poll_topic', $P['topic']);
$poll->set_var('poll_topic_description', $P['description']);
$poll->set_var('poll_id', $pid);
Expand Down Expand Up @@ -838,7 +845,7 @@ function POLLS_pollResults($pid, $scale = 100, $order = '', $mode = '', $page =
if ($nquestions >= 1) {
$counter = ($j + 1) . "/$nquestions: ";
}
$poll->set_var('poll_question', $counter . $Q['question']);
$poll->set_var('poll_question_text', $counter . $Q['question']);
$poll->set_var('poll_description', $counter . $Q['description']);

$answer_sql = "SELECT votes, answer, remark FROM {$_TABLES['pollanswers']} "
Expand Down Expand Up @@ -873,14 +880,14 @@ function POLLS_pollResults($pid, $scale = 100, $order = '', $mode = '', $page =
$poll->set_var('answer_percent',
sprintf('%.2f', $percent * 100));
if ($scale < 50) {
$poll->parse('poll_votes', 'votes_num', true);
$poll->parse('poll_votes', 'poll_votes_num', true);
} else {
$width = (int) ($percent * $scale);
$poll->set_var('bar_width', $width);
$poll->parse('poll_votes', 'votes_bar', true);
$poll->parse('poll_votes', 'poll_votes_bar', true);
}
}
$poll->parse('poll_questions', 'question', true);
$poll->parse('poll_questions', 'poll_question', true);
$poll->clear_var('poll_votes');
if (($scale < 100) && ($j < 1)) {
$url = $_CONF['site_url'] . "/polls/index.php?pid=$pid";
Expand Down
5 changes: 0 additions & 5 deletions plugins/polls/templates/default/pollanswer.thtml

This file was deleted.

14 changes: 14 additions & 0 deletions plugins/polls/templates/default/pollblock.thtml
Expand Up @@ -16,4 +16,18 @@
<a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters} {poll_comments}
</span>

<!-- BEGIN poll_questions -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question}</p>
<p class="poll-description">{poll_description}</p>
<ul>
{poll_answers}
</ul>
</div>
<!-- END poll_questions -->

<!-- BEGIN poll_answer -->
<li><input type="{input_type}" name="aid[{question_id}][]" value="{answer_id}"{selected}{xhtml}>&nbsp;{answer_text}</li>
<!-- END poll_answer -->

{# end {templatelocation} #}
10 changes: 0 additions & 10 deletions plugins/polls/templates/default/pollquestion.thtml

This file was deleted.

11 changes: 0 additions & 11 deletions plugins/polls/templates/default/pollquestions.thtml

This file was deleted.

30 changes: 30 additions & 0 deletions plugins/polls/templates/default/pollresult.thtml
Expand Up @@ -6,4 +6,34 @@
{notification} <a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters} {poll_comments}
</div>

<!-- BEGIN poll_question -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question_text}{poll_description}</p>
<table width="100%">
{poll_votes}
</table>
</div>
<!-- END poll_question -->

<!-- BEGIN poll_votes_bar -->
<tr class="pluginRow{cssidb}">
<td class="poll_answer_text" style="width:20%">{answer_text}</td>
<td class="poll_answer_bar">
<img src="{layout_url}/images/bar.gif" style="align:bottom; height:10px; width:{bar_width}%;" alt=""{xhtml}> {answer_num} ({answer_percent}%)
</td>
</tr>
<tr class="pluginRow{cssida}">
<td align="left" colspan="2">
{remark_text}
</td>
</tr>
<!-- END poll_votes_bar -->

<!-- BEGIN poll_votes_num -->
<tr>
<td class="poll_answer_text">{answer_text}</td>
<td class="poll_answer_percent">{answer_percent}% </td>
</tr>
<!-- END poll_votes_num -->

{# end {templatelocation} #}
15 changes: 0 additions & 15 deletions plugins/polls/templates/default/pollvotes_bar.thtml

This file was deleted.

8 changes: 0 additions & 8 deletions plugins/polls/templates/default/pollvotes_num.thtml

This file was deleted.

5 changes: 0 additions & 5 deletions plugins/polls/templates/denim/pollanswer.thtml

This file was deleted.

14 changes: 14 additions & 0 deletions plugins/polls/templates/denim/pollblock.thtml
Expand Up @@ -16,4 +16,18 @@
<a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters} {poll_comments}
</span>

<!-- BEGIN poll_questions -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question}</p>
<p class="poll-description">{poll_description}</p>
<ul>
{poll_answers}
</ul>
</div>
<!-- END poll_questions -->

<!-- BEGIN poll_answer -->
<li><input type="{input_type}" name="aid[{question_id}][]" value="{answer_id}"{selected}{xhtml}>&nbsp;{answer_text}</li>
<!-- END poll_answer -->

{# end {templatelocation} #}
12 changes: 0 additions & 12 deletions plugins/polls/templates/denim/pollquestion.thtml

This file was deleted.

11 changes: 0 additions & 11 deletions plugins/polls/templates/denim/pollquestions.thtml

This file was deleted.

37 changes: 36 additions & 1 deletion plugins/polls/templates/denim/pollresult.thtml
@@ -1,9 +1,44 @@
{# begin {templatelocation} #}

<span class="floatright">{edit_icon}</span><div class="poll-topic">{poll_topic}{poll_topic_description}</div>
<span class="uk-align-right">{edit_icon}</span><div class="poll-topic">{poll_topic}{poll_topic_description}</div>
{poll_questions}
<div class="pluginTinyText">
{notification} <a href="{site_url}/polls/index.php">{lang_polltopics}</a> | {num_votes} {lang_voters} {poll_comments}
</div>

<!-- BEGIN poll_question -->
<div class="poll-questions">
<p class="poll-question">{lang_question}{lang_question_number}{poll_question_text}</p>
<table class="uk-table uk-table-striped">
<tbody>
{poll_votes}
</tbody>
</table>
</div>
<!-- END poll_question -->

<!-- BEGIN poll_votes_bar -->
<tr>
<td class="uk-width-3-10">{answer_text}</td>
<td class="uk-width-6-10">
<div class="uk-progress uk-margin-small uk-margin-bottom-remove">
<div class="uk-progress-bar" style="width: {bar_width}%;"></div>
</div>
{!if remark_text}
<div>{remark_text}</div>
{!endif}
</td>
<td class="uk-width-1-10">
{answer_num} ({answer_percent}%)
</td>
</tr>
<!-- END poll_votes_bar -->

<!-- BEGIN poll_votes_num -->
<tr>
<td class="poll_answer_text">{answer_text}</td>
<td class="poll_answer_percent">{answer_percent}% </td>
</tr>
<!-- END poll_votes_num -->

{# end {templatelocation} #}
18 changes: 0 additions & 18 deletions plugins/polls/templates/denim/pollvotes_bar.thtml

This file was deleted.

8 changes: 0 additions & 8 deletions plugins/polls/templates/denim/pollvotes_num.thtml

This file was deleted.

1 change: 1 addition & 0 deletions public_html/docs/english/theme.html
Expand Up @@ -209,6 +209,7 @@ <h2><a name="changes213">Theme changes in Geeklog 2.1.3</a></h2>
<li>Removed {copyright_notice} from <span class="tt">footer.thtml</span> since it contained embedded HTML tags and the same message can be created from {copyright_msg} and {trademark_msg} template variables.</li>
<li>Removed from the users directory the files <span class="tt">storyrow.thtml</span>, <span class="tt">commentrow.thtml</span>, and <span class="tt">email.thtml</span>. Added additional blocks to <span class="tt">profile.thtml</span> to take into account removed files.</li>
<li>Added 3 blocks to <span class="tt">storytext.thtml</span>, <span class="tt">featuredstorytext.thtml</span>, and <span class="tt">archivestorytext.thtml</span> to control how left aligned, right aligned, and non aligned images are displayed in articles (using the [imageX], [imageX_right], and [imageX_left] tags).</li>
<li>Removed from the Polls Plugin the files for the denim and default templates <span class="tt">pollanswer.thtml</span>, <span class="tt">pollquestions.thtml</span>, <span class="tt">pollvotes_bar.thtml</span>, <span class="tt">pollvotes_num.thtml</span>, and <span class="tt">pollquestion.thtml</span>. Added additional blocks to <span class="tt">pollblock.thtml</span> and <span class="tt">pollresult.thtml</span> to take into account removed files.</li>
</ul>

<h2><a name="changes212">Theme changes in Geeklog 2.1.2</a></h2>
Expand Down

0 comments on commit 7eb0b9d

Please sign in to comment.