Commit 86b84712 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Renamed fullname() to display_name(), fixed userlist bugs

parent 88c7970f
...@@ -31,7 +31,7 @@ require('init.php'); ...@@ -31,7 +31,7 @@ require('init.php');
require_once('form.php'); require_once('form.php');
if ($SESSION->is_logged_in()) { if ($SESSION->is_logged_in()) {
$name = fullname($USER); $name = display_name($USER);
$email = $USER->email; $email = $USER->email;
} }
else { else {
......
...@@ -41,10 +41,6 @@ var grouplist = new TableRenderer( ...@@ -41,10 +41,6 @@ var grouplist = new TableRenderer(
] ]
); );
grouplist.offset = 0;
grouplist.limit = 10;
grouplist.type = 'testing';
grouplist.statevars.push('type');
grouplist.updateOnLoad(); grouplist.updateOnLoad();
JAVASCRIPT; JAVASCRIPT;
......
...@@ -42,6 +42,10 @@ function form_render_userlist($element, Form $form) { ...@@ -42,6 +42,10 @@ function form_render_userlist($element, Form $form) {
$value = $form->get_value($element); $value = $form->get_value($element);
if (!is_array($value) && is_array($element['defaultvalue'])) {
$value = $element['defaultvalue'];
}
if (is_array($value) && count($value)) { if (is_array($value) && count($value)) {
$members = get_records_select('usr','id IN (' . join(',',$value) . ')', null, '', 'id,firstname,lastname,prefname'); $members = get_records_select('usr','id IN (' . join(',',$value) . ')', null, '', 'id,firstname,lastname,prefname');
...@@ -51,10 +55,7 @@ function form_render_userlist($element, Form $form) { ...@@ -51,10 +55,7 @@ function form_render_userlist($element, Form $form) {
} }
$smarty->assign('options',$members); $smarty->assign('options',$members);
$smarty->assign('value', join(',',$form->get_value($element))); $smarty->assign('value', join(',',$value));
}
else if (!is_array($value)) {
// @todo use the default
} }
$smarty->assign('name', $element['name']); $smarty->assign('name', $element['name']);
......
...@@ -984,14 +984,14 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='') ...@@ -984,14 +984,14 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='')
else { else {
$mail->Sender = $userfrom->email; $mail->Sender = $userfrom->email;
$mail->From = $mail->Sender; $mail->From = $mail->Sender;
$mail->FromName = fullname($userfrom); $mail->FromName = display_name($userfrom);
} }
$mail->AddReplyTo($mail->From, $mail->FromName); $mail->AddReplyTo($mail->From, $mail->FromName);
$mail->Subject = substr(stripslashes($subject), 0, 78); $mail->Subject = substr(stripslashes($subject), 0, 78);
$usertoname = fullname($userto); $usertoname = display_name($userto);
$mail->AddAddress($userto->email, $usertoname ); $mail->AddAddress($userto->email, $usertoname );
$mail->WordWrap = 79; $mail->WordWrap = 79;
...@@ -1014,7 +1014,7 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='') ...@@ -1014,7 +1014,7 @@ function email_user($userto, $userfrom, $subject, $messagetext, $messagehtml='')
. "Error from phpmailer was: " . $mail->ErrorInfo ); . "Error from phpmailer was: " . $mail->ErrorInfo );
} }
function fullname($user) { function display_name($user) {
return $user->firstname . ' ' . $user->lastname; return $user->firstname . ' ' . $user->lastname;
// @todo // @todo
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment