mirror of
https://github.com/mediacms-io/mediacms.git
synced 2025-12-10 14:02:31 -05:00
Compare commits
3 Commits
v7.2.0
...
c035bcddf5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c035bcddf5 | ||
|
|
01912ea1f9 | ||
|
|
d9f299af4d |
@@ -1 +1 @@
|
||||
VERSION = "7.2.0"
|
||||
VERSION = "7.2.1"
|
||||
|
||||
@@ -178,14 +178,11 @@ class MediaPublishForm(forms.ModelForm):
|
||||
state = cleaned_data.get("state")
|
||||
categories = cleaned_data.get("category")
|
||||
|
||||
if getattr(settings, 'USE_RBAC', False) and 'category' in self.fields:
|
||||
if state in ['private', 'unlisted']:
|
||||
custom_permissions = self.instance.permissions.exists()
|
||||
rbac_categories = categories.filter(is_rbac_category=True).values_list('title', flat=True)
|
||||
|
||||
if rbac_categories and state in ['private', 'unlisted']:
|
||||
# Make the confirm_state field visible and add it to the layout
|
||||
if rbac_categories or custom_permissions:
|
||||
self.fields['confirm_state'].widget = forms.CheckboxInput()
|
||||
|
||||
# add it after the state field
|
||||
state_index = None
|
||||
for i, layout_item in enumerate(self.helper.layout):
|
||||
if isinstance(layout_item, CustomField) and layout_item.fields[0] == 'state':
|
||||
@@ -198,7 +195,11 @@ class MediaPublishForm(forms.ModelForm):
|
||||
self.helper.layout = Layout(*layout_items)
|
||||
|
||||
if not cleaned_data.get('confirm_state'):
|
||||
error_message = f"I understand that although media state is {state}, the media is also shared with users that have access to the following categories: {', '.join(rbac_categories)}"
|
||||
if rbac_categories:
|
||||
error_message = f"I understand that although media state is {state}, the media is also shared with users that have access to categories: {', '.join(rbac_categories)}"
|
||||
self.add_error('confirm_state', error_message)
|
||||
if custom_permissions:
|
||||
error_message = f"I understand that although media state is {state}, the media is also shared by me with other users, that I can see in the 'Shared by me' page"
|
||||
self.add_error('confirm_state', error_message)
|
||||
|
||||
return cleaned_data
|
||||
|
||||
@@ -763,6 +763,8 @@ class Media(models.Model):
|
||||
return helpers.url_from_path(self.uploaded_thumbnail.path)
|
||||
if self.thumbnail:
|
||||
return helpers.url_from_path(self.thumbnail.path)
|
||||
if self.media_type == "audio":
|
||||
return helpers.url_from_path("userlogos/poster_audio.jpg")
|
||||
return None
|
||||
|
||||
@property
|
||||
@@ -776,6 +778,9 @@ class Media(models.Model):
|
||||
return helpers.url_from_path(self.uploaded_poster.path)
|
||||
if self.poster:
|
||||
return helpers.url_from_path(self.poster.path)
|
||||
if self.media_type == "audio":
|
||||
return helpers.url_from_path("userlogos/poster_audio.jpg")
|
||||
|
||||
return None
|
||||
|
||||
@property
|
||||
|
||||
@@ -21,12 +21,16 @@ function downloadOptionsList() {
|
||||
for (g in encodings_info[k]) {
|
||||
if (encodings_info[k].hasOwnProperty(g)) {
|
||||
if ('success' === encodings_info[k][g].status && 100 === encodings_info[k][g].progress && null !== encodings_info[k][g].url) {
|
||||
// Use original media URL for download instead of encoded version
|
||||
const originalUrl = media_data.original_media_url;
|
||||
const originalFilename = originalUrl ? originalUrl.substring(originalUrl.lastIndexOf('/') + 1) : media_data.title;
|
||||
|
||||
optionsList[encodings_info[k][g].title] = {
|
||||
text: k + ' - ' + g.toUpperCase() + ' (' + encodings_info[k][g].size + ')',
|
||||
link: formatInnerLink(encodings_info[k][g].url, SiteContext._currentValue.url),
|
||||
link: formatInnerLink(media_data.original_media_url, SiteContext._currentValue.url),
|
||||
linkAttr: {
|
||||
target: '_blank',
|
||||
download: media_data.title + '_' + k + '_' + g.toUpperCase(),
|
||||
download: originalFilename,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -36,12 +40,16 @@ function downloadOptionsList() {
|
||||
}
|
||||
}
|
||||
|
||||
// Extract actual filename from the original media URL
|
||||
const originalUrl = media_data.original_media_url;
|
||||
const originalFilename = originalUrl ? originalUrl.substring(originalUrl.lastIndexOf('/') + 1) : media_data.title;
|
||||
|
||||
optionsList.original_media_url = {
|
||||
text: 'Original file (' + media_data.size + ')',
|
||||
link: formatInnerLink(media_data.original_media_url, SiteContext._currentValue.url),
|
||||
linkAttr: {
|
||||
target: '_blank',
|
||||
download: media_data.title,
|
||||
download: originalFilename,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -54,6 +54,10 @@ export default class ViewerInfoTitleBanner extends React.PureComponent {
|
||||
? formatInnerLink(MediaPageStore.get('media-original-url'), SiteContext._currentValue.url)
|
||||
: null;
|
||||
|
||||
// Extract actual filename from URL for non-video downloads
|
||||
const originalUrl = MediaPageStore.get('media-original-url');
|
||||
this.downloadFilename = originalUrl ? originalUrl.substring(originalUrl.lastIndexOf('/') + 1) : this.props.title;
|
||||
|
||||
this.updateStateValues = this.updateStateValues.bind(this);
|
||||
}
|
||||
|
||||
@@ -171,7 +175,7 @@ export default class ViewerInfoTitleBanner extends React.PureComponent {
|
||||
.downloadLink ? (
|
||||
<VideoMediaDownloadLink />
|
||||
) : (
|
||||
<OtherMediaDownloadLink link={this.downloadLink} title={this.props.title} />
|
||||
<OtherMediaDownloadLink link={this.downloadLink} title={this.downloadFilename} />
|
||||
)}
|
||||
|
||||
<MediaMoreOptionsIcon allowDownload={this.props.allowDownload} />
|
||||
|
||||
@@ -77,7 +77,7 @@ export default class ViewerInfoVideoTitleBanner extends ViewerInfoTitleBanner {
|
||||
.downloadLink ? (
|
||||
<VideoMediaDownloadLink />
|
||||
) : (
|
||||
<OtherMediaDownloadLink link={this.downloadLink} title={this.props.title} />
|
||||
<OtherMediaDownloadLink link={this.downloadLink} title={this.downloadFilename} />
|
||||
)}
|
||||
|
||||
<MediaMoreOptionsIcon allowDownload={this.props.allowDownload} />
|
||||
|
||||
BIN
media_files/userlogos/poster_audio.jpg
Normal file
BIN
media_files/userlogos/poster_audio.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user