mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30:08 +00:00
Merge remote-tracking branch 'origin/attachment'
This commit is contained in:
commit
146a88813a
@ -79,15 +79,18 @@ public function getMaxCount() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getMaxSize() {
|
||||||
|
return WCF::getSession()->getPermission('user.chat.attachment.maxSize');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getAllowedExtensions() {
|
public function getAllowedExtensions() {
|
||||||
return [ 'png'
|
return \wcf\util\ArrayUtil::trim(\explode("\n", WCF::getSession()->getPermission('user.chat.attachment.allowedExtensions')));
|
||||||
, 'gif'
|
|
||||||
, 'jpg'
|
|
||||||
, 'jpeg'
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,6 @@ define([
|
|||||||
|
|
||||||
super(buttonContainerId, previewContainerId, {
|
super(buttonContainerId, previewContainerId, {
|
||||||
className: 'wcf\\data\\attachment\\AttachmentAction',
|
className: 'wcf\\data\\attachment\\AttachmentAction',
|
||||||
acceptableFiles: ['.png', '.gif', '.jpg', '.jpeg'],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.input = input
|
this.input = input
|
||||||
@ -209,8 +208,11 @@ define([
|
|||||||
* @see WoltLabSuite/Core/Upload#_success
|
* @see WoltLabSuite/Core/Upload#_success
|
||||||
*/
|
*/
|
||||||
_success(uploadId, data, responseText, xhr, requestOptions) {
|
_success(uploadId, data, responseText, xhr, requestOptions) {
|
||||||
if (data.returnValues.errors && data.returnValues.errors[0]) {
|
const target = this._fileElements[uploadId][0]
|
||||||
const error = data.returnValues.errors[0]
|
const progress = target.querySelector(':scope > progress')
|
||||||
|
|
||||||
|
if (data.returnValues.errors && data.returnValues.errors[uploadId]) {
|
||||||
|
const error = data.returnValues.errors[uploadId]
|
||||||
|
|
||||||
elInnerError(
|
elInnerError(
|
||||||
this._button,
|
this._button,
|
||||||
@ -219,6 +221,8 @@ define([
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
progress.remove()
|
||||||
|
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
elInnerError(this._button, '')
|
elInnerError(this._button, '')
|
||||||
@ -237,31 +241,37 @@ define([
|
|||||||
elHide(this.uploadDescription)
|
elHide(this.uploadDescription)
|
||||||
|
|
||||||
const attachment = data.returnValues.attachments[uploadId]
|
const attachment = data.returnValues.attachments[uploadId]
|
||||||
const url =
|
|
||||||
attachment.thumbnailURL || attachment.tinyURL || attachment.url
|
|
||||||
|
|
||||||
if (!url) {
|
if (attachment.isImage) {
|
||||||
throw new Error('Missing image URL')
|
const url =
|
||||||
}
|
attachment.thumbnailURL || attachment.tinyURL || attachment.url
|
||||||
|
|
||||||
const target = this._fileElements[uploadId][0]
|
if (!url) {
|
||||||
const progress = target.querySelector(':scope > progress')
|
throw new Error('Missing image URL')
|
||||||
|
}
|
||||||
|
|
||||||
const img = document.createElement('img')
|
const img = document.createElement('img')
|
||||||
img.setAttribute('src', url)
|
img.setAttribute('src', url)
|
||||||
img.setAttribute('alt', '')
|
img.setAttribute('alt', '')
|
||||||
|
|
||||||
if (url === attachment.tinyURL) {
|
if (url === attachment.tinyURL) {
|
||||||
img.classList.add('attachmentTinyThumbnail')
|
img.classList.add('attachmentTinyThumbnail')
|
||||||
|
} else {
|
||||||
|
img.classList.add('attachmentThumbnail')
|
||||||
|
}
|
||||||
|
|
||||||
|
img.dataset.width = attachment.width
|
||||||
|
img.dataset.height = attachment.height
|
||||||
|
|
||||||
|
DomUtil.replaceElement(progress, img)
|
||||||
} else {
|
} else {
|
||||||
img.classList.add('attachmentThumbnail')
|
const anchor = document.createElement('a')
|
||||||
|
anchor.setAttribute('href', attachment.url)
|
||||||
|
anchor.innerText = attachment.filename
|
||||||
|
|
||||||
|
DomUtil.replaceElement(progress, anchor)
|
||||||
}
|
}
|
||||||
|
|
||||||
img.dataset.width = attachment.width
|
|
||||||
img.dataset.height = attachment.height
|
|
||||||
|
|
||||||
DomUtil.replaceElement(progress, img)
|
|
||||||
|
|
||||||
this.createButtons(uploadId, attachment.attachmentID, this.tmpHash)
|
this.createButtons(uploadId, attachment.attachmentID, this.tmpHash)
|
||||||
|
|
||||||
Dialog.rebuild(DIALOG_CONTAINER_ID)
|
Dialog.rebuild(DIALOG_CONTAINER_ID)
|
||||||
|
@ -199,6 +199,9 @@
|
|||||||
<item name="wcf.acp.group.option.mod.chat.canMute.description"><![CDATA[Achtung: Diese Berechtigung kann nicht über Raumspezifische Rechte entzogen werden.]]></item>
|
<item name="wcf.acp.group.option.mod.chat.canMute.description"><![CDATA[Achtung: Diese Berechtigung kann nicht über Raumspezifische Rechte entzogen werden.]]></item>
|
||||||
<item name="wcf.acp.group.option.mod.chat.canTeam"><![CDATA[Kann Teamnachrichten versenden]]></item>
|
<item name="wcf.acp.group.option.mod.chat.canTeam"><![CDATA[Kann Teamnachrichten versenden]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canAttach"><![CDATA[Kann Dateianhänge hochladen]]></item>
|
<item name="wcf.acp.group.option.user.chat.canAttach"><![CDATA[Kann Dateianhänge hochladen]]></item>
|
||||||
|
<item name="wcf.acp.group.option.user.chat.attachment.maxSize"><![CDATA[Maximale Dateianhangsgröße]]></item>
|
||||||
|
<item name="wcf.acp.group.option.user.chat.attachment.allowedExtensions"><![CDATA[Erlaubte Dateiendungen]]></item>
|
||||||
|
<item name="wcf.acp.group.option.user.chat.attachment.allowedExtensions.description"><![CDATA[Eine Dateiendung pro Zeile]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canSee"><![CDATA[Kann Chaträume sehen]]></item>
|
<item name="wcf.acp.group.option.user.chat.canSee"><![CDATA[Kann Chaträume sehen]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canSeeLog"><![CDATA[Kann das Protokoll sehen]]></item>
|
<item name="wcf.acp.group.option.user.chat.canSeeLog"><![CDATA[Kann das Protokoll sehen]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canSetColor"><![CDATA[Kann den Benutzernamen färben]]></item>
|
<item name="wcf.acp.group.option.user.chat.canSetColor"><![CDATA[Kann den Benutzernamen färben]]></item>
|
||||||
|
@ -199,6 +199,9 @@
|
|||||||
<item name="wcf.acp.group.option.mod.chat.canMute.description"><![CDATA[Note: If this permission is granted it cannot be revoked in the room specific permissions.]]></item>
|
<item name="wcf.acp.group.option.mod.chat.canMute.description"><![CDATA[Note: If this permission is granted it cannot be revoked in the room specific permissions.]]></item>
|
||||||
<item name="wcf.acp.group.option.mod.chat.canTeam"><![CDATA[Can use team internal messages]]></item>
|
<item name="wcf.acp.group.option.mod.chat.canTeam"><![CDATA[Can use team internal messages]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canAttach"><![CDATA[Can upload attachments]]></item>
|
<item name="wcf.acp.group.option.user.chat.canAttach"><![CDATA[Can upload attachments]]></item>
|
||||||
|
<item name="wcf.acp.group.option.user.chat.attachment.maxSize"><![CDATA[Maximum Attachment File Size]]></item>
|
||||||
|
<item name="wcf.acp.group.option.user.chat.attachment.allowedExtensions"><![CDATA[Allowed Attachment File Extensions]]></item>
|
||||||
|
<item name="wcf.acp.group.option.user.chat.attachment.allowedExtensions.description"><![CDATA[Enter one extension per line.]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canSee"><![CDATA[Can see chat rooms]]></item>
|
<item name="wcf.acp.group.option.user.chat.canSee"><![CDATA[Can see chat rooms]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canSeeLog"><![CDATA[Can see chat log]]></item>
|
<item name="wcf.acp.group.option.user.chat.canSeeLog"><![CDATA[Can see chat log]]></item>
|
||||||
<item name="wcf.acp.group.option.user.chat.canSetColor"><![CDATA[Can choose to color their name]]></item>
|
<item name="wcf.acp.group.option.user.chat.canSetColor"><![CDATA[Can choose to color their name]]></item>
|
||||||
|
@ -55,6 +55,21 @@
|
|||||||
<defaultvalue>1</defaultvalue>
|
<defaultvalue>1</defaultvalue>
|
||||||
<usersonly>1</usersonly>
|
<usersonly>1</usersonly>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="user.chat.attachment.maxSize">
|
||||||
|
<categoryname>user.chat</categoryname>
|
||||||
|
<optiontype>fileSize</optiontype>
|
||||||
|
<defaultvalue>2000000</defaultvalue>
|
||||||
|
<minvalue>10000</minvalue>
|
||||||
|
</option>
|
||||||
|
<option name="user.chat.attachment.allowedExtensions">
|
||||||
|
<categoryname>user.chat</categoryname>
|
||||||
|
<optiontype>textarea</optiontype>
|
||||||
|
<defaultvalue>gif
|
||||||
|
jpg
|
||||||
|
jpeg
|
||||||
|
png</defaultvalue>
|
||||||
|
<wildcard>*</wildcard>
|
||||||
|
</option>
|
||||||
<option name="user.chat.disallowedBBCodes">
|
<option name="user.chat.disallowedBBCodes">
|
||||||
<categoryname>user.chat</categoryname>
|
<categoryname>user.chat</categoryname>
|
||||||
<optiontype>BBCodeSelect</optiontype>
|
<optiontype>BBCodeSelect</optiontype>
|
||||||
|
Loading…
Reference in New Issue
Block a user