Commit 54b27e4a authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Show profile icons all over the place where they could be

parent 96c1403c
......@@ -52,7 +52,7 @@ var results = new TableRenderer(
'searchresults',
'search.json.php',
[
function(r) { return TD(null,IMG({'src': '{$wwwroot}thumb.php?type=user&id=' + r.id, 'alt': {$str_profileimage}})); },
function(r) { return TD(null,IMG({'src': '{$wwwroot}thumb.php?type=profileicon&size=40x40&id=' + r.id, 'alt': {$str_profileimage}})); },
function(r) {
return TD({'style': 'vertical-align: top'},
A({'href': '{$wwwroot}user/view.php?id=' + r.id}, r.name),
......
......@@ -77,7 +77,7 @@ var table = new TableRenderer(
'profileicons.json.php',
[
function(rowdata) {
return TD(null, IMG({'src': '$wwwroot/thumb.php?type=profileicon&size=100x100&id=' + rowdata.id, 'alt': rowdata.note}));
return TD(null, IMG({'src': '$wwwroot/thumb.php?type=profileiconbyid&size=100x100&id=' + rowdata.id, 'alt': rowdata.note}));
},
function(rowdata) {
return TD(null, rowdata.title ? rowdata.title : rowdata.note);
......
......@@ -6,6 +6,7 @@
{include file="columnleftstart.tpl"}
<div class="fr leftrightlink"><a href="profileicons.php" id="editprofileicons">{str tag="editprofileicons" section="artefact.internal"} &raquo;</a></div>
<div class="fr cr"><img src="{$WWWROOT}thumb.php?type=profileicon&size=100x100&id={$USER->get('id')}" alt=""></div>
<h2>{str section="artefact.internal" tag="profile"}</h2>
{$profileform}
{include file="columnleftend.tpl"}
......
......@@ -31,7 +31,7 @@ require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('myfriends'));
$wwwroot = get_config('wwwroot');
$profileurl = $wwwroot . 'thumb.php?type=user&id=';
$profileurl = $wwwroot . 'thumb.php?type=profileicon&size=40x40&id=';
$viewurl = $wwwroot . 'user/view.php?id=';
$viewsavailable = get_string('viewsavailable');
......
......@@ -166,6 +166,7 @@ $string['uploadcsvusersaddedsuccessfully'] = 'The users in the file have been ad
$string['adminuserspagedescription'] = '<p>Here you can choose which users are administrators for the site. The current administrators are listed on the right, and potential administrators are on the left.</p><p>The system must have at least one administrator.</p>';
$string['adminusersupdated'] = 'Admin users updated';
$string['usersearch'] = 'User Search';
$string['usersearchdescription'] = 'Search all users and perform administrative actions on them';
// Staff Users
$string['staffuserspagedescription'] = 'Here you can choose which users are staff for the site. The current staff are on the right, and potential staff are on the left.';
......
......@@ -500,6 +500,9 @@ $string['pendingfriends'] = 'Pending friends';
$string['friendlistfailure'] = 'Failed to modify your friends list';
$string['friend'] = 'Friend';
$string['profileicon'] = 'Profile Icon';
// general views stuff
$string['viewavailable'] = 'View available';
$string['viewsavailable'] = 'Views available';
......
......@@ -195,6 +195,12 @@ tr.required th {
.fr {
float: right;
}
.cl {
clear: left;
}
.cr {
clear: right;
}
.s {
font-size: 11px;
font-weight: normal;
......
......@@ -23,6 +23,7 @@
<li><strong><a href="{$WWWROOT}admin/users/notifications.php">{str tag=adminnotifications section=admin}</a></strong> - {str tag=adminnotificationsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/institutions.php">{str tag=institutions section=admin}</a></strong> - {str tag=institutionsdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/uploadcsv.php">{str tag=uploadcsv section=admin}</a></strong> - {str tag=uploadcsvdescription section=admin}</li>
<li><strong><a href="{$WWWROOT}admin/users/search.php">{str tag=usersearch section=admin}</a></strong> - {str tag=usersearchdescription section=admin}</li>
</ul>
</li>
<li><h3>{str tag=configextensions section=admin}</h3>
......
......@@ -13,11 +13,12 @@
</form>
<div id="messagediv"></div>
<table id="friendslist" class="tablerenderer">
<thead>
<thead>
<tr>
<td></td>
<td></td>
<td></td>
<th>{str tag="profileicon"}</th>
<th>{str tag="friend"}</th>
<th>{str tag="views"}</th>
<th>{str tag="remove"}</th>
<tr>
</thead>
<tbody>
......
......@@ -7,11 +7,19 @@
{include file="columnleftstart.tpl"}
<div id="userview">
<h3>{$NAME}</h3>
<div></div>
<div>
<table id="userview_profile"><tbody>
{foreach from=$USERFIELDS key=key item=item}
<tr><th>{str section=artefact.internal tag=$key}</th><td>{$item}</td></tr>
{foreach from=$USERFIELDS name=userfields key=key item=item}
<tr>{if $smarty.foreach.userfields.first}
<td style="width: 100px;" rowspan="{$smarty.foreach.userfields.total+1}">
<img src="{$WWWROOT}thumb.php?type=profileicon&size=100x100&id={$USERID}" alt="">
</td>{/if}
<th>{str section=artefact.internal tag=$key}</th><td>{$item}</td>
</tr>
{/foreach}
</tbody></table>
</div>
{if $VIEWS}
<table id="userview_views"><thead><tr><th>
{str section=mahara tag=views}
......
......@@ -47,29 +47,39 @@ switch ($type) {
exit;
break;
case 'profileiconbyid':
case 'profileicon':
$id = param_integer('id');
$size = param_variable('size', '');
if ($size && !preg_match('/\d+x\d+/', $size)) {
throw new UserException('Invalid size for image specified');
}
list($width, $height) = explode('x', $size);
if ($width > 300 || $height > 300) {
throw new UserException('Requested image size is too big');
}
if ($width % 5 != 0 || $height % 5 != 0) {
throw new UserException('Requested image size must be in multiples of 5 for width and height');
if ($type == 'profileicon') {
// Convert ID of user to the ID of a profileicon
$id = get_field('usr', 'profileicon', 'id', $id);
}
if ($path = get_dataroot_image_path('artefact/internal/profileicons', $id, $size)) {
$type = get_mime_type($path);
if ($type) {
header('Content-type: ' . $type);
readfile($path);
exit;
if ($id) {
$size = param_variable('size', '');
if ($size && !preg_match('/\d+x\d+/', $size)) {
throw new UserException('Invalid size for image specified');
}
list($width, $height) = explode('x', $size);
if ($width > 300 || $height > 300) {
throw new UserException('Requested image size is too big');
}
if ($width % 5 != 0 || $height % 5 != 0) {
throw new UserException('Requested image size must be in multiples of 5 for width and height');
}
if ($path = get_dataroot_image_path('artefact/internal/profileicons', $id, $size)) {
$type = get_mime_type($path);
if ($type) {
header('Content-type: ' . $type);
readfile($path);
exit;
}
}
}
header('Content-type: ' . 'image/gif');
readfile(theme_get_image_path('images/no_userphoto40x40.gif'));
break;
......
......@@ -281,6 +281,7 @@ else {
$smarty->assign('FRIENDFORM', $friendform);
$smarty->assign('INLINEJAVASCRIPT', $inlinejs);
$smarty->assign('NAME',$name);
$smarty->assign('USERID', $userid);
$smarty->assign('USERFIELDS',$userfields);
$smarty->assign('VIEWS',$views);
$smarty->display('user/view.tpl');
......
Supports Markdown
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