1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10: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.4
- 5.3 - 5.3
before_install: before_install:
- pear config-set auto_discover 1
- pear install pear/PHP_CodeSniffer - pear install pear/PHP_CodeSniffer
- pear install pear.phpunit.de/phpcpd
- phpenv rehash - phpenv rehash
before_script: before_script:
- git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF - git clone --branch=master --depth=1 --quiet git://github.com/WoltLab/WCF.git WCF
@ -15,3 +17,4 @@ before_script:
script: script:
- find file -type f -name '*.php' |xargs -I file php -l file - find file -type f -name '*.php' |xargs -I file php -l file
- phpcs -p --extensions=php --standard="`pwd`/WCF/CodeSniff/WCF" 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} {foreach from=$objects item=$suspension}
<tr class="jsSuspensionRow" data-object-id="{$suspension->suspensionID}"> <tr class="jsSuspensionRow" data-object-id="{$suspension->suspensionID}">
<td class="columnIcon"> <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'} {event name='rowButtons'}
</td> </td>
<td id="columnID">{#$suspension->suspensionID}</td> <td id="columnID">{#$suspension->suspensionID}</td>

View File

@ -40,7 +40,7 @@
<dl{if $errorField == 'date'} class="formError"{/if}> <dl{if $errorField == 'date'} class="formError"{/if}>
<dt><label for="date">{lang}chat.general.time{/lang}</label></dt> <dt><label for="date">{lang}chat.general.time{/lang}</label></dt>
<dd> <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'} {if $errorField == 'date'}
<small class="innerError"> <small class="innerError">
{lang}chat.acp.log.date.error.{$errorType}{/lang} {lang}chat.acp.log.date.error.{$errorType}{/lang}

View File

@ -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. When **Tims Chat** loses the focus mark the chat as inactive.
$(window).blur -> $(window).blur -> isActive = false
isActive = false
Make the user leave the chat when **Tims Chat** is about to be unloaded. 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. Insert the appropriate smiley code into the input when a smiley is clicked.
$('#smilies').on 'click', 'img', -> $('#smilies').on 'click', 'img', -> insertText " #{$(@).attr('alt')} "
insertText " #{$(@).attr('alt')} "
Handle private channel menu Handle private channel menu
$('#privateChannelsMenu').on 'click', '.privateChannel', -> $('#privateChannelsMenu').on 'click', '.privateChannel', -> openPrivateChannel $(@).data 'privateChannelID'
openPrivateChannel $(@).data 'privateChannelID'
Handle submitting the form. The message will be validated by some basic checks, passed to the `submit` eventlisteners 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. 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 return false if text.length is 0
unless openChannel is 0 text = "/whisper #{userList.allTime[openChannel].username}, #{text}" unless openChannel is 0
text = "/whisper #{userList.allTime[openChannel].username}, #{text}"
# Free the fish! # Free the fish!
do freeTheFish if text.toLowerCase() is '/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. Refresh the room list when the associated button is `click`ed.
$('#timsChatRoomList button').click -> $('#timsChatRoomList button').click -> do refreshRoomList
do refreshRoomList
Clear the chat by removing every single message once the clear button is `clicked`. 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 # Force dropdowns to reorientate
$('.dropdownMenu').data 'orientationX', '' $('.dropdownMenu').data 'orientationX', ''
if $('#timsChatFullscreen').data 'status' if $(@).data 'status'
$('html').addClass 'fullscreen' $('html').addClass 'fullscreen'
else else
$('html').removeClass 'fullscreen' $('html').removeClass 'fullscreen'
@ -315,18 +310,18 @@ Scroll down when autoscroll is being activated.
Enable duplicate tab detection. Enable duplicate tab detection.
try
window.localStorage.setItem 'be.bastelstu.chat.session', chatSession window.localStorage.setItem 'be.bastelstu.chat.session', chatSession
$(window).on 'storage', (event) -> $(window).on 'storage', (event) ->
if event.originalEvent.key is 'be.bastelstu.chat.session' if event.originalEvent.key is 'be.bastelstu.chat.session'
if parseInt(event.originalEvent.newValue) isnt chatSession showError WCF.Language.get 'chat.error.duplicateTab' unless parseInt(event.originalEvent.newValue) is chatSession
showError WCF.Language.get 'chat.error.duplicateTab'
Ask for permissions to use Desktop notifications when notifications are activated. Ask for permissions to use Desktop notifications when notifications are activated.
if window.Notification? if window.Notification?
$('#timsChatNotify').click (event) -> $('#timsChatNotify').click (event) ->
return unless $(@).data 'status' return unless $(@).data 'status'
if window.Notification.permission isnt 'granted' unless window.Notification.permission is 'granted'
window.Notification.requestPermission (permission) -> window.Notification.requestPermission (permission) ->
window.Notification.permission ?= permission window.Notification.permission ?= permission
@ -682,9 +677,9 @@ Shows an unrecoverable error with the given text.
""").appendTo 'body' """).appendTo 'body'
formSubmit = $("""<div class="formSubmit"></div>""").appendTo errorDialog formSubmit = $("""<div class="formSubmit"></div>""").appendTo errorDialog
reloadButton = $("""<button class="buttonPrimary">#{WCF.Language.get 'chat.error.reload'}</button>""").appendTo formSubmit reloadButton = $("""<button class="buttonPrimary">#{WCF.Language.get 'chat.error.reload'}</button>""").appendTo formSubmit
reloadButton.on 'click', -> reloadButton.on 'click', -> do window.location.reload
do window.location.reload
$('#timsChatLoadingErrorDialog').wcfDialog $('#timsChatLoadingErrorDialog').wcfDialog
closable: false closable: false
@ -743,6 +738,7 @@ Open private channel
$('#timsChatMessageContainer0').after div $('#timsChatMessageContainer0').after div
$('.privateChannel').removeClass 'active' $('.privateChannel').removeClass 'active'
if userID isnt 0 if userID isnt 0
$('#timsChatTopic').removeClass 'hidden empty' $('#timsChatTopic').removeClass 'hidden empty'
$('#timsChatTopic > .topic').text WCF.Language.get 'chat.general.privateChannelTopic', {username: userList.allTime[userID].username} $('#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'; protected $className = '\chat\data\suspension\SuspensionEditor';
/**
* @see \wcf\data\AbstractDatabaseObjectAction::$requireACP
*/
protected $requireACP = array('revoke');
/** /**
* Validates permissions and parameters * Validates permissions and parameters
*/ */
@ -30,6 +35,7 @@ public function validateRevoke() {
* Revokes suspensions. * Revokes suspensions.
*/ */
public function revoke() { public function revoke() {
// TODO: ignore revokes if suspension already is revoked
if (!isset($this->parameters['revoker'])) { if (!isset($this->parameters['revoker'])) {
$this->parameters['revoker'] = null; $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 = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $room, static::SUSPENSION_TYPE)) {
if ($suspension->expires >= $this->expires) { 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( $action = new suspension\SuspensionAction(array($suspension), 'revoke', array(

View File

@ -48,7 +48,7 @@ public function executeAction() {
$action->executeAction(); $action->executeAction();
} }
else { 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,6 +54,7 @@ public function __construct($text, \chat\data\room\Room $room = null) {
* @return array<string> * @return array<string>
*/ */
public static function getAliasMap() { public static function getAliasMap() {
try {
$result = array(); $result = array();
foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) { foreach (explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CHAT_COMMAND_ALIASES))) as $line) {
list($key, $val) = explode(':', $line, 2); list($key, $val) = explode(':', $line, 2);
@ -63,6 +64,10 @@ public static function getAliasMap() {
return $result; return $result;
} }
catch (\wcf\system\exception\SystemException $e) {
throw new \wcf\system\exception\SystemException("Invalid alias specified: '".$line."'");
}
}
/** /**
* Checks whether the given text is a command. * Checks whether the given text is a command.

View File

@ -75,7 +75,7 @@ public function getType() {
* @see \chat\system\command\ICommand::getMessage() * @see \chat\system\command\ICommand::getMessage()
*/ */
public function 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 { #tplChat {
#main > div {
overflow: hidden;
}
#timsChatTopic { #timsChatTopic {
padding: @wcfGapTiny; padding: @wcfGapTiny;
.transition(height, .2s); .transition(height, .2s);
@ -45,10 +41,6 @@
border: 0px; border: 0px;
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
~ #timsChatMessageContainer {
margin-top: 0;
}
} }
.jsTopicCloser { .jsTopicCloser {
@ -109,14 +101,6 @@
&.small { &.small {
display: block; display: block;
} }
&.framed {
> .icon {
background-color: @wcfContentBackgroundColor;
border: 1px solid @wcfContainerBorderColor;
padding: 1px;
}
}
} }
&.active { &.active {
@ -189,7 +173,7 @@
} }
&:nth-child(even) { &:nth-child(even) {
> .innerMessageContainer.bubble .innerMessage, .innerMessageContainer.right.bubble .innerMessage { > .innerMessageContainer.bubble .innerMessage {
background-color: @wcfContainerAccentBackgroundColor; background-color: @wcfContainerAccentBackgroundColor;
&:after { &:after {
@ -221,7 +205,6 @@
float: right; float: right;
} }
.username { .username {
font-weight: bold; font-weight: bold;
} }
@ -408,13 +391,14 @@
#timsChatRoomList { #timsChatRoomList {
> div { > div {
> div { > div {
margin-top: @wcfGapMedium;
text-align: center; text-align: center;
} }
} }
} }
#smilies { #smilies {
margin-top: @wcfGapMedium;
li { li {
.transition(opacity, .2s); .transition(opacity, .2s);
} }
@ -424,14 +408,6 @@
opacity: .5; opacity: .5;
} }
} }
margin-top: @wcfGapMedium;
}
@media only screen and (max-width: 800px) {
.timsChatMessage .text li > time, #smilies {
display: none !important;
}
} }
#timsChatOptions { #timsChatOptions {
@ -440,17 +416,6 @@
} }
} }
#toggleRooms .ajaxLoad {
position: absolute;
right: 10px;
top: 7px;
display: none;
}
#timsChatCopyright {
.textShadow(@wcfContentBackgroundColor);
}
#timsChatCopyrightDialog > div { #timsChatCopyrightDialog > div {
background-position: right center; background-position: right center;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -465,6 +430,12 @@
animation-timing-function: linear; animation-timing-function: linear;
border-color: @wcfInputHoverBorderColor; border-color: @wcfInputHoverBorderColor;
} }
@media only screen and (max-width: 800px) {
.timsChatMessage .text li > time, #smilies {
display: none !important;
}
}
} }
html.fullscreen { html.fullscreen {

View File

@ -17,8 +17,10 @@
<item name="chat.acp.suspension.issuer"><![CDATA[Aussteller]]></item> <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.displayRevoked"><![CDATA[Abgelaufene Sanktionen anzeigen]]></item>
<item name="chat.acp.suspension.reason"><![CDATA[Grund]]></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.revoke"><![CDATA[Zurückziehen]]></item>
<item name="chat.acp.suspension.revokedBy"><![CDATA[Zurückgezogen von {$suspension->revokerUsername}]]></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>
<category name="chat.acp.log"> <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_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"><![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_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"><![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.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.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"><![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> <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> </category>
@ -107,6 +108,7 @@
<category name="chat.error"> <category name="chat.error">
<item name="chat.error.notFound"><![CDATA[Der Befehl „{$exception->getCommand()}“ wurde nicht gefunden.]]></item> <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.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.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.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> <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.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.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>
<category name="chat.suspension"> <category name="chat.suspension">
<item name="chat.suspension.mute"><![CDATA[Knebel]]></item> <item name="chat.suspension.mute"><![CDATA[Knebel]]></item>
<item name="chat.suspension.ban"><![CDATA[Bann]]></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> </category>
<!-- I18N Values --> <!-- I18N Values -->

View File

@ -56,11 +56,6 @@ gunmute:ungmute</defaultvalue>
<!-- general chat options end --> <!-- general chat options end -->
<!--log options--> <!--log options-->
<option name="chat_log_active">
<categoryname>chat.log</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue><![CDATA[1]]></defaultvalue>
</option>
<option name="chat_log_archivetime"> <option name="chat_log_archivetime">
<categoryname>chat.log</categoryname> <categoryname>chat.log</categoryname>
<optiontype>integer</optiontype> <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} {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 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'} {event name='javascript'}

View File

@ -19,7 +19,9 @@
<div> <div>
<ul> <ul>
</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> </div>
</nav> </nav>
</fieldset> </fieldset>