1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Merge branch 'master' into attachments

Conflicts:
	template/javascriptInclude.tpl
This commit is contained in:
Maximilian Mader 2013-10-06 02:12:42 +02:00
commit 06882254a0
14 changed files with 67 additions and 85 deletions

View File

@ -4,7 +4,9 @@ php:
- 5.4
- 5.3
before_install:
- pear config-set auto_discover 1
- pear install pear/PHP_CodeSniffer
- pear install pear.phpunit.de/phpcpd
- phpenv rehash
before_script:
- git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF
@ -15,3 +17,4 @@ before_script:
script:
- find file -type f -name '*.php' |xargs -I file php -l file
- phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" file
- phpcpd --verbose --min-lines 10 file

View File

@ -135,7 +135,7 @@
{foreach from=$objects item=$suspension}
<tr class="jsSuspensionRow" data-object-id="{$suspension->suspensionID}">
<td class="columnIcon">
<span class="icon icon16 icon-undo{if $suspension->expires <= TIME_NOW} disabled{else} pointer{/if} jsRevokeButton" title="{lang}chat.acp.suspension.revoked{/lang}" data-confirm-message="{lang}chat.acp.suspension.revoke.sure{/lang}"></span>
<span class="icon icon16 icon-undo{if $suspension->expires <= TIME_NOW} disabled{else} pointer{/if} jsRevokeButton" title="{lang}chat.acp.suspension.revoke{/lang}" data-confirm-message="{lang}chat.acp.suspension.revoke.sure{/lang}"></span>
{event name='rowButtons'}
</td>
<td id="columnID">{#$suspension->suspensionID}</td>

View File

@ -40,7 +40,7 @@
<dl{if $errorField == 'date'} class="formError"{/if}>
<dt><label for="date">{lang}chat.general.time{/lang}</label></dt>
<dd>
<input id="date" type="date" name="date" value="{$date|date:'Y-m-d'}" />
<input id="date" type="date" name="date" min="{TIME_NOW-CHAT_LOG_ARCHIVETIME*60|date:'Y-m-d'}" max="{TIME_NOW|date:'Y-m-d'}" value="{$date|date:'Y-m-d'}" />
{if $errorField == 'date'}
<small class="innerError">
{lang}chat.acp.log.date.error.{$errorType}{/lang}

View File

@ -75,7 +75,7 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures.
init = (roomID, config, titleTemplate, messageTemplate, userTemplate) ->
return false if initialized
initialized = true
v.config = config
v.titleTemplate = titleTemplate
v.messageTemplate = messageTemplate
@ -93,8 +93,7 @@ When **Tims Chat** becomes focused mark the chat as active and remove the number
When **Tims Chat** loses the focus mark the chat as inactive.
$(window).blur ->
isActive = false
$(window).blur -> isActive = false
Make the user leave the chat when **Tims Chat** is about to be unloaded.
@ -113,13 +112,11 @@ Make the user leave the chat when **Tims Chat** is about to be unloaded.
Insert the appropriate smiley code into the input when a smiley is clicked.
$('#smilies').on 'click', 'img', ->
insertText " #{$(@).attr('alt')} "
$('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} "
Handle private channel menu
$('#privateChannelsMenu').on 'click', '.privateChannel', ->
openPrivateChannel $(@).data 'privateChannelID'
$('#privateChannelsMenu').on 'click', '.privateChannel', -> openPrivateChannel $(@).data 'privateChannelID'
Handle submitting the form. The message will be validated by some basic checks, passed to the `submit` eventlisteners
and afterwards sent to the server by an AJAX request.
@ -132,8 +129,7 @@ and afterwards sent to the server by an AJAX request.
return false if text.length is 0
unless openChannel is 0
text = "/whisper #{userList.allTime[openChannel].username}, #{text}"
text = "/whisper #{userList.allTime[openChannel].username}, #{text}" unless openChannel is 0
# Free the fish!
do freeTheFish if text.toLowerCase() is '/free the fish'
@ -222,8 +218,7 @@ Reset autocompleter to default status, when the input is `click`ed, as the posit
Refresh the room list when the associated button is `click`ed.
$('#timsChatRoomList button').click ->
do refreshRoomList
$('#timsChatRoomList button').click -> do refreshRoomList
Clear the chat by removing every single message once the clear button is `clicked`.
@ -261,7 +256,7 @@ Toggle fullscreen mode.
# Force dropdowns to reorientate
$('.dropdownMenu').data 'orientationX', ''
if $('#timsChatFullscreen').data 'status'
if $(@).data 'status'
$('html').addClass 'fullscreen'
else
$('html').removeClass 'fullscreen'
@ -315,18 +310,18 @@ Scroll down when autoscroll is being activated.
Enable duplicate tab detection.
window.localStorage.setItem 'be.bastelstu.chat.session', chatSession
$(window).on 'storage', (event) ->
if event.originalEvent.key is 'be.bastelstu.chat.session'
if parseInt(event.originalEvent.newValue) isnt chatSession
showError WCF.Language.get 'chat.error.duplicateTab'
try
window.localStorage.setItem 'be.bastelstu.chat.session', chatSession
$(window).on 'storage', (event) ->
if event.originalEvent.key is 'be.bastelstu.chat.session'
showError WCF.Language.get 'chat.error.duplicateTab' unless parseInt(event.originalEvent.newValue) is chatSession
Ask for permissions to use Desktop notifications when notifications are activated.
if window.Notification?
$('#timsChatNotify').click (event) ->
return unless $(@).data 'status'
if window.Notification.permission isnt 'granted'
unless window.Notification.permission is 'granted'
window.Notification.requestPermission (permission) ->
window.Notification.permission ?= permission
@ -682,10 +677,10 @@ Shows an unrecoverable error with the given text.
""").appendTo 'body'
formSubmit = $("""<div class="formSubmit"></div>""").appendTo errorDialog
reloadButton = $("""<button class="buttonPrimary">#{WCF.Language.get 'chat.error.reload'}</button>""").appendTo formSubmit
reloadButton.on 'click', ->
do window.location.reload
reloadButton.on 'click', -> do window.location.reload
$('#timsChatLoadingErrorDialog').wcfDialog
closable: false
title: WCF.Language.get 'wcf.global.error.title'
@ -743,6 +738,7 @@ Open private channel
$('#timsChatMessageContainer0').after div
$('.privateChannel').removeClass 'active'
if userID isnt 0
$('#timsChatTopic').removeClass 'hidden empty'
$('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username}

View File

@ -17,6 +17,11 @@ class SuspensionAction extends \wcf\data\AbstractDatabaseObjectAction {
*/
protected $className = '\chat\data\suspension\SuspensionEditor';
/**
* @see \wcf\data\AbstractDatabaseObjectAction::$requireACP
*/
protected $requireACP = array('revoke');
/**
* Validates permissions and parameters
*/
@ -30,6 +35,7 @@ public function validateRevoke() {
* Revokes suspensions.
*/
public function revoke() {
// TODO: ignore revokes if suspension already is revoked
if (!isset($this->parameters['revoker'])) {
$this->parameters['revoker'] = null;
}

View File

@ -60,7 +60,7 @@ public function executeAction() {
if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, static::SUSPENSION_TYPE)) {
if ($suspension->expires >= $this->expires) {
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.exists'));
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('chat.suspension.exists'));
}
$action = new suspension\SuspensionAction(array($suspension), 'revoke', array(

View File

@ -48,7 +48,7 @@ public function executeAction() {
$action->executeAction();
}
else {
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('wcf.chat.suspension.notExists'));
throw new \wcf\system\exception\UserInputException('text', WCF::getLanguage()->get('chat.suspension.notExists'));
}
}

View File

@ -54,14 +54,19 @@ public function __construct($text, \chat\data\room\Room $room = null) {
* @return array<string>
*/
public static function getAliasMap() {
$result = array();
foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) {
list($key, $val) = explode(':', $line, 2);
try {
$result = array();
foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) {
list($key, $val) = explode(':', $line, 2);
$result[$key] = $val;
}
$result[$key] = $val;
return $result;
}
catch (\wcf\system\exception\SystemException $e) {
throw new \wcf\system\exception\SystemException("Invalid alias specified: '".$line."'");
}
return $result;
}
/**

View File

@ -75,7 +75,7 @@ public function getType() {
* @see \chat\system\command\ICommand::getMessage()
*/
public function getMessage() {
return $this->roomName;
return WCF::getLanguage()->getDynamicVariable('chat.message.temproom.success', array('roomName' => $this->roomName));
}
/**

View File

@ -29,10 +29,6 @@
}
#tplChat {
#main > div {
overflow: hidden;
}
#timsChatTopic {
padding: @wcfGapTiny;
.transition(height, .2s);
@ -45,10 +41,6 @@
border: 0px;
padding: 0px;
margin: 0px;
~ #timsChatMessageContainer {
margin-top: 0;
}
}
.jsTopicCloser {
@ -67,13 +59,13 @@
&.shown {
opacity: 1;
z-index: 130;
~ .timsChatMessageContainer {
margin-left: 35px;
border-top-left-radius: 0;
}
}
> ul {
text-align: right;
@ -84,7 +76,7 @@
}
}
}
> li:last-child {
> .userAvatar.framed {
img, > canvas, > .icon {
@ -92,7 +84,7 @@
}
}
}
> li {
margin-bottom: -1px;
background-color: @wcfContainerBackgroundColor;
@ -109,14 +101,6 @@
&.small {
display: block;
}
&.framed {
> .icon {
background-color: @wcfContentBackgroundColor;
border: 1px solid @wcfContainerBorderColor;
padding: 1px;
}
}
}
&.active {
@ -189,7 +173,7 @@
}
&:nth-child(even) {
> .innerMessageContainer.bubble .innerMessage, .innerMessageContainer.right.bubble .innerMessage {
> .innerMessageContainer.bubble .innerMessage {
background-color: @wcfContainerAccentBackgroundColor;
&:after {
@ -221,7 +205,6 @@
float: right;
}
.username {
font-weight: bold;
}
@ -408,13 +391,14 @@
#timsChatRoomList {
> div {
> div {
margin-top: @wcfGapMedium;
text-align: center;
}
}
}
#smilies {
margin-top: @wcfGapMedium;
li {
.transition(opacity, .2s);
}
@ -424,14 +408,6 @@
opacity: .5;
}
}
margin-top: @wcfGapMedium;
}
@media only screen and (max-width: 800px) {
.timsChatMessage .text li > time, #smilies {
display: none !important;
}
}
#timsChatOptions {
@ -440,17 +416,6 @@
}
}
#toggleRooms .ajaxLoad {
position: absolute;
right: 10px;
top: 7px;
display: none;
}
#timsChatCopyright {
.textShadow(@wcfContentBackgroundColor);
}
#timsChatCopyrightDialog > div {
background-position: right center;
background-repeat: no-repeat;
@ -465,6 +430,12 @@
animation-timing-function: linear;
border-color: @wcfInputHoverBorderColor;
}
@media only screen and (max-width: 800px) {
.timsChatMessage .text li > time, #smilies {
display: none !important;
}
}
}
html.fullscreen {

View File

@ -17,8 +17,10 @@
<item name="chat.acp.suspension.issuer"><![CDATA[Aussteller]]></item>
<item name="chat.acp.suspension.displayRevoked"><![CDATA[Abgelaufene Sanktionen anzeigen]]></item>
<item name="chat.acp.suspension.reason"><![CDATA[Grund]]></item>
<item name="chat.acp.suspension.revoked"><![CDATA[Zurückziehen]]></item>
<item name="chat.acp.suspension.revokedBy"><![CDATA[Zurückgezogen von {$suspension->revokerUsername}]]></item>
<item name="chat.acp.suspension.revoke"><![CDATA[Zurückziehen]]></item>
<item name="chat.acp.suspension.revoke.sure"><![CDATA[Möchten Sie die Sanktion von „{$suspension->username}“ wirklich zurückziehen?]]></item>
<item name="chat.acp.suspension.revoke.success"><![CDATA[Die Sanktion wurde erfolgreich zurückgezogen.]]></item>
<item name="chat.acp.suspension.revokedBy"><![CDATA[Zurückgezogen von „{$suspension->revokerUsername}“]]></item>
</category>
<category name="chat.acp.log">
@ -86,12 +88,11 @@
<item name="wcf.acp.option.chat_lastmessages.description"><![CDATA[Anzahl der Nachrichten, die beim Betreten des Chats angezeigt werden.]]></item>
<item name="wcf.acp.option.chat_display_join_leave"><![CDATA[Join- und Leave-Nachrichten anzeigen]]></item>
<item name="wcf.acp.option.chat_display_join_leave.description"><![CDATA[Soll eine Nachricht angezeigt werden, wenn ein Nutzer den Chat betritt oder verlässt?]]></item>
<item name="wcf.acp.option.chat_max_length"><![CDATA[Maximale Textlänge]]></item>
<item name="wcf.acp.option.chat_max_length"><![CDATA[Maximale Nachrichtenlänge]]></item>
<item name="wcf.acp.option.chat_command_aliases"><![CDATA[Befehls-Aliase]]></item>
<item name="wcf.acp.option.chat_command_aliases.description"><![CDATA[Geben Sie zeilenweise eine Kombination aus Alias und Zielbefehl an. Alias und Zielbefehl werden durch einen Doppelpunkt voneinander getrennt.]]></item>
<item name="wcf.acp.option.category.chat.log"><![CDATA[Protokoll]]></item>
<item name="wcf.acp.option.chat_log_active"><![CDATA[Protokoll aktivieren]]></item>
<item name="wcf.acp.option.chat_log_archivetime"><![CDATA[Speicherzeit]]></item>
<item name="wcf.acp.option.chat_log_archivetime.description"><![CDATA[Zeit, die eine Nachricht im Protokoll abrufbar bleibt. [Zeit in Minuten, -1 für unendlich]]]></item>
</category>
@ -107,6 +108,7 @@
<category name="chat.error">
<item name="chat.error.notFound"><![CDATA[Der Befehl „{$exception->getCommand()}“ wurde nicht gefunden.]]></item>
<item name="chat.error.userNotFound"><![CDATA[Der Benutzer „{$exception->getUsername()}“ wurde nicht gefunden.]]></item>
<item name="chat.error.invalidArgument"><![CDATA[Sie haben falsche Parameter an den Befehl übergeben.]]></item>
<item name="chat.error.permissionDenied"><![CDATA[Sie dürfen diesen Befehl nicht verwenden.]]></item>
<item name="chat.error.duplicateTab"><![CDATA[Sie haben den Chat in einem weiteren Browserfenster geöffnet. Diese Instanz wurde daher zur Vermeidung von Problemen deaktiviert.]]></item>
<item name="chat.error.join"><![CDATA[Es gibt Probleme den gewählten Chatraum zu betreten.]]></item>
@ -188,11 +190,14 @@ Probieren Sie den Chat neu zu laden<!-- , bei Risiken und Nebenwirkungen fragen
<item name="chat.message.5.ungban"><![CDATA[hat {@$link} global entbannt.]]></item>
<item name="chat.message.color.success"><![CDATA[Die Farbe wurde erfolgreich geändert.]]></item>
<item name="chat.message.temproom.success"><![CDATA[Der temporäre Raum „{$roomName}“ wurde erfolgreich erstellt. Laden Sie die Raumliste neu, damit dieser sichtbar wird.]]></item>
</category>
<category name="chat.suspension">
<item name="chat.suspension.mute"><![CDATA[Knebel]]></item>
<item name="chat.suspension.ban"><![CDATA[Bann]]></item>
<item name="chat.suspension.exists"><![CDATA[Es existiert bereits eine längere Sanktion der gleichen Art.]]></item>
<item name="chat.suspension.notExists"><![CDATA[Es existiert keine Sanktion dieser Art.]]></item>
</category>
<!-- I18N Values -->

View File

@ -56,11 +56,6 @@ gunmute:ungmute</defaultvalue>
<!-- general chat options end -->
<!--log options-->
<option name="chat_log_active">
<categoryname>chat.log</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue><![CDATA[1]]></defaultvalue>
</option>
<option name="chat_log_archivetime">
<categoryname>chat.log</categoryname>
<optiontype>integer</optiontype>

View File

@ -1,4 +1,3 @@
{if MODULE_ATTACHMENT}<script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.Attachment{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@$__wcfVersion}"></script>{/if}
<script data-relocate="true" src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script>
<!--script src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.Log{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script-->
{event name='javascript'}

View File

@ -19,7 +19,9 @@
<div>
<ul>
</ul>
<div><button type="button">{lang}chat.general.forceRefresh{/lang}</button></div>
<div class="marginTop">
<button type="button">{lang}chat.general.forceRefresh{/lang}</button>
</div>
</div>
</nav>
</fieldset>