Commit 0709699c authored by Ruslan Kabalin's avatar Ruslan Kabalin Committed by Gerrit Code Review
Browse files

Merge "Make profile pics available in files area"

parents b5328db2 4a7b4ac4
...@@ -196,7 +196,7 @@ function attachedImageList() { ...@@ -196,7 +196,7 @@ function attachedImageList() {
var images = []; var images = [];
var attachments = editpost_filebrowser.selecteddata; var attachments = editpost_filebrowser.selecteddata;
for (var a in attachments) { for (var a in attachments) {
if (attachments[a].artefacttype == 'image') { if (attachments[a].artefacttype == 'image' || attachments[a].artefacttype == 'profileicon') {
images.push({ images.push({
'id': attachments[a].id, 'id': attachments[a].id,
'name': attachments[a].title, 'name': attachments[a].title,
......
...@@ -606,7 +606,7 @@ class PluginBlocktypeGallery extends PluginBlocktype { ...@@ -606,7 +606,7 @@ class PluginBlocktypeGallery extends PluginBlocktype {
} }
$element['config']['selectone'] = false; $element['config']['selectone'] = false;
$element['filters'] = array( $element['filters'] = array(
'artefacttype' => array('image'), 'artefacttype' => array('image', 'profileicon'),
); );
return $element; return $element;
} }
......
...@@ -109,7 +109,7 @@ class PluginBlocktypeImage extends PluginBlocktype { ...@@ -109,7 +109,7 @@ class PluginBlocktypeImage extends PluginBlocktype {
$element['name'] = 'artefactid'; $element['name'] = 'artefactid';
$element['config']['selectone'] = true; $element['config']['selectone'] = true;
$element['filters'] = array( $element['filters'] = array(
'artefacttype' => array('image'), 'artefacttype' => array('image', 'profileicon'),
); );
return $element; return $element;
} }
......
...@@ -276,5 +276,20 @@ function xmldb_artefact_file_upgrade($oldversion=0) { ...@@ -276,5 +276,20 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
set_config_plugin('artefact', 'file', 'defaultgroupquota', 52428800); set_config_plugin('artefact', 'file', 'defaultgroupquota', 52428800);
} }
if ($oldversion < 2011070700) {
// Update profileicons' description and location
safe_require('artefact', 'file');
if ($pics = get_records_array('artefact', 'artefacttype', 'profileicon')) {
foreach ($pics as $p) {
$p->parent = ArtefactTypeFolder::get_folder_id(get_string('imagesdir', 'artefact.file'),
get_string('imagesdirdesc', 'artefact.file'), null, true, $p->owner);
$p->description = empty($p->description) ? get_string('uploadedprofileicon', 'artefact.file') : $p->description;
update_record('artefact', $p);
}
}
}
return $status; return $status;
} }
...@@ -132,10 +132,6 @@ class HtmlExportFile extends HtmlExportArtefactPlugin { ...@@ -132,10 +132,6 @@ class HtmlExportFile extends HtmlExportArtefactPlugin {
} }
} }
} }
foreach ($removekeys as $key) {
unset($this->artefactdata[$key]);
}
} }
/** /**
......
...@@ -306,9 +306,12 @@ class LeapImportFile extends LeapImportArtefactPlugin { ...@@ -306,9 +306,12 @@ class LeapImportFile extends LeapImportArtefactPlugin {
$artefact->set('mtime', strtotime((string)$entry->updated)); $artefact->set('mtime', strtotime((string)$entry->updated));
if ($isprofileicon) { if ($isprofileicon) {
$artefact->set('artefacttype', 'profileicon'); $artefact->set('artefacttype', 'profileicon');
$artefact->set('parent', null);
// Sadly the process for creating a profile icon is a bit dumb. To // Put profile pic in 'profile pics' folder
$artefact->set('parent', ArtefactTypeFolder::get_folder_id(get_string('imagesdir', 'artefact.file'),
get_string('imagesdirdesc', 'artefact.file'), null, true, $importer->get('usr')));
// Sadly the process for creating a profile icon is a bit dumb. To
// be honest, it shouldn't even be a separate artefact type // be honest, it shouldn't even be a separate artefact type
$basedir = get_config('dataroot') . 'artefact/file/'; $basedir = get_config('dataroot') . 'artefact/file/';
$olddir = 'originals/' . ($id % 256) . '/'; $olddir = 'originals/' . ($id % 256) . '/';
......
...@@ -256,6 +256,13 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -256,6 +256,13 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
var id = getNodeAttribute(this, 'name').replace(/.*_edit\[(\d+)\]$/, '$1'); var id = getNodeAttribute(this, 'name').replace(/.*_edit\[(\d+)\]$/, '$1');
self.hide_edit_form(); self.hide_edit_form();
$(self.id + '_edit_heading').innerHTML = self.filedata[id].artefacttype == 'folder' ? get_string('editfolder') : get_string('editfile'); $(self.id + '_edit_heading').innerHTML = self.filedata[id].artefacttype == 'folder' ? get_string('editfolder') : get_string('editfile');
var descriptionrow = getFirstParentByTagAndClassName($(self.id + '_edit_description'), 'tr');
if (self.filedata[id].artefacttype == 'profileicon') {
addElementClass(descriptionrow, 'hidden');
}
else {
removeElementClass(descriptionrow, 'hidden');
}
$(self.id + '_edit_title').value = self.filedata[id].title; $(self.id + '_edit_title').value = self.filedata[id].title;
$(self.id + '_edit_description').value = self.filedata[id].description == null ? '' : self.filedata[id].description; $(self.id + '_edit_description').value = self.filedata[id].description == null ? '' : self.filedata[id].description;
$(self.id + '_edit_allowcomments').checked = self.filedata[id].allowcomments; $(self.id + '_edit_allowcomments').checked = self.filedata[id].allowcomments;
...@@ -311,6 +318,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -311,6 +318,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
} }
if (self.filedata[id].childcount > 0) { if (self.filedata[id].childcount > 0) {
warn += get_string('foldernotempty') + ' '; warn += get_string('foldernotempty') + ' ';
if (self.filedata[id].profileiconcount > 0) {
warn += get_string('foldercontainsprofileicons', self.filedata[id].profileiconcount) + ' ';
}
warn += get_string('confirmdeletefolderandcontents'); warn += get_string('confirmdeletefolderandcontents');
} }
else if (warn != '') { else if (warn != '') {
...@@ -318,6 +328,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -318,6 +328,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
} }
} }
else { else {
if (self.filedata[id].defaultprofileicon == id) {
warn += get_string('defaultprofileicon') + ' ';
}
if (self.filedata[id].attachcount > 0) { if (self.filedata[id].attachcount > 0) {
warn += get_string('fileattached', self.filedata[id].attachcount) + ' '; warn += get_string('fileattached', self.filedata[id].attachcount) + ' ';
} }
......
...@@ -96,6 +96,7 @@ $string['Folder'] = 'Folder'; ...@@ -96,6 +96,7 @@ $string['Folder'] = 'Folder';
$string['folderappearsinviews'] = 'This folder appears in one or more of your pages.'; $string['folderappearsinviews'] = 'This folder appears in one or more of your pages.';
$string['Folders'] = 'Folders'; $string['Folders'] = 'Folders';
$string['foldernotempty'] = 'This folder is not empty.'; $string['foldernotempty'] = 'This folder is not empty.';
$string['foldercontainsprofileicons'] = 'The folder contains %s profile picture(s).';
$string['foldercreated'] = 'Folder created'; $string['foldercreated'] = 'Folder created';
$string['foldernamerequired'] = 'Please provide a name for the new folder.'; $string['foldernamerequired'] = 'Please provide a name for the new folder.';
$string['gotofolder'] = 'Go to %s'; $string['gotofolder'] = 'Go to %s';
...@@ -105,6 +106,8 @@ $string['htmlremovedmessage'] = 'You are viewing <strong>%s</strong> by <a href= ...@@ -105,6 +106,8 @@ $string['htmlremovedmessage'] = 'You are viewing <strong>%s</strong> by <a href=
$string['htmlremovedmessagenoowner'] = 'You are viewing <strong>%s</strong>. The file displayed below has been filtered to remove malicious content, and is only a rough representation of the original.'; $string['htmlremovedmessagenoowner'] = 'You are viewing <strong>%s</strong>. The file displayed below has been filtered to remove malicious content, and is only a rough representation of the original.';
$string['image'] = 'Image'; $string['image'] = 'Image';
$string['Images'] = 'Images'; $string['Images'] = 'Images';
$string['imagesdir'] = 'images';
$string['imagesdirdesc'] = 'Image files';
$string['lastmodified'] = 'Last Modified'; $string['lastmodified'] = 'Last Modified';
$string['myfiles'] = 'My Files'; $string['myfiles'] = 'My Files';
$string['Name'] = 'Name'; $string['Name'] = 'Name';
...@@ -212,8 +215,9 @@ $string['cantcreatetempprofileiconfile'] = 'Could not write temporary profile pi ...@@ -212,8 +215,9 @@ $string['cantcreatetempprofileiconfile'] = 'Could not write temporary profile pi
$string['profileiconsize'] = 'Profile Picture Size'; $string['profileiconsize'] = 'Profile Picture Size';
$string['profileicons'] = 'Profile Pictures'; $string['profileicons'] = 'Profile Pictures';
$string['Default'] = 'Default'; $string['Default'] = 'Default';
$string['defaultprofileicon'] = 'This is currently set as your default profile picture.';
$string['deleteselectedicons'] = 'Delete selected Profile Pictures'; $string['deleteselectedicons'] = 'Delete selected Profile Pictures';
$string['profileicon'] = 'Profile Pictures'; $string['profileicon'] = 'Profile Picture';
$string['noimagesfound'] = 'No images found'; $string['noimagesfound'] = 'No images found';
$string['uploadedprofileiconsuccessfully'] = 'Uploaded new profile picture successfully'; $string['uploadedprofileiconsuccessfully'] = 'Uploaded new profile picture successfully';
$string['profileiconsetdefaultnotvalid'] = 'Could not set the default profile picture, the choice was not valid'; $string['profileiconsetdefaultnotvalid'] = 'Could not set the default profile picture, the choice was not valid';
...@@ -226,6 +230,7 @@ $string['profileiconuploadexceedsquota'] = 'Uploading this profile picture would ...@@ -226,6 +230,7 @@ $string['profileiconuploadexceedsquota'] = 'Uploading this profile picture would
$string['profileiconimagetoobig'] = 'The picture you uploaded was too big (%sx%s pixels). It must not be larger than %sx%s pixels'; $string['profileiconimagetoobig'] = 'The picture you uploaded was too big (%sx%s pixels). It must not be larger than %sx%s pixels';
$string['uploadingfile'] = 'uploading file...'; $string['uploadingfile'] = 'uploading file...';
$string['uploadprofileicon'] = 'Upload Profile Picture'; $string['uploadprofileicon'] = 'Upload Profile Picture';
$string['uploadedprofileicon'] = 'Uploaded profile picture';
$string['profileiconsiconsizenotice'] = 'You may upload up to <strong>five</strong> profile pictures here, and choose one to be displayed as your default icon at any one time. Your icons must be between 16x16 and %sx%s pixels in size.'; $string['profileiconsiconsizenotice'] = 'You may upload up to <strong>five</strong> profile pictures here, and choose one to be displayed as your default icon at any one time. Your icons must be between 16x16 and %sx%s pixels in size.';
$string['setdefault'] = 'Set Default'; $string['setdefault'] = 'Set Default';
$string['Title'] = 'Title'; $string['Title'] = 'Title';
......
...@@ -124,12 +124,14 @@ class PluginArtefactFile extends PluginArtefact { ...@@ -124,12 +124,14 @@ class PluginArtefactFile extends PluginArtefact {
'confirmdeletefile', 'confirmdeletefile',
'confirmdeletefolder', 'confirmdeletefolder',
'confirmdeletefolderandcontents', 'confirmdeletefolderandcontents',
'defaultprofileicon',
'editfile', 'editfile',
'editfolder', 'editfolder',
'fileappearsinviews', 'fileappearsinviews',
'fileattached', 'fileattached',
'filewithnameexists', 'filewithnameexists',
'folderappearsinviews', 'folderappearsinviews',
'foldercontainsprofileicons',
'foldernamerequired', 'foldernamerequired',
'foldernotempty', 'foldernotempty',
'maxuploadsize', 'maxuploadsize',
...@@ -252,7 +254,7 @@ class PluginArtefactFile extends PluginArtefact { ...@@ -252,7 +254,7 @@ class PluginArtefactFile extends PluginArtefact {
return array( return array(
'file' => array('file'), 'file' => array('file'),
'image' => array('file', 'image'), 'image' => array('file', 'image'),
'profileicon' => array('image'), 'profileicon' => array('file', 'image'),
'archive' => array('file'), 'archive' => array('file'),
); );
} }
...@@ -307,7 +309,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType { ...@@ -307,7 +309,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
// Check if something exists in the db with a given title and parent, // Check if something exists in the db with a given title and parent,
// either in adminfiles or with a specific owner. // either in adminfiles or with a specific owner.
public static function file_exists($title, $owner, $folder, $institution=null, $group=null) { public static function file_exists($title, $owner, $folder, $institution=null, $group=null) {
$filetypesql = "('" . join("','", array_diff(PluginArtefactFile::get_artefact_types(), array('profileicon'))) . "')"; $filetypesql = "('" . join("','", PluginArtefactFile::get_artefact_types()) . "')";
$ownersql = artefact_owner_sql($owner, $group, $institution); $ownersql = artefact_owner_sql($owner, $group, $institution);
return get_field_sql('SELECT a.id FROM {artefact} a return get_field_sql('SELECT a.id FROM {artefact} a
LEFT OUTER JOIN {artefact_file_files} f ON f.artefact = a.id LEFT OUTER JOIN {artefact_file_files} f ON f.artefact = a.id
...@@ -340,21 +342,24 @@ abstract class ArtefactTypeFileBase extends ArtefactType { ...@@ -340,21 +342,24 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
global $USER; global $USER;
$select = ' $select = '
SELECT SELECT
a.id, a.artefacttype, a.mtime, f.size, a.title, a.description, a.locked, a.allowcomments, a.id, a.artefacttype, a.mtime, f.size, a.title, a.description, a.locked, a.allowcomments, u.profileicon AS defaultprofileicon,
COUNT(DISTINCT c.id) AS childcount, COUNT (DISTINCT aa.artefact) AS attachcount, COUNT(DISTINCT va.view) AS viewcount'; COUNT(DISTINCT c.id) AS childcount, COUNT (DISTINCT aa.artefact) AS attachcount, COUNT(DISTINCT va.view) AS viewcount,
COUNT(DISTINCT api.id) AS profileiconcount';
$from = ' $from = '
FROM {artefact} a FROM {artefact} a
LEFT OUTER JOIN {artefact_file_files} f ON f.artefact = a.id LEFT OUTER JOIN {artefact_file_files} f ON f.artefact = a.id
LEFT OUTER JOIN {artefact} c ON c.parent = a.id LEFT OUTER JOIN {artefact} c ON c.parent = a.id
LEFT OUTER JOIN {artefact} api ON api.parent = a.id AND api.artefacttype = \'profileicon\'
LEFT OUTER JOIN {view_artefact} va ON va.artefact = a.id LEFT OUTER JOIN {view_artefact} va ON va.artefact = a.id
LEFT OUTER JOIN {artefact_attachment} aa ON aa.attachment = a.id'; LEFT OUTER JOIN {artefact_attachment} aa ON aa.attachment = a.id
LEFT OUTER JOIN {usr} u ON a.id = u.profileicon AND a.owner = u.id';
if (!empty($filters['artefacttype'])) { if (!empty($filters['artefacttype'])) {
$artefacttypes = $filters['artefacttype']; $artefacttypes = $filters['artefacttype'];
$artefacttypes[] = 'folder'; $artefacttypes[] = 'folder';
} }
else { else {
$artefacttypes = array_diff(PluginArtefactFile::get_artefact_types(), array('profileicon')); $artefacttypes = PluginArtefactFile::get_artefact_types();
} }
$where = " $where = "
WHERE a.artefacttype IN (" . join(',', array_map('db_quote', $artefacttypes)) . ")"; WHERE a.artefacttype IN (" . join(',', array_map('db_quote', $artefacttypes)) . ")";
...@@ -365,7 +370,8 @@ abstract class ArtefactTypeFileBase extends ArtefactType { ...@@ -365,7 +370,8 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
$groupby = ' $groupby = '
GROUP BY GROUP BY
a.id, a.artefacttype, a.mtime, f.size, a.title, a.description, a.locked, a.allowcomments'; a.id, a.artefacttype, a.mtime, f.size, a.title, a.description, a.locked, a.allowcomments,
u.profileicon';
$phvals = array(); $phvals = array();
...@@ -522,7 +528,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType { ...@@ -522,7 +528,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
} }
public static function count_user_files($owner=null, $group=null, $institution=null) { public static function count_user_files($owner=null, $group=null, $institution=null) {
$filetypes = array_diff(PluginArtefactFile::get_artefact_types(), array('profileicon')); $filetypes = PluginArtefactFile::get_artefact_types();
foreach ($filetypes as $k => $v) { foreach ($filetypes as $k => $v) {
if ($v == 'folder') { if ($v == 'folder') {
unset($filetypes[$k]); unset($filetypes[$k]);
...@@ -674,7 +680,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType { ...@@ -674,7 +680,7 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
$taken = get_column_sql(" $taken = get_column_sql("
SELECT title FROM {artefact} SELECT title FROM {artefact}
WHERE artefacttype IN ('" . join("','", array_diff(PluginArtefactFile::get_artefact_types(), array('profileicon'))) . "') WHERE artefacttype IN ('" . join("','", PluginArtefactFile::get_artefact_types()) . "')
AND title LIKE ? || '%' || ? AND " . $where, array($start, $end)); AND title LIKE ? || '%' || ? AND " . $where, array($start, $end));
$taken = array_flip($taken); $taken = array_flip($taken);
......
...@@ -206,16 +206,19 @@ function upload_submit(Pieform $form, $values) { ...@@ -206,16 +206,19 @@ function upload_submit(Pieform $form, $values) {
} }
// Entry in artefact table // Entry in artefact table
$data = (object) array( $data = new stdClass;
'owner' => $USER->id, $data->owner = $USER->id;
'title' => $values['title'] ? $values['title'] : $values['file']['name'], $data->parent = ArtefactTypeFolder::get_folder_id(get_string('imagesdir', 'artefact.file'), get_string('imagesdirdesc', 'artefact.file'), null, true, $USER->id);
'note' => $values['file']['name'], $data->title = $values['title'] ? $values['title'] : $values['file']['name'];
'size' => $filesize, $data->title = ArtefactTypeFileBase::get_new_file_title($data->title, (int)$data->parent, $USER->id); // unique title
); $data->note = $values['file']['name'];
$data->size = $filesize;
$imageinfo = getimagesize($values['file']['tmp_name']); $imageinfo = getimagesize($values['file']['tmp_name']);
$data->width = $imageinfo[0]; $data->width = $imageinfo[0];
$data->height = $imageinfo[1]; $data->height = $imageinfo[1];
$data->filetype = $imageinfo['mime']; $data->filetype = $imageinfo['mime'];
$data->description = get_string('uploadedprofileicon', 'artefact.file');
$artefact = new ArtefactTypeProfileIcon(0, $data); $artefact = new ArtefactTypeProfileIcon(0, $data);
if (preg_match("/\.([^\.]+)$/", $values['file']['name'], $saved)) { if (preg_match("/\.([^\.]+)$/", $values['file']['name'], $saved)) {
$artefact->set('oldextension', $saved[1]); $artefact->set('oldextension', $saved[1]);
......
...@@ -12,10 +12,12 @@ ...@@ -12,10 +12,12 @@
<th><label>{str tag=name}</label></th> <th><label>{str tag=name}</label></th>
<td><input type="text" class="text" name="{$prefix}_edit_title" id="{$prefix}_edit_title" value="{$fileinfo->title}" size="40" /></td> <td><input type="text" class="text" name="{$prefix}_edit_title" id="{$prefix}_edit_title" value="{$fileinfo->title}" size="40" /></td>
</tr> </tr>
{if $fileinfo->artefacttype != 'profileicon'}
<tr> <tr>
<th><label>{str tag=description}</label></th> <th><label>{str tag=description}</label></th>
<td><input type="text" class="text" name="{$prefix}_edit_description" id="{$prefix}_edit_description" value="{$fileinfo->description}" size="40" /></td> <td><input type="text" class="text" name="{$prefix}_edit_description" id="{$prefix}_edit_description" value="{$fileinfo->description}" size="40" /></td>
</tr> </tr>
{/if}
<tr class="tags"> <tr class="tags">
<th><label>{str tag=tags}</label></th> <th><label>{str tag=tags}</label></th>
<td> <td>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<tbody> <tbody>
{foreach from=$filelist item=file} {foreach from=$filelist item=file}
{if !$publishing || !$file->permissions || $file->can_republish}{assign var=publishable value=1}{else}{assign var=publishable value=0}{/if} {if !$publishing || !$file->permissions || $file->can_republish}{assign var=publishable value=1}{else}{assign var=publishable value=0}{/if}
<tr id="file:{$file->id}" class="{cycle values='r0,r1'} directory-item{if $file->isparent} parentfolder{/if}{if $file->artefacttype == 'folder'} folder{/if}{if $highlight && $highlight == $file->id} highlight-file{/if}{if $edit == $file->id} hidden{/if}{if !$publishable && $file->artefacttype != 'folder'} disabled{/if}" {if !$publishable && $file->artefacttype != 'folder'} title="{str tag=notpublishable section=artefact.file}"{/if}> <tr id="file:{$file->id}" class="{cycle values='r0,r1'} directory-item{if $file->isparent} parentfolder{/if}{if $file->artefacttype == 'folder'} folder{elseif $file->artefacttype == 'profileicon'} profileicon{/if}{if $highlight && $highlight == $file->id} highlight-file{/if}{if $edit == $file->id} hidden{/if}{if !$publishable && $file->artefacttype != 'folder'} disabled{/if}" {if !$publishable && $file->artefacttype != 'folder'} title="{str tag=notpublishable section=artefact.file}"{/if}>
<td class="filethumb"> <td class="filethumb">
{if $editable} {if $editable}
<div{if !$file->isparent} class="icon-drag" id="drag:{$file->id}"{/if}> <div{if !$file->isparent} class="icon-drag" id="drag:{$file->id}"{/if}>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
{assign var=displaytitle value=$file->title|str_shorten_text:34|safe} {assign var=displaytitle value=$file->title|str_shorten_text:34|safe}
<tr class="{cycle values='r0,r1'}{if $highlight && $highlight == $file->id} highlight-file{/if}"> <tr class="{cycle values='r0,r1'}{if $highlight && $highlight == $file->id} highlight-file{/if}">
<td class="iconcell"> <td class="iconcell">
<img src="{if $file->artefacttype == 'image'}{$WWWROOT}artefact/file/download.php?file={$file->id}&size=20x20{else}{theme_url filename=images/`$file->artefacttype`.gif}{/if}"> <img src="{if $file->artefacttype == 'image' || $file->artefacttype == 'profileicon'}{$WWWROOT}artefact/file/download.php?file={$file->id}&size=20x20{else}{theme_url filename=images/`$file->artefacttype`.gif}{/if}">
</td> </td>
<td class="valign"> <td class="valign">
{if $selectfolders}{$displaytitle}{else}<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" target="_blank" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}">{$displaytitle}</a>{/if} {if $selectfolders}{$displaytitle}{else}<a href="{$WWWROOT}artefact/file/download.php?file={$file->id}" target="_blank" title="{str tag=downloadfile section=artefact.file arg1=$displaytitle}">{$displaytitle}</a>{/if}
......
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
defined('INTERNAL') || die(); defined('INTERNAL') || die();
$config = new StdClass; $config = new StdClass;
$config->version = 2011052500; $config->version = 2011070700;
$config->release = '1.2.0'; $config->release = '1.2.0';
...@@ -337,8 +337,11 @@ class AuthXmlrpc extends Auth { ...@@ -337,8 +337,11 @@ class AuthXmlrpc extends Auth {
// Entry in artefact table // Entry in artefact table
$artefact = new ArtefactTypeProfileIcon(); $artefact = new ArtefactTypeProfileIcon();
$artefact->set('owner', $user->id); $artefact->set('owner', $user->id);
$artefact->set('title', 'Profile Icon'); $artefact->set('parent', ArtefactTypeFolder::get_folder_id(get_string('imagesdir', 'artefact.file'),
$artefact->set('note', 'Profile Icon'); get_string('imagesdirdesc', 'artefact.file'), null, true, $user->id));
$artefact->set('title', ArtefactTypeFileBase::get_new_file_title(get_string('profileicon', 'artefact.file'), (int)$artefact->get('parent'), $user->id)); // unique title
$artefact->set('description', get_string('uploadedprofileicon', 'artefact.file'));
$artefact->set('note', get_string('profileicon', 'artefact.file'));
$artefact->set('size', $filesize); $artefact->set('size', $filesize);
$artefact->set('filetype', $mime); $artefact->set('filetype', $mime);
$artefact->set('width', $width); $artefact->set('width', $width);
......
...@@ -709,6 +709,7 @@ class HtmlExportOutputFilter { ...@@ -709,6 +709,7 @@ class HtmlExportOutputFilter {
case 'file': case 'file':
case 'folder': case 'folder':
case 'image': case 'image':
case 'profileicon':
case 'archive': case 'archive':
return '<a href="' . $this->get_export_path_for_file($artefact, array()) . '">' . $matches[5] . '</a>'; return '<a href="' . $this->get_export_path_for_file($artefact, array()) . '">' . $matches[5] . '</a>';
default: default:
......
...@@ -294,6 +294,9 @@ tr.highlight td { ...@@ -294,6 +294,9 @@ tr.highlight td {
div.listing { div.listing {
padding: 5px; padding: 5px;
} }
tr.profileicon td.filename {
font-style: italic;
}
/**************************** Pagination ****************************/ /**************************** Pagination ****************************/
div.pagination { div.pagination {
font-size: .9167em; font-size: .9167em;
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
{foreach from=$sbdata.artefacts item=artefact} {foreach from=$sbdata.artefacts item=artefact}
{if $artefact->artefacttype == 'blog'} {if $artefact->artefacttype == 'blog'}
<li><a href="{$WWWROOT}artefact/blog/view/?id={$artefact->id}">{$artefact->title}</a></li> <li><a href="{$WWWROOT}artefact/blog/view/?id={$artefact->id}">{$artefact->title}</a></li>
{elseif $artefact->artefacttype == 'file' || $artefact->artefacttype == 'image' || $artefact->artefacttype == 'archive'} {elseif $artefact->artefacttype == 'file' || $artefact->artefacttype == 'image' || $artefact->artefacttype == 'profileicon' || $artefact->artefacttype == 'archive'}
<li><a href="{$WWWROOT}artefact/file/download.php?file={$artefact->id}">{$artefact->title}</a></li> <li><a href="{$WWWROOT}artefact/file/download.php?file={$artefact->id}">{$artefact->title}</a></li>
{elseif $artefact->artefacttype == 'folder'} {elseif $artefact->artefacttype == 'folder'}
<li><a href="{$WWWROOT}artefact/file/?folder={$artefact->id}">{$artefact->title}</a></li> <li><a href="{$WWWROOT}artefact/file/?folder={$artefact->id}">{$artefact->title}</a></li>
......
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