HTML 5 and fixes
This commit is contained in:
parent
c180090a59
commit
852c2c0d2a
@ -201,6 +201,8 @@ if (!empty($_GET['vote'])) {
|
|||||||
// Something to save (edit or add)
|
// Something to save (edit or add)
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
|
$selectedNewVotes = [];
|
||||||
|
|
||||||
if (!empty($_POST['save'])) { // Save edition of an old vote
|
if (!empty($_POST['save'])) { // Save edition of an old vote
|
||||||
$name = $inputService->filterName($_POST['name']);
|
$name = $inputService->filterName($_POST['name']);
|
||||||
$editedVote = filter_input(INPUT_POST, 'save', FILTER_VALIDATE_INT);
|
$editedVote = filter_input(INPUT_POST, 'save', FILTER_VALIDATE_INT);
|
||||||
@ -252,6 +254,7 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
|
|||||||
}
|
}
|
||||||
} catch (AlreadyExistsException $aee) {
|
} catch (AlreadyExistsException $aee) {
|
||||||
$message = new Message('danger', __('Error', 'You already voted'));
|
$message = new Message('danger', __('Error', 'You already voted'));
|
||||||
|
$selectedNewVotes = $choices;
|
||||||
} catch (ConcurrentEditionException $cee) {
|
} catch (ConcurrentEditionException $cee) {
|
||||||
$message = new Message('danger', __('Error', 'Poll has been updated before you vote'));
|
$message = new Message('danger', __('Error', 'Poll has been updated before you vote'));
|
||||||
} catch (ConcurrentVoteException $cve) {
|
} catch (ConcurrentVoteException $cve) {
|
||||||
@ -445,5 +448,6 @@ $smarty->assign('accessGranted', true);
|
|||||||
$smarty->assign('resultPubliclyVisible', true);
|
$smarty->assign('resultPubliclyVisible', true);
|
||||||
$smarty->assign('editedVoteUniqueId', '');
|
$smarty->assign('editedVoteUniqueId', '');
|
||||||
$smarty->assign('default_to_marldown_editor', $config['markdown_editor_by_default']);
|
$smarty->assign('default_to_marldown_editor', $config['markdown_editor_by_default']);
|
||||||
|
$smarty->assign('selectedNewVotes', $selectedNewVotes);
|
||||||
|
|
||||||
$smarty->display('studs.tpl');
|
$smarty->display('studs.tpl');
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
{if $poll->ValueMax eq NULL || $best_choices['y'][$i] lt $poll->ValueMax}
|
{if $poll->ValueMax eq NULL || $best_choices['y'][$i] lt $poll->ValueMax}
|
||||||
<li class="yes">
|
<li class="yes">
|
||||||
<input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2"
|
<input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2"
|
||||||
{(!isset($selectedNewVotes[$id]) || ("2" !== $selectedNewVotes[$id])) ? "" : " checked=\"checked\""}
|
{(!isset($selectedNewVotes[$id]) || ("2" !== $selectedNewVotes[$id])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
<label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results', 'Vote yes for')|html} {$slot->title|html}">
|
<label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results', 'Vote yes for')|html} {$slot->title|html}">
|
||||||
<i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span>
|
<i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span>
|
||||||
@ -189,7 +189,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="ifneedbe">
|
<li class="ifneedbe">
|
||||||
<input type="radio" id="i-choice-{$id}" name="choices[{$id}]" value="1"
|
<input type="radio" id="i-choice-{$id}" name="choices[{$id}]" value="1"
|
||||||
{(!isset($selectedNewVotes[$id]) || ("1" !== $selectedNewVotes[$id])) ? "" : " checked=\"checked\""}
|
{(!isset($selectedNewVotes[$id]) || ("1" !== $selectedNewVotes[$id])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
<label class="btn btn-default btn-xs" for="i-choice-{$id}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slot->title|html}">
|
<label class="btn btn-default btn-xs" for="i-choice-{$id}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slot->title|html}">
|
||||||
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
||||||
@ -198,7 +198,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<li class="no">
|
<li class="no">
|
||||||
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0"
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0"
|
||||||
{(!isset($selectedNewVotes[$id]) || ("0" !== $selectedNewVotes[$id])) ? "" : " checked=\"checked\""}
|
{(!isset($selectedNewVotes[$id]) || ("0" !== $selectedNewVotes[$id])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
<label class="btn btn-default btn-xs {(!isset($selectedNewVotes[$id]) || ("0" !== $selectedNewVotes[$id])) ? "startunchecked" : ""}" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slot->title|html}">
|
<label class="btn btn-default btn-xs {(!isset($selectedNewVotes[$id]) || ("0" !== $selectedNewVotes[$id])) ? "startunchecked" : ""}" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slot->title|html}">
|
||||||
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
|
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
|
||||||
@ -206,7 +206,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="hide">
|
<li class="hide">
|
||||||
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value=" "
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value=" "
|
||||||
{(isset($selectedNewVotes[$id]) || ("" !== $selectedNewVotes[$id])) ? "" : " checked=\"checked\""}
|
{(isset($selectedNewVotes[$id]) || ("" !== $selectedNewVotes[$id])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -243,7 +243,7 @@
|
|||||||
{if $poll->ValueMax eq NULL || $best_choices['y'][$i] lt $poll->ValueMax}
|
{if $poll->ValueMax eq NULL || $best_choices['y'][$i] lt $poll->ValueMax}
|
||||||
<li class="yes">
|
<li class="yes">
|
||||||
<input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2"
|
<input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2"
|
||||||
{(!isset($selectedNewVotes[$i]) || ("2" !== $selectedNewVotes[$i])) ? "" : " checked=\"checked\""}
|
{(!isset($selectedNewVotes[$i]) || ("2" !== $selectedNewVotes[$i])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
<label class="btn btn-default btn-xs" for="y-choice-{$i}" title="{__('Poll results', 'Vote yes for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
<label class="btn btn-default btn-xs" for="y-choice-{$i}" title="{__('Poll results', 'Vote yes for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
||||||
<i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span>
|
<i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span>
|
||||||
@ -251,7 +251,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="ifneedbe">
|
<li class="ifneedbe">
|
||||||
<input type="radio" id="i-choice-{$i}" name="choices[{$i}]" value="1"
|
<input type="radio" id="i-choice-{$i}" name="choices[{$i}]" value="1"
|
||||||
{(!isset($selectedNewVotes[$i]) || ("1" !== $selectedNewVotes[$i])) ? "" : " checked=\"checked\""}
|
{(!isset($selectedNewVotes[$i]) || ("1" !== $selectedNewVotes[$i])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
<label class="btn btn-default btn-xs" for="i-choice-{$i}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
<label class="btn btn-default btn-xs" for="i-choice-{$i}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
||||||
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span>
|
||||||
@ -261,15 +261,15 @@
|
|||||||
|
|
||||||
<li class="no">
|
<li class="no">
|
||||||
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0"
|
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0"
|
||||||
{(!isset($selectedNewVotes[$i]) || ("0" !== $selectedNewVotes[$i])) ? "" : " checked=\"checked\""}
|
{(!isset($selectedNewVotes[$i]) || ("0" !== $selectedNewVotes[$i])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
<label class="btn btn-default btn-xs startunchecked" for="n-choice-{$i}" title="{__('Poll results', 'Vote no for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
<label class="btn btn-default btn-xs {(!isset($selectedNewVotes[$i]) || ("0" !== $selectedNewVotes[$i])) ? "startunchecked" : ""}" for="n-choice-{$i}" title="{__('Poll results', 'Vote no for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
||||||
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
|
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="hide">
|
<li class="hide">
|
||||||
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value=" "
|
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value=" "
|
||||||
{(isset($selectedNewVotes[$i]) || ("" !== $selectedNewVotes[$i])) ? "" : " checked=\"checked\""}
|
{(isset($selectedNewVotes[$i]) || ("" !== $selectedNewVotes[$i])) ? "" : " checked"}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user