Merge branch 'Ecmu/framadate-Issue51' into develop
This commit is contained in:
commit
f0c36ec05f
@ -18,7 +18,7 @@ class VoteRepository extends AbstractRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function insertDefault($poll_id, $insert_position) {
|
function insertDefault($poll_id, $insert_position) {
|
||||||
$prepared = $this->prepare('UPDATE `' . Utils::table('vote') . '` SET choices = CONCAT(SUBSTRING(choices, 1, ?), "0", SUBSTRING(choices, ?)) WHERE poll_id = ?');
|
$prepared = $this->prepare('UPDATE `' . Utils::table('vote') . '` SET choices = CONCAT(SUBSTRING(choices, 1, ?), " ", SUBSTRING(choices, ?)) WHERE poll_id = ?'); //#51 : default value for unselected vote
|
||||||
|
|
||||||
return $prepared->execute([$insert_position, $insert_position + 1, $poll_id]);
|
return $prepared->execute([$insert_position, $insert_position + 1, $poll_id]);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ const VERSION = '1.0';
|
|||||||
// Regex
|
// Regex
|
||||||
const POLL_REGEX = '/^[a-z0-9-]*$/i';
|
const POLL_REGEX = '/^[a-z0-9-]*$/i';
|
||||||
const ADMIN_POLL_REGEX = '/^[a-z0-9]{24}$/i';
|
const ADMIN_POLL_REGEX = '/^[a-z0-9]{24}$/i';
|
||||||
const CHOICE_REGEX = '/^[012]$/';
|
const CHOICE_REGEX = '/^[ 012]$/';
|
||||||
const BOOLEAN_REGEX = '/^(on|off|true|false|1|0)$/i';
|
const BOOLEAN_REGEX = '/^(on|off|true|false|1|0)$/i';
|
||||||
const BOOLEAN_TRUE_REGEX = '/^(on|true|1)$/i';
|
const BOOLEAN_TRUE_REGEX = '/^(on|true|1)$/i';
|
||||||
const EDITABLE_CHOICE_REGEX = '/^[0-2]$/';
|
const EDITABLE_CHOICE_REGEX = '/^[0-2]$/';
|
||||||
|
@ -57,31 +57,42 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{foreach $vote->choices as $id=>$choice}
|
{$id=0}
|
||||||
|
{foreach $slots as $slot}
|
||||||
|
{foreach $slot->moments as $moment}
|
||||||
|
{$choice=$vote->choices[$id]}
|
||||||
|
|
||||||
|
|
||||||
<td class="bg-info" headers="C{$id}">
|
<td class="bg-info" headers="C{$id}">
|
||||||
<ul class="list-unstyled choice">
|
<ul class="list-unstyled choice">
|
||||||
<li class="yes">
|
<li class="yes">
|
||||||
<input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2" {if $choice==2}checked {/if}/>
|
<input type="radio" id="y-choice-{$id}" name="choices[{$id}]" value="2" {if $choice=='2'}checked {/if}/>
|
||||||
<label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results', 'Vote yes for')|html} {$slots[$id]->title|html}">
|
<label class="btn btn-default btn-xs" for="y-choice-{$id}" title="{__('Poll results', 'Vote yes for')|html} {$slots[$id]->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>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="ifneedbe">
|
<li class="ifneedbe">
|
||||||
<input type="radio" id="i-choice-{$id}" name="choices[{$id}]" value="1" {if $choice==1}checked {/if}/>
|
<input type="radio" id="i-choice-{$id}" name="choices[{$id}]" value="1" {if $choice=='1'}checked {/if}/>
|
||||||
<label class="btn btn-default btn-xs" for="i-choice-{$id}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slots[$id]->title|html}">
|
<label class="btn btn-default btn-xs" for="i-choice-{$id}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slots[$id]->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>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="no">
|
<li class="no">
|
||||||
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" {if $choice==0}checked {/if}/>
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" {if $choice=='0'}checked {/if}/>
|
||||||
<label class="btn btn-default btn-xs" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slots[$id]->title|html}">
|
<label class="btn btn-default btn-xs" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slots[$id]->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>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
<li style="display:none">
|
||||||
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value=" " {if $choice!='2' && $choice!='1' && $choice!='0'}checked {/if}/>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
{$id=$id + 1}
|
||||||
|
{/foreach}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
||||||
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
|
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
{elseif !$hidden} {* Voted line *}
|
{elseif !$hidden} {* Voted line *}
|
||||||
@ -89,16 +100,23 @@
|
|||||||
|
|
||||||
<th class="bg-info">{$vote->name|html}</th>
|
<th class="bg-info">{$vote->name|html}</th>
|
||||||
|
|
||||||
{foreach $vote->choices as $id=>$choice}
|
{$id=0}
|
||||||
|
{foreach $slots as $slot}
|
||||||
|
{foreach $slot->moments as $moment}
|
||||||
|
{$choice=$vote->choices[$id]}
|
||||||
|
|
||||||
{if $choice==2}
|
{if $choice=='2'}
|
||||||
<td class="bg-success text-success" headers="C{$id}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td>
|
<td class="bg-success text-success" headers="C{$id}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td>
|
||||||
{elseif $choice==1}
|
{elseif $choice=='1'}
|
||||||
<td class="bg-warning text-warning" headers="C{$id}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td>
|
<td class="bg-warning text-warning" headers="C{$id}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td>
|
||||||
{else}
|
{elseif $choice=='0'}
|
||||||
<td class="bg-danger text-danger" headers="C{$id}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td>
|
<td class="bg-danger text-danger" headers="C{$id}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td>
|
||||||
|
{else}
|
||||||
|
<td class="bg-info" headers="C{$id}"><span class="sr-only">{__('Generic', 'Unknown')}</span></td>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{$id=$id + 1}
|
||||||
|
{/foreach}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
||||||
{if $active && !$expired && $accessGranted &&
|
{if $active && !$expired && $accessGranted &&
|
||||||
@ -154,11 +172,14 @@
|
|||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="no">
|
<li class="no">
|
||||||
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" checked/>
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" />
|
||||||
<label class="btn btn-default btn-xs startunchecked" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slot->title|html}">
|
<label class="btn btn-default btn-xs 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>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
|
<li style="display:none">
|
||||||
|
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value=" " checked/>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
@ -104,31 +104,42 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{foreach $vote->choices as $k=>$choice}
|
{$k=0}
|
||||||
|
{foreach $slots as $slot}
|
||||||
|
{foreach $slot->moments as $moment}
|
||||||
|
{$choice=$vote->choices[$k]}
|
||||||
|
|
||||||
|
|
||||||
<td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$headersH[$k]}">
|
<td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$headersH[$k]}">
|
||||||
<ul class="list-unstyled choice">
|
<ul class="list-unstyled choice">
|
||||||
<li class="yes">
|
<li class="yes">
|
||||||
<input type="radio" id="y-choice-{$k}" name="choices[{$k}]" value="2" {if $choice==2}checked {/if}/>
|
<input type="radio" id="y-choice-{$k}" name="choices[{$k}]" value="2" {if $choice=='2'}checked {/if}/>
|
||||||
<label class="btn btn-default btn-xs" for="y-choice-{$k}" title="{__('Poll results', 'Vote yes for')|html} {$slots_raw[$k]}">
|
<label class="btn btn-default btn-xs" for="y-choice-{$k}" title="{__('Poll results', 'Vote yes for')|html} {$slots_raw[$k]}">
|
||||||
<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>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="ifneedbe">
|
<li class="ifneedbe">
|
||||||
<input type="radio" id="i-choice-{$k}" name="choices[{$k}]" value="1" {if $choice==1}checked {/if}/>
|
<input type="radio" id="i-choice-{$k}" name="choices[{$k}]" value="1" {if $choice=='1'}checked {/if}/>
|
||||||
<label class="btn btn-default btn-xs" for="i-choice-{$k}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slots_raw[$k]}">
|
<label class="btn btn-default btn-xs" for="i-choice-{$k}" title="{__('Poll results', 'Vote ifneedbe for')|html} {$slots_raw[$k]}">
|
||||||
(<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>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="no">
|
<li class="no">
|
||||||
<input type="radio" id="n-choice-{$k}" name="choices[{$k}]" value="0" {if $choice==0}checked {/if}/>
|
<input type="radio" id="n-choice-{$k}" name="choices[{$k}]" value="0" {if $choice=='0'}checked {/if}/>
|
||||||
<label class="btn btn-default btn-xs" for="n-choice-{$k}" title="{__('Poll results', 'Vote no for')|html} {$slots_raw[$k]}">
|
<label class="btn btn-default btn-xs" for="n-choice-{$k}" title="{__('Poll results', 'Vote no for')|html} {$slots_raw[$k]}">
|
||||||
<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 style="display:none">
|
||||||
|
<input type="radio" id="n-choice-{$k}" name="choices[{$k}]" value=" " {if $choice!='2' && $choice!='1' && $choice!='0'}checked {/if}/>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
{$k=$k + 1}
|
||||||
|
{/foreach}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
||||||
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
|
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@ -139,16 +150,23 @@
|
|||||||
|
|
||||||
<th class="bg-info">{$vote->name|html}</th>
|
<th class="bg-info">{$vote->name|html}</th>
|
||||||
|
|
||||||
{foreach $vote->choices as $k=>$choice}
|
{$k=0}
|
||||||
|
{foreach $slots as $slot}
|
||||||
|
{foreach $slot->moments as $moment}
|
||||||
|
{$choice=$vote->choices[$k]}
|
||||||
|
|
||||||
{if $choice==2}
|
{if $choice=='2'}
|
||||||
<td class="bg-success text-success" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td>
|
<td class="bg-success text-success" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td>
|
||||||
{elseif $choice==1}
|
{elseif $choice=='1'}
|
||||||
<td class="bg-warning text-warning" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td>
|
<td class="bg-warning text-warning" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td>
|
||||||
{else}
|
{elseif $choice=='0'}
|
||||||
<td class="bg-danger text-danger" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td>
|
<td class="bg-danger text-danger" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td>
|
||||||
|
{else}
|
||||||
|
<td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><span class="sr-only">{__('Generic', 'Unknown')}</span></td>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{$k=$k + 1}
|
||||||
|
{/foreach}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
||||||
{if $active && !$expired && $accessGranted &&
|
{if $active && !$expired && $accessGranted &&
|
||||||
@ -205,11 +223,14 @@
|
|||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="no">
|
<li class="no">
|
||||||
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0" checked/>
|
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0" />
|
||||||
<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 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 style="display:none">
|
||||||
|
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value=" " checked/>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
{$i = $i+1}
|
{$i = $i+1}
|
||||||
|
Loading…
Reference in New Issue
Block a user