diff --git a/file/acp/be.bastelstu.wcf.chat.update.php b/file/acp/be.bastelstu.wcf.chat.update.php index d99b0a9..29de06f 100644 --- a/file/acp/be.bastelstu.wcf.chat.update.php +++ b/file/acp/be.bastelstu.wcf.chat.update.php @@ -40,8 +40,7 @@ public function execute() { 'roomID' => $room->roomID, 'time' => TIME_NOW, 'type' => \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION, - // TODO: Language item - 'message' => 'Tims Chat was updated. Please refresh the page.' + 'message' => \wcf\system\WCF::getLanguage()->get('wcf.chat.information.chatUpdate') ) )); $messageAction->executeAction(); diff --git a/file/lib/data/chat/message/ChatMessage.class.php b/file/lib/data/chat/message/ChatMessage.class.php index 22ec700..9e62a2b 100755 --- a/file/lib/data/chat/message/ChatMessage.class.php +++ b/file/lib/data/chat/message/ChatMessage.class.php @@ -59,8 +59,13 @@ public function getFormattedMessage($outputType = 'text/html') { WCF::getTPL()->assign(@unserialize($message)); $message = WCF::getLanguage()->getDynamicVariable('wcf.chat.message.'.$this->type); break; - case self::TYPE_WHISPER: + case self::TYPE_MODERATE: $message = @unserialize($message); + WCF::getTPL()->assign($message); + $message = WCF::getLanguage()->getDynamicVariable('wcf.chat.message.'.$this->type.'.'.$message['type']); + break; + case self::TYPE_WHISPER: + $message = $message['message']; case self::TYPE_NORMAL: case self::TYPE_ME: @@ -112,7 +117,7 @@ public function jsonify($raw = false) { 'formattedUsername' => $this->getFormattedUsername(), 'formattedMessage' => (string) $this, 'formattedTime' => \wcf\util\DateUtil::format(\wcf\util\DateUtil::getDateTimeByTimestamp($this->time), 'H:i:s'), - 'separator' => ($this->type == self::TYPE_NORMAL) ? ': ' : ' ', + 'separator' => ($this->type == self::TYPE_NORMAL || $this->type == self::TYPE_ERROR || $this->type == self::TYPE_INFORMATION) ? ': ' : ' ', 'message' => $this->getFormattedMessage('text/plain'), 'sender' => (int) $this->sender, 'username' => $this->getUsername(), diff --git a/file/lib/form/ChatForm.class.php b/file/lib/form/ChatForm.class.php index 4b64369..546a75c 100644 --- a/file/lib/form/ChatForm.class.php +++ b/file/lib/form/ChatForm.class.php @@ -148,22 +148,23 @@ public function save() { $receiver = $command->getReceiver(); } catch (\wcf\system\chat\command\NotFoundException $e) { - $this->message = WCF::getLanguage()->get('wcf.chat.command.error.notFound'); + $this->message = WCF::getLanguage()->get('wcf.chat.error.notFound'); $type = chat\message\ChatMessage::TYPE_ERROR; $receiver = WCF::getUser()->userID; } catch (\wcf\system\chat\command\UserNotFoundException $e) { - $this->message = WCF::getLanguage()->get('wcf.chat.command.error.userNotFound'); + $this->message = WCF::getLanguage()->getDynamicVariable('wcf.chat.error.userNotFound', array('username' => $e->getUsername())); $type = chat\message\ChatMessage::TYPE_ERROR; $receiver = WCF::getUser()->userID; + $this->enableHTML = 1; } catch (\wcf\system\exception\PermissionDeniedException $e) { - $this->message = WCF::getLanguage()->get('wcf.chat.command.error.permissionDenied'); + $this->message = WCF::getLanguage()->get('wcf.chat.error.permissionDenied'); $type = chat\message\ChatMessage::TYPE_ERROR; $receiver = WCF::getUser()->userID; } catch (\Exception $e) { - $this->message = WCF::getLanguage()->get('wcf.chat.command.error.exception'); + $this->message = WCF::getLanguage()->get('wcf.chat.error.exception'); $type = chat\message\ChatMessage::TYPE_ERROR; $receiver = WCF::getUser()->userID; } diff --git a/file/lib/system/chat/command/commands/RestoreCommand.class.php b/file/lib/system/chat/command/commands/RestoreCommand.class.php index 1ef6bda..79d4ce7 100644 --- a/file/lib/system/chat/command/commands/RestoreCommand.class.php +++ b/file/lib/system/chat/command/commands/RestoreCommand.class.php @@ -31,7 +31,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand $profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array( 'object' => $this->user )); - $this->link = ''.ChatUtil::gradient($this->user->username, $color[1], $color[2]).''; + $this->link = ''.ChatUtil::gradient($this->user->username, $color[1], $color[2]).''; $this->didInit(); } @@ -40,7 +40,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand * @see \wcf\system\chat\command\IRestrictedChatCommand::checkPermission() */ public function checkPermission() { - parent::checkPermissions(); + parent::checkPermission(); WCF::getSession()->checkPermissions(array('mod.chat.canRestore')); } @@ -49,13 +49,16 @@ public function checkPermission() { * @see \wcf\system\chat\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE; } /** * @see \wcf\system\chat\command\ICommand::getMessage() */ public function getMessage() { - return 'restored '.$this->link; + return serialize(array( + 'link' => $this->link, + 'type' => str_replace(array('wcf\system\chat\command\commands\\', 'command'), '', strtolower(get_class($this))) + )); } } diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index 9c4dae3..d1eb37a 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -29,7 +29,7 @@ min-height: 16px; clear: both; - time { + time:first-child { font-size: .8em; &::before, &::after { font-size: .8em; diff --git a/language/de.xml b/language/de.xml index e6013b3..32c042e 100644 --- a/language/de.xml +++ b/language/de.xml @@ -86,6 +86,15 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die + + + + + + + + + @@ -97,6 +106,10 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die + + + +