Some design and usability improvements.

This commit is contained in:
Phyks 2013-09-27 17:33:04 +02:00
parent e26fd91ff1
commit b2727d9254
10 changed files with 75 additions and 15 deletions

4
TODO
View File

@ -1,3 +1,7 @@
* Check database creation in install.php
* Don't display the whole balance table if not admin
Improvements :
==============
* User groups

View File

@ -10,11 +10,9 @@
'negative_amount'=>array('fr'=>'Montant négatif non autorisé.', 'en'=>'Negative amount not allowed.'),
'template_error'=>array('fr'=>'Template non disponible.', 'en'=>'Template not available.'),
'unauthorized'=>array('fr'=>'Vous n\'avez pas le droit de faire cette action.', 'en'=>'You are not authorized to do that.'),
'no_users'=>array('fr'=>'Vous devez ajouter au moins un autre utilisateur.', 'en'=>'You must add at least one more user beside you.')
);
$localized = array(
'guest'=>array('fr'=>'invité', 'en'=>'guest')
'no_users'=>array('fr'=>'Vous devez ajouter au moins un autre utilisateur.', 'en'=>'You must add at least one more user beside you.'),
'what_unknown,'=>array('fr'=>'Vous devez renseigner un objet pour la dépense.', 'en'=>'You must add something to describe this invoice in "what" field.'),
'incorrect_amount'=>array('fr'=>'Montant incorrect ou nul.', 'en'=>'Incorrect amount or amount is zero.')
);
// Include necessary files
@ -150,6 +148,8 @@
}
$tpl->assign('connection', true);
$tpl->assign('user_post', (!empty($_POST['login'])) ? htmlspecialchars($_POST['login']) : '');
if(!empty($error))
$tpl->assign('error', $error);
$tpl->assign('token', generate_token('connection'));
$tpl->draw('connection');
break;
@ -517,6 +517,12 @@
$tpl->assign('amount_post', (!empty($amount) ? (float) $amount : 0));
$tpl->assign('what_post', (!empty($what) ? htmlspecialchars($what) : ''));
$tpl->assign('users', secureDisplay($users_list));
if(empty($_POST['what']))
$tpl->assign('error', $errors['what_unknown'][LANG]);
if((float) $_POST['amount'] == 0)
$tpl->assign('error', $errors['incorrect_amount'][LANG]);
$tpl->assign('users_in', (!empty($users_in) ? $users_in : array()));
$tpl->assign('id', (!empty($_GET['id']) ? (int) $_GET['id'] : 0));
$tpl->assign('token', generate_token('new_invoice'));

View File

@ -39,7 +39,7 @@ table {
}
table td, table th {
padding: 0.5em;
padding: 0.75em;
border: 1px solid black;
}
@ -135,6 +135,10 @@ input[type=submit] {
text-align: center
}
#connexion_form .label-block {
width: 150px;
}
#edit_password_form, #edit_user_form, #invoice_form, #notice_form, #global_payback_form {
width: 67%;
margin: auto;

View File

