* @see WCF.Action.Delete._success()
*/
_success: function(data, textStatus, jqXHR) {
- this.triggerEffect([ data.returnValues.userID ]);
+ var $userID = data.returnValues.userID;
+
+ for (var $index in this._containers) {
+ var $container = $('#' + this._containers[$index]);
+ if ($container.find('.jsDeleteButton').data('objectID') == $userID) {
+ $container.find('.userLink').addClass('conversationLeft');
+ $container.find('.jsDeleteButton').remove();
+ }
+ }
}
});
UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'unreadConversationCount');
}
+ // add modification log entry
+ if ($this->parameters['hideConversation'] == Conversation::STATE_LEFT) {
+ if (empty($this->objects)) $this->readObjects();
+
+ foreach ($this->objects as $conversation) {
+ ConversationModificationLogHandler::getInstance()->leave($conversation->getDecoratedObject());
+ }
+ }
+
// unmark items
$this->unmarkItems();
* @param integer $userID
*/
public function removeParticipant($userID) {
- $sql = "DELETE FROM wcf".WCF_N."_conversation_to_user
- WHERE conversationID = ?
- AND participantID = ?";
+ $sql = "UPDATE wcf".WCF_N."_conversation_to_user
+ SET hideConversation = ?
+ WHERE conversationID = ?
+ AND participantID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(
+ 2,
$this->conversationID,
$userID
));
* @see wcf\data\DatabaseObjectList::readObjects()
*/
public function readObjects() {
- $sql = "SELECT modification_log.*
- FROM wcf".WCF_N."_modification_log modification_log
- WHERE modification_log.objectTypeID = ?
- AND modification_log.objectID = ?
- ".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
+ $sql = "SELECT user_avatar.*,
+ user_table.email, user_table.enableGravatar, user_table.disableAvatar,
+ modification_log.*
+ FROM wcf".WCF_N."_modification_log modification_log
+ LEFT JOIN wcf".WCF_N."_user user_table ON (user_table.userID = modification_log.userID)
+ LEFT JOIN wcf".WCF_N."_user_avatar user_avatar ON (user_avatar.avatarID = user_table.avatarID)
+ WHERE modification_log.objectTypeID = ?
+ AND modification_log.objectID = ?
+ ".(!empty($this->sqlOrderBy) ? "ORDER BY ".$this->sqlOrderBy : '');
$statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute(array(
$this->conversationObjectTypeID,
<?php
namespace wcf\data\modification\log;
+use wcf\data\user\User;
+use wcf\data\user\UserProfile;
use wcf\data\DatabaseObjectDecorator;
use wcf\system\WCF;
*/
protected static $baseClass = 'wcf\data\modification\log\ModificationLog';
+ /**
+ * user profile object
+ * @var wcf\data\user\UserProfile
+ */
+ protected $userProfile = null;
+
/**
* Returns readable representation of current log entry.
*/
public function __toString() {
return WCF::getLanguage()->getDynamicVariable('wcf.conversation.log.conversation.'.$this->action, array('additionalData' => $this->additionalData));
}
+
+ /**
+ * Returns the profile object of the user who created the modification entry.
+ *
+ * @return wcf\data\user\UserProfile
+ */
+ public function getUserProfile() {
+ if ($this->userProfile === null) {
+ $this->userProfile = new UserProfile(new User(null, $this->getDecoratedObject()->data));
+ }
+
+ return $this->userProfile;
+ }
}
+++ /dev/null
-<?php
-namespace wcf\page;
-use wcf\data\conversation\Conversation;
-use wcf\system\breadcrumb\Breadcrumb;
-use wcf\system\exception\IllegalLinkException;
-use wcf\system\exception\PermissionDeniedException;
-use wcf\system\request\LinkHandler;
-use wcf\system\WCF;
-
-/**
- * Shows the conversation log page.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf.conversation
- * @subpackage page
- * @category Community Framework
- */
-class ConversationLogPage extends SortablePage {
- /**
- * conversation id
- * @var integer
- */
- public $conversationID = 0;
-
- /**
- * conversation object
- * @var wcf\data\conversation\Conversation
- */
- public $conversation = null;
-
- /**
- * @see wcf\page\SortablePage::$defaultSortField
- */
- public $defaultSortField = 'time';
-
- /**
- * @see wcf\page\SortablePage::$defaultSortOrder
- */
- public $defaultSortOrder = 'DESC';
-
- /**
- * @see wcf\page\MultipleLinkPage::$objectListClassName
- */
- public $objectListClassName = 'wcf\data\modification\log\ConversationLogModificationLogList';
-
- /**
- * @see wcf\page\SortablePage::$validSortFields
- */
- public $validSortFields = array('logID', 'time', 'username');
-
- /**
- * @see wcf\page\IPage::readParameters()
- */
- public function readParameters() {
- parent::readParameters();
-
- if (isset($_REQUEST['id'])) $this->conversationID = intval($_REQUEST['id']);
- $this->conversation = new Conversation($this->conversationID);
- if (!$this->conversation->conversationID) {
- throw new IllegalLinkException();
- }
-
- if (!Conversation::isParticipant(array($this->conversation->conversationID))) {
- throw new PermissionDeniedException();
- }
- }
-
- /**
- * @see wcf\page\MultipleLinkPage::initObjectList()
- */
- protected function initObjectList() {
- parent::initObjectList();
-
- $this->objectList->setConversation($this->conversation);
- }
-
- /**
- * @see wcf\page\IPage::readData()
- */
- public function readData() {
- parent::readData();
-
- // add breadcrumbs
- WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
- WCF::getBreadcrumbs()->add($this->conversation->getBreadcrumb());
- }
-
- /**
- * @see wcf\page\IPage::assignVariables()
- */
- public function assignVariables() {
- parent::assignVariables();
-
- WCF::getTPL()->assign(array(
- 'conversation' => $this->conversation
- ));
- }
-}
$this->add($conversation, 'open');
}
+ /**
+ * Adds a log entry for conversation leave.
+ *
+ * @param wcf\data\conversation\Conversation $conversation
+ */
+ public function leave(Conversation $conversation) {
+ $this->add($conversation, 'leave');
+ }
+
/**
* Adds a log entry for a removed participant.
*
</category>
<category name="wcf.conversation.log">
- <item name="wcf.conversation.log"><![CDATA[Änderungsprotokoll]]></item>
- <item name="wcf.conversation.log.noEntries"><![CDATA[Es wurden keine Änderungen für diese Konversation protokolliert.]]></item>
- <item name="wcf.conversation.log.title"><![CDATA[Protokollierte Änderungen]]></item>
- <item name="wcf.conversation.log.action"><![CDATA[Aktion]]></item>
- <item name="wcf.conversation.log.time"><![CDATA[Datum]]></item>
- <item name="wcf.conversation.log.conversation.open"><![CDATA[Konversation geöffnet]]></item>
- <item name="wcf.conversation.log.conversation.close"><![CDATA[Konversation geschlossen]]></item>
- <item name="wcf.conversation.log.conversation.addParticipants"><![CDATA[Neue Teilnehmer wurden hinzugefügt: {implode from=$additionalData[participants] item=participant}<a href="{link controller='User' id=$participant[userID] title=$participant[username]}{/link}" class="userLink" data-user-id="{@$participant[userID]}">{$participant[username]}</a>{/implode}]]></item>
- <item name="wcf.conversation.log.conversation.removeParticipant"><![CDATA[Ein Teilnehmer wurde entfernt: <a href="{link controller='User' id=$additionalData[userID] title=$additionalData[username]}{/link}" class="userLink" data-user-id="{@$additionalData[userID]}">{$additionalData[username]}</a>]]></item>
+ <item name="wcf.conversation.log.conversation.open"><![CDATA[Hat die Konversation wieder geöffnet.]]></item>
+ <item name="wcf.conversation.log.conversation.close"><![CDATA[Hat die Konversation für neue Nachrichten geschlossen.]]></item>
+ <item name="wcf.conversation.log.conversation.leave"><![CDATA[Hat die Konversation verlassen.]]></item>
+ <item name="wcf.conversation.log.conversation.addParticipants"><![CDATA[Hat folgende Teilnehmer hinzugefügt: {implode from=$additionalData[participants] item=participant}<a href="{link controller='User' id=$participant[userID] title=$participant[username]}{/link}" class="userLink" data-user-id="{@$participant[userID]}">{$participant[username]}</a>{/implode}]]></item>
+ <item name="wcf.conversation.log.conversation.removeParticipant"><![CDATA[Hat folgende Teilnehmer entfernt: <a href="{link controller='User' id=$additionalData[userID] title=$additionalData[username]}{/link}" class="userLink" data-user-id="{@$additionalData[userID]}">{$additionalData[username]}</a>]]></item>
</category>
<category name="wcf.search">
<body id="tpl{$templateName|ucfirst}">
-{capture assign='headerNavigation'}
- <li><a href="{link controller='ConversationLog' id=$conversation->conversationID}{/link}" title="{lang}wcf.conversation.log{/lang}" class="jsTooltip"><span class="icon icon16 icon-tasks"></span> <span class="invisible">{lang}wcf.conversation.log{/lang}</span></a></li>
-{/capture}
-
{include file='header'}
<header class="boxHeadline marginTop conversationHeadline">
<h1>
<a href="{link controller='User' object=$participant}{/link}" class="userLink{if $participant->hideConversation == 2} conversationLeft{/if}" data-user-id="{@$participant->userID}">{$participant->username}</a>
{if $participant->isInvisible}<small>({lang}wcf.conversation.invisible{/lang})</small>{/if}
- {if ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID)}
+ {if ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID) && $participant->hideConversation != 2}
<a class="jsDeleteButton jsTooltip" title="{lang}wcf.conversation.participants.removeParticipant{/lang}" data-confirm-message="{lang}wcf.conversation.participants.removeParticipant.confirmMessage{/lang}" data-object-id="{@$participant->userID}"><span class="icon icon16 icon-remove"></span></a>
{/if}
</h1>
+++ /dev/null
-{include file='documentHeader'}
-
-<head>
- <title>{lang}wcf.conversation.log{/lang} - {$conversation->subject} - {PAGE_TITLE|language}</title>
-
- {include file='headInclude'}
-</head>
-
-<body id="tpl{$templateName|ucfirst}">
-
-{include file='header'}
-
-<header class="boxHeadline marginTop">
- <hgroup>
- <h1><a href="{link controller='ConversationLog' id=$conversation->conversationID}{/link}">{lang}wcf.conversation.log{/lang}</a></h1>
- </hgroup>
-</header>
-
-{include file='userNotice'}
-
-<div class="contentNavigation">
- {pages print=true assign=pagesLinks controller='ConversationLog' id=$conversation->conversationID link="pageNo=%d"}
-</div>
-
-{hascontent}
- <div class="tabularBox tabularBoxTitle marginTop">
- <hgroup>
- <h1>{lang}wcf.conversation.log.title{/lang} <span class="badge badgeInverse">{#$items}</span></h1>
- </hgroup>
-
- <table class="table">
- <thead>
- <tr>
- <th class="columnID{if $sortField == 'logID'} active {@$sortOrder}{/if}"><a href="{link controller='ConversationLog' id=$conversation->conversationID}pageNo={@$pageNo}&sortField=logID&sortOrder={if $sortField == 'logID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
- <th class="columnText">{lang}wcf.conversation.log.action{/lang}</th>
- <th class="columnID{if $sortField == 'username'} active {@$sortOrder}{/if}"><a href="{link controller='ConversationLog' id=$conversation->conversationID}pageNo={@$pageNo}&sortField=username&sortOrder={if $sortField == 'username' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.user.username{/lang}</a></th>
- <th class="columnID{if $sortField == 'time'} active {@$sortOrder}{/if}"><a href="{link controller='ConversationLog' id=$conversation->conversationID}pageNo={@$pageNo}&sortField=time&sortOrder={if $sortField == 'time' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.conversation.log.time{/lang}</a></th>
- </tr>
- </thead>
- <tbody>
- {content}
- {foreach from=$objects item=entry}
- <tr>
- <td class="columnID"><p>{#$entry->logID}</p></td>
- <td class="columnText"><p>{@$entry}</p></td>
- <td class="columnText"><p><a href="{link controller='User' id=$entry->userID title=$entry->username}{/link}" class="userLink" data-user-id="{@$entry->userID}">{$entry->username}</a></p></td>
- <td class="columnData"><p><small>{@$entry->time|time}</small></p></td>
- </tr>
- {/foreach}
- {/content}
- </tbody>
- </table>
- </div>
-{hascontentelse}
- <p class="info">{lang}wcf.conversation.log.noEntries{/lang}</p>
-{/hascontent}
-
-<div class="contentNavigation">
- {@$pagesLinks}
-</div>
-
-{include file='footer'}
-
-</body>
-</html>
<article class="message messageCollapsed">
<div class="messageHeader">
<div class="box24">
- <span class="icon icon16 icon-tasks"></span>
+ <a href="{link controller='User' object=$modificationLogEntry->getUserProfile()}{/link}" class="framed">{@$modificationLogEntry->getUserProfile()->getAvatar()->getImageTag(24)}</a>
<hgroup>
- <h1>{@$modificationLogEntry}</h1>
- <h2>
- <a href="{link controller='User' id=$modificationLogEntry->userID title=$modificationLogEntry->username}{/link}" class="userLink" data-user-id="{@$modificationLogEntry->userID}">{$modificationLogEntry->username}</a>
+ <h1><a href="{link controller='User' object=$modificationLogEntry->getUserProfile()}{/link}" class="userLink" data-user-id="{@$modificationLogEntry->userID}">{$modificationLogEntry->username}</a>
-
- {@$modificationLogEntry->time|time}
- </h2>
+ {@$modificationLogEntry->time|time}</h1>
+ <h2>{@$modificationLogEntry}</h2>
</hgroup>
</div>
</div>