[MEDIA][UI] In case an attachment preview isn't possible, the name is displayed anyway
This commit is contained in:
parent
5f53738376
commit
5961b45140
11
js/util.js
11
js/util.js
@ -965,11 +965,11 @@ var SN = { // StatusNet
|
|||||||
preview = false;
|
preview = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fileentry = $('<li>')
|
||||||
|
.attr('class', 'attachment')
|
||||||
|
.attr('style', 'text-align: center');
|
||||||
if (preview) {
|
if (preview) {
|
||||||
blobAsDataURL(file, function (url) {
|
blobAsDataURL(file, function (url) {
|
||||||
var fileentry = $('<li>')
|
|
||||||
.attr('class', 'attachment')
|
|
||||||
.attr('style', 'text-align: center');
|
|
||||||
var img = $('<img>')
|
var img = $('<img>')
|
||||||
.attr('title', tooltip)
|
.attr('title', tooltip)
|
||||||
.attr('alt', tooltip)
|
.attr('alt', tooltip)
|
||||||
@ -980,8 +980,9 @@ var SN = { // StatusNet
|
|||||||
form.find('.attach-status').append(fileentry);
|
form.find('.attach-status').append(fileentry);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var img = $('<div></div>').text(tooltip);
|
fileentry.append($('<code>' + file.type + '</code>'));
|
||||||
form.find('.attach-status').append(img);
|
fileentry.append($('<br><code>' + file.name + '</code>'));
|
||||||
|
form.find('.attach-status').append(fileentry);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class AttachmentListItem extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
function title() {
|
function title() {
|
||||||
return $this->attachment->getTitle() ?: _('Untitled attachment');
|
return $this->attachment->getTitle() ?: MediaFile::getDisplayName($this->attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
function linkTitle() {
|
function linkTitle() {
|
||||||
|
@ -32,7 +32,7 @@ defined('GNUSOCIAL') || die();
|
|||||||
define('GNUSOCIAL_ENGINE', 'GNU social');
|
define('GNUSOCIAL_ENGINE', 'GNU social');
|
||||||
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
|
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
|
||||||
|
|
||||||
define('GNUSOCIAL_BASE_VERSION', '1.21.1');
|
define('GNUSOCIAL_BASE_VERSION', '1.21.2');
|
||||||
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
|
||||||
|
|
||||||
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
|
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
|
||||||
|
@ -611,9 +611,9 @@ class ImageFile extends MediaFile
|
|||||||
|
|
||||||
return File_thumbnail::saveThumbnail(
|
return File_thumbnail::saveThumbnail(
|
||||||
$this->fileRecord->getID(),
|
$this->fileRecord->getID(),
|
||||||
// no url since we generated it ourselves and can dynamically
|
// no url since we generated it ourselves and can dynamically
|
||||||
// generate the url
|
// generate the url
|
||||||
null,
|
null,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
$outname
|
$outname
|
||||||
|
@ -380,8 +380,7 @@ class MediaFile
|
|||||||
$mimetype = self::getUploadedMimeType($_FILES[$param]['tmp_name'], $_FILES[$param]['name']);
|
$mimetype = self::getUploadedMimeType($_FILES[$param]['tmp_name'], $_FILES[$param]['name']);
|
||||||
$media = common_get_mime_media($mimetype);
|
$media = common_get_mime_media($mimetype);
|
||||||
|
|
||||||
$basename = preg_replace("/\..+$/i", '', basename($_FILES[$param]['name']));
|
$basename = basename($_FILES[$param]['name']);
|
||||||
$ext = File::guessMimeExtension($mimetype, $basename);
|
|
||||||
|
|
||||||
if ($media === 'image') {
|
if ($media === 'image') {
|
||||||
// Use -1 for the id to avoid adding this temporary file to the DB
|
// Use -1 for the id to avoid adding this temporary file to the DB
|
||||||
@ -392,6 +391,11 @@ class MediaFile
|
|||||||
$ext = image_type_to_extension($img->preferredType(), false);
|
$ext = image_type_to_extension($img->preferredType(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have a replacement extension (either from the config or from converting an image)
|
||||||
|
if ($ext !== false) {
|
||||||
|
$basename = preg_replace("/\..+$/i", ".{$ext}", $basename);
|
||||||
|
}
|
||||||
|
|
||||||
// New file name format
|
// New file name format
|
||||||
$original_filename = bin2hex("{$basename}.{$ext}");
|
$original_filename = bin2hex("{$basename}.{$ext}");
|
||||||
$filename = "{$original_filename}-{$filehash}";
|
$filename = "{$original_filename}-{$filehash}";
|
||||||
@ -649,7 +653,7 @@ class MediaFile
|
|||||||
$ret = preg_match('/^[^\.]+\.(.+)$/', $file->filename, $matches);
|
$ret = preg_match('/^[^\.]+\.(.+)$/', $file->filename, $matches);
|
||||||
if ($ret !== 1) {
|
if ($ret !== 1) {
|
||||||
common_log(LOG_ERR, $log_error_msg);
|
common_log(LOG_ERR, $log_error_msg);
|
||||||
throw new ServerException($user_error_msg);
|
return _('Untitled attachment');
|
||||||
}
|
}
|
||||||
$ext = $matches[1];
|
$ext = $matches[1];
|
||||||
// Previously, there was a blacklisted extension array, which could have an alternative
|
// Previously, there was a blacklisted extension array, which could have an alternative
|
||||||
|
Loading…
Reference in New Issue
Block a user