@ -44,6 +44,26 @@ function toggle_password(id) {
document.getElementById(id).type = 'password';
}
function payback_nobody() {
var users = document.getElementById('global_payback_form').getElementsByClassName("users_in");
for(var index = 0; index < users.length; index ++) {
users[index].checked = false;
}
return false;
}
function payback_everybody() {
var users = document.getElementById('global_payback_form').getElementsByClassName("users_in");
for(var index = 0; index < users.length; index ++) {
users[index].checked = true;
}
return false;
}
$(document).ready(function() {
$('#balance_table td, #global_paybacks_table td').hover(function() {
$(this).closest('tr').find('td,th').addClass('highlight_td');

View File

@ -31,9 +31,10 @@
<fieldset>
<legend>Users to include</legend>
{loop="$users"}
<input type="checkbox" id="users_in_{$value->getId()}" name="users_in[]" value="{$value->getId()}"/>
<input type="checkbox" id="users_in_{$value->getId()}" name="users_in[]" class="users_in" value="{$value->getId()}" checked="checked"/>
<label for="users_in_{$value->getId()}">{$value->getDisplayName()}</label><br/>
{/loop}
{/loop}<br/>
Select : <a href="" onclick="return payback_nobody();">Nobody</a> / <a href="" onclick="return payback_everybody();">Everybody</a>
</fieldset>
<p>
<input type="submit" onclick="return confirm('You are going to add a global payback which includes the selected user. Confirm ?');" value="Confirm"/>

View File

@ -39,7 +39,7 @@ table {
}
table td, table th {
padding: 0.5em;
padding: 0.75em;
border: 1px solid black;
}
@ -135,6 +135,10 @@ input[type=submit] {
text-align: center
}
#connexion_form .label-block {
width: 150px;
}
#edit_password_form, #edit_user_form, #invoice_form, #notice_form, #global_payback_form {
width: 67%;
margin: auto;

View File

@ -17,7 +17,7 @@
<td>{$value->getId()}</td>
<td>{$value->getLogin()}</td>
<td>{$value->getDisplayName()}</td>
<td>{$value->getAdmin() ? "Yes" : "No"}</td>
<td>{$value->getAdmin() ? "Oui" : "Non"}</td>
<td><a href="index.php?do=edit_users&user_id={$value->getId()}">Modifier</a></td>
<td>{if condition="$value->getId() != $current_user->getId()"}<a href="index.php?do=delete_user&amp;user_id={$value->getId()}&amp;token={$token}">Supprimer</a>{/if}</td>
</tr>
@ -60,7 +60,7 @@
<form method="post" action="index.php?do=password" id="edit_password_form">
<p><label for="password" class="label-block">Nouveau mot de passe : </label><input type="password" id="password" name="password"/> <a href="" onclick="toggle_password('password'); return false;"><img src="img/toggleVisible.png" alt="Afficher / Masquer"/></a></p>
<p><label for="password_confirm" class="label-block">Confirmation : </label><input type="password" id="password_confirm" name="password_confirm"/> <a href="" onclick="toggle_password('password_confirm'); return false;"><img src="img/toggleVisible.png" alt="Afficher / Masquer"/></a></p>
<p class="center"><input type="submit" value="Update"/><input type="hidden" name="token" value="{$token}"</p>
<p class="center"><input type="submit" value="Enregistrer"/><input type="hidden" name="token" value="{$token}"</p>
</form>
<h2>Votre jeton de connexion à l'API</h2>

View File

@ -58,9 +58,9 @@
{loop="$value->getUsersIn()->get()"}
{$users[$key2]->getDisplayName()}
{if condition="$value2 > 1"}
({$value2} guests)
({$value2} invités)
{elseif condition="$value2 == 1"}
({$value2} guest)
({$value2} invité)
{/if}
{if condition="$value1->getBuyer() != $key2"}
-

View File

@ -44,6 +44,26 @@ function toggle_password(id) {
document.getElementById(id).type = 'password';
}
function payback_nobody() {
var users = document.getElementById('global_payback_form').getElementsByClassName("users_in");
for(var index = 0; index < users.length; index ++) {
users[index].checked = false;
}
return false;
}
function payback_everybody() {
var users = document.getElementById('global_payback_form').getElementsByClassName("users_in");
for(var index = 0; index < users.length; index ++) {
users[index].checked = true;
}
return false;
}
$(document).ready(function() {
$('#balance_table td, #global_paybacks_table td').hover(function() {
$(this).closest('tr').find('td,th').addClass('highlight_td');

View File

@ -31,9 +31,10 @@
<fieldset>
<legend>Utilisateurs à inclure</legend>
{loop="$users"}
<input type="checkbox" id="users_in_{$value->getId()}" name="users_in[]" value="{$value->getId()}"/>
<input type="checkbox" id="users_in_{$value->getId()}" name="users_in[]" class="users_in" value="{$value->getId()}" checked="checked"/>
<label for="users_in_{$value->getId()}">{$value->getDisplayName()}</label><br/>
{/loop}
{/loop}<br/>
Sélectionner : <a href="" onclick="return payback_nobody();">Personne</a> / <a href="" onclick="return payback_everybody();">Tout le monde</a>
</fieldset>
<p>
<input type="submit" onclick="return confirm('Vous êtes sur le point d\'ajouter un remboursement global incluant les utilisateurs sélectionnés.');" value="Valider"/>