Small fixes
Change CollectMail class name, add a title on voters name in admin with email value Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
e6716bc745
commit
4c0c2a16f9
@ -20,16 +20,14 @@
|
|||||||
namespace Framadate;
|
namespace Framadate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Collect_mail
|
* Class CollectMail
|
||||||
*
|
*
|
||||||
* Is used to specify the poll's edition permissions.
|
* Is used to specify the poll's edition permissions.
|
||||||
* @TODO : wait to use the SplEnum
|
* @TODO : wait to use the SplEnum
|
||||||
*
|
*
|
||||||
* @package Framadate
|
* @package Framadate
|
||||||
*/
|
*/
|
||||||
class Collect_mail { // extends SplEnum
|
class CollectMail { // extends SplEnum
|
||||||
const __default = self::NO_COLLECT;
|
|
||||||
|
|
||||||
const NO_COLLECT = 0;
|
const NO_COLLECT = 0;
|
||||||
const COLLECT = 1;
|
const COLLECT = 1;
|
||||||
const COLLECT_REQUIRED = 2;
|
const COLLECT_REQUIRED = 2;
|
@ -84,7 +84,7 @@ class Form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if voters email addresses are collected or not.
|
* Tells if voters email addresses are collected or not.
|
||||||
* @var \Framadate\Collect_mail
|
* @var \Framadate\CollectMail
|
||||||
*/
|
*/
|
||||||
public $collect_users_mail;
|
public $collect_users_mail;
|
||||||
|
|
||||||
@ -93,9 +93,10 @@ class Form
|
|||||||
*/
|
*/
|
||||||
private $choices;
|
private $choices;
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct()
|
||||||
|
{
|
||||||
$this->editable = Editable::EDITABLE_BY_ALL;
|
$this->editable = Editable::EDITABLE_BY_ALL;
|
||||||
$this->collect_users_mail = Collect_mail::NO_COLLECT;
|
$this->collect_users_mail = CollectMail::NO_COLLECT;
|
||||||
$this->clearChoices();
|
$this->clearChoices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ class InputService {
|
|||||||
return filter_var($editable, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => EDITABLE_CHOICE_REGEX]]);
|
return filter_var($editable, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => EDITABLE_CHOICE_REGEX]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filterCollect_mail($collect_mail) {
|
public function filterCollectMail($collectMail) {
|
||||||
return filter_var($collect_mail, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => COLLECT_MAIL_CHOICE_REGEX]]);
|
return filter_var($collectMail, FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => COLLECT_MAIL_CHOICE_REGEX]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filterComment($comment) {
|
public function filterComment($comment) {
|
||||||
|
@ -58,7 +58,6 @@ if ($goToStep2) {
|
|||||||
$use_ValueMax = isset($_POST['use_ValueMax']) ? $inputService->filterBoolean($_POST['use_ValueMax']) : false;
|
$use_ValueMax = isset($_POST['use_ValueMax']) ? $inputService->filterBoolean($_POST['use_ValueMax']) : false;
|
||||||
$ValueMax = $use_ValueMax === true ? $inputService->filterValueMax($_POST['ValueMax']) : null;
|
$ValueMax = $use_ValueMax === true ? $inputService->filterValueMax($_POST['ValueMax']) : null;
|
||||||
|
|
||||||
$collect_users_mail = isset($_POST['collect_users_mail']) ? $inputService->filterBoolean($_POST['collect_users_mail']) : false;
|
|
||||||
$use_customized_url = isset($_POST['use_customized_url']) ? $inputService->filterBoolean($_POST['use_customized_url']) : false;
|
$use_customized_url = isset($_POST['use_customized_url']) ? $inputService->filterBoolean($_POST['use_customized_url']) : false;
|
||||||
$customized_url = $use_customized_url === true ? $inputService->filterId($_POST['customized_url']) : null;
|
$customized_url = $use_customized_url === true ? $inputService->filterId($_POST['customized_url']) : null;
|
||||||
$name = $inputService->filterName($_POST['name']);
|
$name = $inputService->filterName($_POST['name']);
|
||||||
@ -69,7 +68,7 @@ if ($goToStep2) {
|
|||||||
$receiveNewComments = isset($_POST['receiveNewComments']) ? $inputService->filterBoolean($_POST['receiveNewComments']) : false;
|
$receiveNewComments = isset($_POST['receiveNewComments']) ? $inputService->filterBoolean($_POST['receiveNewComments']) : false;
|
||||||
$hidden = isset($_POST['hidden']) ? $inputService->filterBoolean($_POST['hidden']) : false;
|
$hidden = isset($_POST['hidden']) ? $inputService->filterBoolean($_POST['hidden']) : false;
|
||||||
$use_password = filter_input(INPUT_POST, 'use_password', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BOOLEAN_REGEX]]);
|
$use_password = filter_input(INPUT_POST, 'use_password', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BOOLEAN_REGEX]]);
|
||||||
$collect_users_mail = $inputService->filterCollect_mail($_POST['collect_users_mail']);
|
$collect_users_mail = $inputService->filterCollectMail($_POST['collect_users_mail']);
|
||||||
$use_password = filter_input(INPUT_POST, 'use_password', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BOOLEAN_REGEX]]);
|
$use_password = filter_input(INPUT_POST, 'use_password', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => BOOLEAN_REGEX]]);
|
||||||
$password = isset($_POST['password']) ? $_POST['password'] : null;
|
$password = isset($_POST['password']) ? $_POST['password'] : null;
|
||||||
$password_repeat = isset($_POST['password_repeat']) ? $_POST['password_repeat'] : null;
|
$password_repeat = isset($_POST['password_repeat']) ? $_POST['password_repeat'] : null;
|
||||||
|
@ -335,19 +335,19 @@
|
|||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="collect_users_mail" id="no_collect" {if $collect_users_mail==constant("Framadate\Collect_mail::NO_COLLECT")}checked{/if} value="{constant("Framadate\Collect_mail::NO_COLLECT")}">
|
<input type="radio" name="collect_users_mail" id="no_collect" {if $collect_users_mail==constant("Framadate\CollectMail::NO_COLLECT")}checked{/if} value="{constant("Framadate\CollectMail::NO_COLLECT")}">
|
||||||
{__('Step 1', 'Email addresses are not collected')}
|
{__('Step 1', 'Email addresses are not collected')}
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="collect_users_mail" {if $collect_users_mail==constant("Framadate\Collect_mail::COLLECT")}checked{/if} value="{constant("Framadate\Collect_mail::COLLECT")}">
|
<input type="radio" name="collect_users_mail" {if $collect_users_mail==constant("Framadate\CollectMail::COLLECT")}checked{/if} value="{constant("Framadate\CollectMail::COLLECT")}">
|
||||||
{__('Step 1', 'Email addresses are collected but not required')}
|
{__('Step 1', 'Email addresses are collected but not required')}
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="collect_users_mail" {if $collect_users_mail==constant("Framadate\Collect_mail::COLLECT_REQUIRED")}checked{/if} value="{constant("Framadate\Collect_mail::COLLECT_REQUIRED")}">
|
<input type="radio" name="collect_users_mail" {if $collect_users_mail==constant("Framadate\CollectMail::COLLECT_REQUIRED")}checked{/if} value="{constant("Framadate\CollectMail::COLLECT_REQUIRED")}">
|
||||||
{__('Step 1', 'Email addresses are required')}
|
{__('Step 1', 'Email addresses are required')}
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" disabled name="collect_users_mail" {if $collect_users_mail==constant("Framadate\Collect_mail::COLLECT_REQUIRED_VERIFIED")}checked{/if} value="{constant("Framadate\Collect_mail::COLLECT_REQUIRED_VERIFIED")}">
|
<input type="radio" disabled name="collect_users_mail" {if $collect_users_mail==constant("Framadate\CollectMail::COLLECT_REQUIRED_VERIFIED")}checked{/if} value="{constant("Framadate\CollectMail::COLLECT_REQUIRED_VERIFIED")}">
|
||||||
{__('Step 1', 'Email addresses are required and verified')}
|
{__('Step 1', 'Email addresses are required and verified')}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -233,13 +233,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="collect_users_mail">
|
<div id="collect_users_mail">
|
||||||
{if $poll->collect_users_mail == constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail == constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
{$txt=__('PollInfo', 'Voters email adresses are not collected')}
|
{$txt=__('PollInfo', 'Voters email adresses are not collected')}
|
||||||
{else if $poll->collect_users_mail == constant("Framadate\Collect_mail::COLLECT")}
|
{else if $poll->collect_users_mail == constant("Framadate\CollectMail::COLLECT")}
|
||||||
{$txt=__('PollInfo', 'Voters email adresses are collected')}
|
{$txt=__('PollInfo', 'Voters email adresses are collected')}
|
||||||
{else if $poll->collect_users_mail == constant("Framadate\Collect_mail::COLLECT_REQUIRED")}
|
{else if $poll->collect_users_mail == constant("Framadate\CollectMail::COLLECT_REQUIRED")}
|
||||||
{$txt=__('PollInfo', 'Voters email adresses are collected and required')}
|
{$txt=__('PollInfo', 'Voters email adresses are collected and required')}
|
||||||
{else if $poll->collect_users_mail == constant("Framadate\Collect_mail::COLLECT_REQUIRED_VERIFIED")}
|
{else if $poll->collect_users_mail == constant("Framadate\CollectMail::COLLECT_REQUIRED_VERIFIED")}
|
||||||
{$txt=__('PollInfo', 'Voters email adresses are collected, required and verified')}
|
{$txt=__('PollInfo', 'Voters email adresses are collected, required and verified')}
|
||||||
{else}
|
{else}
|
||||||
{$txt='Error'}
|
{$txt='Error'}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
class="btn btn-link btn-sm remove-column" title="{__('adminstuds', 'Remove the column')} {$slot->title|html}">
|
class="btn btn-link btn-sm remove-column" title="{__('adminstuds', 'Remove the column')} {$slot->title|html}">
|
||||||
<i class="glyphicon glyphicon-remove text-danger"></i><span class="sr-only">{__('Generic', 'Remove')}</span>
|
<i class="glyphicon glyphicon-remove text-danger"></i><span class="sr-only">{__('Generic', 'Remove')}</span>
|
||||||
</a>
|
</a>
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
<a href="{poll_url id=$admin_poll_id admin=true action='collect_mail' action_value=($headersDCount)}"
|
<a href="{poll_url id=$admin_poll_id admin=true action='collect_mail' action_value=($headersDCount)}"
|
||||||
class="btn btn-link btn-sm collect-mail"
|
class="btn btn-link btn-sm collect-mail"
|
||||||
title="{__('adminstuds', 'Collect the emails of the polled users for the choice')} {$slot->title|html}">
|
title="{__('adminstuds', 'Collect the emails of the polled users for the choice')} {$slot->title|html}">
|
||||||
@ -68,8 +68,8 @@
|
|||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
||||||
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
|
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
|
||||||
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
<input type="email" {if $poll->collect_users_mail != constant("Framadate\Collect_mail::COLLECT")} required {/if} id="mail" name="mail" value="{$vote->mail|html}" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
<input type="email" {if $poll->collect_users_mail != constant("Framadate\CollectMail::COLLECT")} required {/if} id="mail" name="mail" value="{$vote->mail|html}" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -112,13 +112,13 @@
|
|||||||
{elseif !$hidden} {* Voted line *}
|
{elseif !$hidden} {* Voted line *}
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th class="bg-info">{$vote->name|html}
|
<th class="bg-info" {if $accessGranted && $admin && $vote->mail}title="{$vote->mail|html}"{/if}>{$vote->name|html}
|
||||||
{if $active && !$expired && $accessGranted &&
|
{if $active && !$expired && $accessGranted &&
|
||||||
(
|
(
|
||||||
$poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')
|
$poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')
|
||||||
or $admin
|
or $admin
|
||||||
or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId)
|
or ($poll->editable == constant('Framadate\Editable::EDITABLE_BY_OWN') && $editedVoteUniqueId == $vote->uniqId)
|
||||||
) && $slots gt 4
|
) && $slots|count gt 4
|
||||||
}
|
}
|
||||||
<span class="edit-username-left">
|
<span class="edit-username-left">
|
||||||
<a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-default btn-sm" title="{__f('Poll results', 'Edit the line: %s', $vote->name)|html}">
|
<a href="{if $admin}{poll_url id=$poll->admin_id vote_id=$vote->uniqId admin=true}{else}{poll_url id=$poll->id vote_id=$vote->uniqId}{/if}" class="btn btn-default btn-sm" title="{__f('Poll results', 'Edit the line: %s', $vote->name)|html}">
|
||||||
@ -184,11 +184,11 @@
|
|||||||
<div class="input-group input-group-sm">
|
<div class="input-group input-group-sm">
|
||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
||||||
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
<input type="email" required id="mail" name="mail" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
<input type="email" required id="mail" name="mail" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT") && $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT") && $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')}
|
||||||
<div class="bg-danger">
|
<div class="bg-danger">
|
||||||
<i class="glyphicon glyphicon-alert"> </i>
|
<i class="glyphicon glyphicon-alert"> </i>
|
||||||
<label> {__('Poll results', 'Anyone will be able to access your email address after your vote')} </label>
|
<label> {__('Poll results', 'Anyone will be able to access your email address after your vote')} </label>
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
title="{__('adminstuds', 'Remove the column')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
title="{__('adminstuds', 'Remove the column')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
||||||
<i class="glyphicon glyphicon-remove text-danger"></i><span class="sr-only">{__('Generic', 'Remove')}</span>
|
<i class="glyphicon glyphicon-remove text-danger"></i><span class="sr-only">{__('Generic', 'Remove')}</span>
|
||||||
</a>
|
</a>
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
<a href="{poll_url id=$admin_poll_id admin=true action='collect_mail' action_value=($headersDCount)}"
|
<a href="{poll_url id=$admin_poll_id admin=true action='collect_mail' action_value=($headersDCount)}"
|
||||||
class="btn btn-link btn-sm collect-mail"
|
class="btn btn-link btn-sm collect-mail"
|
||||||
title="{__('adminstuds', 'Collect the emails of the polled users for the choice')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
title="{__('adminstuds', 'Collect the emails of the polled users for the choice')} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
|
||||||
@ -112,8 +112,8 @@
|
|||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
||||||
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
|
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
|
||||||
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
<input type="email" {if $poll->collect_users_mail != constant("Framadate\Collect_mail::COLLECT")} required {/if} id="mail" name="mail" value="{$vote->mail|html}" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
<input type="email" {if $poll->collect_users_mail != constant("Framadate\CollectMail::COLLECT")} required {/if} id="mail" name="mail" value="{$vote->mail|html}" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -162,7 +162,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
{* Voted line *}
|
{* Voted line *}
|
||||||
<th class="bg-info">{$vote->name|html}
|
<th class="bg-info" {if $accessGranted && $admin}title="{$vote->mail|html}"{/if}>{$vote->name|html}
|
||||||
{if $active && !$expired && $accessGranted &&
|
{if $active && !$expired && $accessGranted &&
|
||||||
(
|
(
|
||||||
$poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')
|
$poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')
|
||||||
@ -239,11 +239,11 @@
|
|||||||
<div class="input-group input-group-sm">
|
<div class="input-group input-group-sm">
|
||||||
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
|
||||||
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
<input type="text" id="name" name="name" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT")}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT")}
|
||||||
<input type="email" {if $poll->collect_users_mail != constant("Framadate\Collect_mail::COLLECT")} required {/if} id="mail" name="mail" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
<input type="email" {if $poll->collect_users_mail != constant("Framadate\CollectMail::COLLECT")} required {/if} id="mail" name="mail" class="form-control" title="{__('Generic', 'Your email address')}" placeholder="{__('Generic', 'Your email address')}" />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{if $poll->collect_users_mail != constant("Framadate\Collect_mail::NO_COLLECT") && $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')}
|
{if $poll->collect_users_mail != constant("Framadate\CollectMail::NO_COLLECT") && $poll->editable == constant('Framadate\Editable::EDITABLE_BY_ALL')}
|
||||||
<div class="bg-danger">
|
<div class="bg-danger">
|
||||||
<i class="glyphicon glyphicon-alert"> </i>
|
<i class="glyphicon glyphicon-alert"> </i>
|
||||||
<label> {__('Poll results', 'Anyone will be able to access your email address after your vote')} </label>
|
<label> {__('Poll results', 'Anyone will be able to access your email address after your vote')} </label>
|
||||||
|
Loading…
Reference in New Issue
Block a user