Commit afc28dbe authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Bug 1815807: Show the person who uploaded a file to a group"

parents f44049da f6cd664f
......@@ -346,6 +346,7 @@ var FileBrowser = (function($) {
}
}
$('#' + self.id + '_edit_messages').empty();
$('#' + self.id + '_edit_uploadedby').text(self.filedata[id].uploadedby);
$('#' + self.id + '_edit_row input.permission').each(function () {
var perm = $(this).prop('name').split(':');
if (self.filedata[id].permissions[perm[1]] && self.filedata[id].permissions[perm[1]][perm[2]] == 1) {
......
......@@ -152,6 +152,7 @@ $string['nofilesfound'] = 'No files found';
$string['notpublishable'] = 'You do not have the permission to publish this file.';
$string['overwrite'] = 'Overwrite';
$string['Owner'] = 'Owner';
$string['uploadedby'] = 'Uploaded by';
$string['parentfolder'] = 'Parent folder';
$string['phpzipneeded'] = 'The PHP zip extension is needed to be able to use this functionality';
$string['Preview'] = 'Preview';
......
......@@ -553,7 +553,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
global $USER;
$select = '
SELECT
a.id, a.artefacttype, a.mtime, f.size, fi.orientation, a.title, a.description, a.license, a.licensor, a.licensorurl, a.locked, a.allowcomments, u.profileicon AS defaultprofileicon,
a.id, a.artefacttype, a.mtime, f.size, fi.orientation, a.title, a.description, a.license, a.licensor, a.licensorurl, a.locked, a.allowcomments, u.profileicon AS defaultprofileicon, a.author,
COUNT(DISTINCT c.id) AS childcount, COUNT (DISTINCT aa.artefact) AS attachcount, COUNT(DISTINCT va.view) AS viewcount, COUNT(DISTINCT s.id) AS skincount,
COUNT(DISTINCT api.id) AS profileiconcount, COUNT(DISTINCT fpa.id) AS postcount';
$from = '
......@@ -611,7 +611,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
}
else if ($group) {
$select .= ',
r.can_edit, r.can_view, r.can_republish, a.author';
r.can_edit, r.can_view, r.can_republish';
$from .= '
LEFT OUTER JOIN (
SELECT ar.artefact, ar.can_edit, ar.can_view, ar.can_republish
......@@ -692,6 +692,9 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
if ($group && $item->author == $USER->get('id')) {
$item->can_edit = 1; // This will show the delete, edit buttons in filelist, but doesn't change the actual permissions in the checkbox
}
$userobj = new User();
$userobj->find_by_id($item->author);
$item->uploadedby = display_name($userobj, null, true);
}
if ($item->artefacttype == 'folder') {
if ($item->childcount > 0 && defined('FOLDER_SIZE')) {
......@@ -1378,13 +1381,24 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
$filetype = $this->get('oldextension') . ' ' . get_string('file', 'artefact.file');
}
if (!empty($this->author)) {
$uploader = new User();
$uploader->find_by_id($this->author);
$uploadedby = display_name($uploader, null, true);
}
$smarty = smarty_core();
// $smarty->assign('iconpath', $this->get_icon($options));
$smarty->assign('downloadpath', $downloadpath);
$smarty->assign('filetype', $filetype);
if ($USER->is_logged_in()) {
if ($this->group) {
$group = get_group_by_id($this->group);
$smarty->assign('ownername', 'Group "' . $group->name .'"');
}
else if ($USER->is_logged_in()) {
$smarty->assign('ownername', $this->display_owner());
}
$smarty->assign('uploadedby', $uploadedby);
$smarty->assign('view', (isset($options['viewid']) ? $options['viewid'] : null));
$smarty->assign('created', strftime(get_string('strftimedaydatetime'), $this->get('ctime')));
$smarty->assign('modified', strftime(get_string('strftimedaydatetime'), $this->get('mtime')));
......
......@@ -31,6 +31,10 @@
<td>{$ownername}</td>
</tr>
{/if}
<tr>
<th>{str tag=uploadedby section=artefact.file}:</th>
<td>{$uploadedby}</td>
</tr>
<tr>
<th>{str tag=Created section=artefact.file}:</th>
<td>{$created}</td>
......
......@@ -33,6 +33,10 @@
<span>{contextualhelp plugintype='artefact' pluginname='file' section='tags'}</span>
<div class="description">{str tag=tagsdescprofile}</div>
</div>
<div>
<label for="{$prefix}_edit_uploadedby">{str tag=uploadedby section=artefact.file}</label>
<span id="{$prefix}_edit_uploadedby"></span>
</div>
{if $groupinfo}
<div>
<label>{str tag=Permissions}</label>
......
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