Skip to content

Commit

Permalink
Merge pull request #1714 from annando/1506-mail-link-profile
Browse files Browse the repository at this point in the history
Show preselected mail receivers
  • Loading branch information
fabrixxm committed Jun 30, 2015
2 parents 7a0f2b6 + ab074e2 commit 9716141
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion include/acl_selectors.php
Expand Up @@ -190,8 +190,14 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p

$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");

if ($privmail AND $preselected) {
$sql_extra .= " AND `id` IN (".implode(",", $preselected).")";
$hidepreselected = ' style="display: none;"';
} else
$hidepreselected = "";

if($privmail)
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex >\r\n";
$o .= "<select name=\"$selname\" id=\"$selclass\" class=\"$selclass\" size=\"$size\" $tabindex $hidepreselected>\r\n";
else
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n";

Expand All @@ -209,6 +215,8 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p

call_hooks($a->module . '_pre_' . $selname, $arr);

$receiverlist = array();

if(count($r)) {
foreach($r as $rr) {
if((is_array($preselected)) && in_array($rr['id'], $preselected))
Expand All @@ -221,13 +229,18 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
else
$trimmed = mb_substr($rr['name'],0,20);

$receiverlist[] = $trimmed;

$o .= "<option value=\"{$rr['id']}\" $selected title=\"{$rr['name']}|{$rr['url']}\" >$trimmed</option>\r\n";
}

}

$o .= "</select>\r\n";

if ($privmail AND $preselected)
$o .= implode(", ", $receiverlist);

call_hooks($a->module . '_post_' . $selname, $o);

return $o;
Expand Down

0 comments on commit 9716141

Please sign in to comment.