mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Merge branch 'acp'
Conflicts: install.sql
This commit is contained in:
commit
5ad865d232
22
acpMenu.xml
Normal file
22
acpMenu.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/acpMenu.xsd">
|
||||
<import>
|
||||
<acpmenuitem name="wcf.acp.menu.link.chat">
|
||||
<parent>wcf.acp.menu.link.content</parent>
|
||||
</acpmenuitem>
|
||||
|
||||
<acpmenuitem name="wcf.acp.menu.link.chat.room.list">
|
||||
<link>index.php/ChatRoomList/</link>
|
||||
<parent>wcf.acp.menu.link.chat</parent>
|
||||
<permissions>admin.content.chat.canEditRoom,admin.content.chat.canDeleteRoom</permissions>
|
||||
<showorder>1</showorder>
|
||||
</acpmenuitem>
|
||||
|
||||
<acpmenuitem name="wcf.acp.menu.link.chat.room.add">
|
||||
<link>index.php/ChatRoomAdd/</link>
|
||||
<parent>wcf.acp.menu.link.chat</parent>
|
||||
<permissions>admin.content.chat.canAddRoom</permissions>
|
||||
<showorder>2</showorder>
|
||||
</acpmenuitem>
|
||||
</import>
|
||||
</data>
|
77
acptemplate/chatRoomAdd.tpl
Normal file
77
acptemplate/chatRoomAdd.tpl
Normal file
@ -0,0 +1,77 @@
|
||||
{include file='header'}
|
||||
|
||||
<header class="wcf-mainHeading">
|
||||
<img src="{@RELATIVE_WCF_DIR}icon/{$action}1.svg" alt="" />
|
||||
<hgroup>
|
||||
<h1>{lang}wcf.acp.chat.room.{$action}{/lang}</h1>
|
||||
</hgroup>
|
||||
</header>
|
||||
|
||||
{if $errorField}
|
||||
<p class="wcf-error">{lang}wcf.global.form.error{/lang}</p>
|
||||
{/if}
|
||||
|
||||
{if $success|isset}
|
||||
<p class="wcf-success">{lang}wcf.global.form.{$action}.success{/lang}</p>
|
||||
{/if}
|
||||
|
||||
<div class="wcf-contentHeader">
|
||||
<nav>
|
||||
<ul class="wcf-largeButtons">
|
||||
<li><a href="{link controller='ChatRoomList'}{/link}" title="{lang}wcf.acp.menu.link.chat.room.list{/lang}" class="wcf-button"><img src="{@RELATIVE_WCF_DIR}icon/chat1.svg" alt="" /> <span>{lang}wcf.acp.menu.link.chat.room.list{/lang}</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<form method="post" action="{if $action == 'add'}{link controller='ChatRoomAdd'}{/link}{else}{link controller='ChatRoomEdit'}{/link}{/if}">
|
||||
<div class="wcf-border wcf-content">
|
||||
<fieldset>
|
||||
<legend>{lang}wcf.acp.chat.room.data{/lang}</legend>
|
||||
|
||||
<dl{if $errorField == 'title'} class="wcf-formError"{/if}>
|
||||
<dt><label for="title">{lang}wcf.acp.chat.room.title{/lang}</label></dt>
|
||||
<dd>
|
||||
<input type="text" id="title" name="title" value="{$title}" autofocus="autofocus" class="long" />
|
||||
{if $errorField == 'title'}
|
||||
<small class="wcf-innerError">
|
||||
{if $errorType == 'empty'}
|
||||
{lang}wcf.global.form.error.empty{/lang}
|
||||
{else}
|
||||
{lang}wcf.acp.chat.room.title.error.{@$errorType}{/lang}
|
||||
{/if}
|
||||
</small>
|
||||
{/if}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
{include file='multipleLanguageInputJavascript' elementIdentifier='title'}
|
||||
|
||||
<dl{if $errorField == 'topic'} class="wcf-formError"{/if}>
|
||||
<dt><label for="topic">{lang}wcf.acp.chat.room.topic{/lang}</label></dt>
|
||||
<dd>
|
||||
<input type="text" id="topic" name="topic" value="{$topic}" class="long" />
|
||||
{if $errorField == 'topic'}
|
||||
<small class="wcf-innerError">
|
||||
{if $errorType == 'empty'}
|
||||
{lang}wcf.global.form.error.empty{/lang}
|
||||
{else}
|
||||
{lang}wcf.acp.chat.room.topic.error.{@$errorType}{/lang}
|
||||
{/if}
|
||||
</small>
|
||||
{/if}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
{include file='multipleLanguageInputJavascript' elementIdentifier='topic'}
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="wcf-formSubmit">
|
||||
<input type="reset" value="{lang}wcf.global.button.reset{/lang}" accesskey="r" />
|
||||
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
|
||||
{@SID_INPUT_TAG}
|
||||
{if $roomID|isset}<input type="hidden" name="id" value="{@$roomID}" />{/if}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{include file='footer'}
|
96
acptemplate/chatRoomList.tpl
Normal file
96
acptemplate/chatRoomList.tpl
Normal file
@ -0,0 +1,96 @@
|
||||
{include file='header'}
|
||||
|
||||
<header class="wcf-mainHeading">
|
||||
<img src="{@RELATIVE_WCF_DIR}icon/chat1.svg" alt="" />
|
||||
<hgroup>
|
||||
<h1>{lang}wcf.acp.chat.room.list{/lang}</h1>
|
||||
</hgroup>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(function() {
|
||||
new WCF.Action.Delete('wcf\\data\\chat\\room\\ChatRoomAction', $('.chatRoomRow'), $('.wcf-content .wcf-badge'));
|
||||
new WCF.Action.Toggle('wcf\\data\\chat\\room\\ChatRoomAction', $('.chatRoomRow'));
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
</header>
|
||||
|
||||
<div class="wcf-contentHeader">
|
||||
{pages print=true assign=pagesLinks controller="ChatRoomList" link="pageNo=%d"}
|
||||
|
||||
{if $__wcf->session->getPermission('admin.content.chat.canAddRoom')}
|
||||
<nav>
|
||||
<ul class="wcf-largeButtons">
|
||||
<li><a href="{link controller='ChatRoomAdd'}{/link}" title="{lang}wcf.acp.chat.room.add{/lang}" class="wcf-button"><img src="{@RELATIVE_WCF_DIR}icon/add1.svg" alt="" /> <span>{lang}wcf.acp.chat.room.add{/lang}</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{hascontent}
|
||||
<div class="wcf-border wcf-boxTitle">
|
||||
<hgroup>
|
||||
<h1>{lang}wcf.acp.chat.room.list{/lang} <span class="wcf-badge" title="{lang}wcf.acp.chat.room.list.count{/lang}">{#$items}</span></h1>
|
||||
</hgroup>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="columnID columnChatRoomID" colspan="2">{lang}wcf.global.objectID{/lang}</th>
|
||||
<th class="columnTitle columnChatRoomTitle">{lang}wcf.acp.chat.room.title{/lang}</th>
|
||||
|
||||
{event name='headColumns'}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{content}
|
||||
{foreach from=$objects item=chatRoom}
|
||||
<tr class="chatRoomRow">
|
||||
<td class="columnIcon">
|
||||
{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}
|
||||
<a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}"><img src="{@RELATIVE_WCF_DIR}icon/edit1.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="balloonTooltip" /></a>
|
||||
{else}
|
||||
<img src="{@RELATIVE_WCF_DIR}icon/edit1D.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" />
|
||||
{/if}
|
||||
{if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')}
|
||||
<img src="{@RELATIVE_WCF_DIR}icon/delete1.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="deleteButton balloonTooltip" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}wcf.acp.bbcode.delete.sure{/lang}" />
|
||||
{else}
|
||||
<img src="{@RELATIVE_WCF_DIR}icon/delete1D.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" />
|
||||
{/if}
|
||||
|
||||
{event name='buttons'}
|
||||
</td>
|
||||
<td class="columnID"><p>{@$chatRoom->roomID}</p></td>
|
||||
<td class="columnTitle columnChatRoomTitle"><p>{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}<a href="{link controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a>{else}{$chatRoom->title|language}{/if}</p></td>
|
||||
|
||||
{event name='columns'}
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/content}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wcf-contentFooter">
|
||||
{@$pagesLinks}
|
||||
|
||||
{if $__wcf->session->getPermission('admin.content.chat.canAddRoom')}
|
||||
<nav>
|
||||
<ul class="wcf-largeButtons">
|
||||
<li><a href="{link controller='ChatRoomAdd'}{/link}" title="{lang}wcf.acp.chat.room.add{/lang}" class="wcf-button"><img src="{@RELATIVE_WCF_DIR}icon/add1.svg" alt="" /> <span>{lang}wcf.acp.chat.room.add{/lang}</span></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
{/if}
|
||||
</div>
|
||||
{hascontentelse}
|
||||
<div class="wcf-border wcf-content">
|
||||
<div>
|
||||
<p class="wcf-warning">{lang}wcf.acp.chat.room.noneAvailable{/lang}</p>
|
||||
</div>
|
||||
</div>
|
||||
{/hascontent}
|
||||
|
||||
{include file='footer'}
|
13
build.php
13
build.php
@ -15,6 +15,7 @@
|
||||
EOT;
|
||||
if (file_exists('file.tar')) unlink('file.tar');
|
||||
if (file_exists('template.tar')) unlink('template.tar');
|
||||
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
||||
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
||||
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
||||
if (file_exists('timwolla.wcf.chat.tar')) unlink('timwolla.wcf.chat.tar');
|
||||
@ -60,15 +61,25 @@
|
||||
if ($code != 0) exit($code);
|
||||
echo <<<EOT
|
||||
|
||||
Building acptemplate.tar
|
||||
---------------------
|
||||
|
||||
EOT;
|
||||
chdir('../acptemplate');
|
||||
passthru('tar cvf ../acptemplate.tar *', $code);
|
||||
if ($code != 0) exit($code);
|
||||
echo <<<EOT
|
||||
|
||||
Building timwolla.wcf.chat.tar
|
||||
------------------------------
|
||||
|
||||
EOT;
|
||||
chdir('..');
|
||||
passthru('tar cvf timwolla.wcf.chat.tar * --exclude=file --exclude=template --exclude=build.php', $code);
|
||||
passthru('tar cvf timwolla.wcf.chat.tar * --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code);
|
||||
if ($code != 0) exit($code);
|
||||
|
||||
if (file_exists('file.tar')) unlink('file.tar');
|
||||
if (file_exists('template.tar')) unlink('template.tar');
|
||||
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
|
||||
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
|
||||
foreach (glob('file/style/*.css') as $cssFile) unlink($cssFile);
|
||||
|
136
file/lib/acp/form/ChatRoomAddForm.class.php
Normal file
136
file/lib/acp/form/ChatRoomAddForm.class.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
namespace wcf\acp\form;
|
||||
use \wcf\system\exception\UserInputException;
|
||||
use \wcf\system\language\I18nHandler;
|
||||
use \wcf\system\package\PackageDependencyHandler;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
* Shows the chatroom add form.
|
||||
*
|
||||
* @author Tim Düsterhus
|
||||
* @copyright 2010-2012 Tim Düsterhus
|
||||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||
* @package timwolla.wcf.chat
|
||||
* @subpackage acp.form
|
||||
*/
|
||||
class ChatRoomAddForm extends ACPForm {
|
||||
/**
|
||||
* @see \wcf\acp\form\ACPForm::$activeMenuItem
|
||||
*/
|
||||
public $activeMenuItem = 'wcf.acp.menu.link.chat.room.add';
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array('admin.content.chat.canAddRoom');
|
||||
|
||||
/**
|
||||
* Title of the room
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title = '';
|
||||
|
||||
/**
|
||||
* Topic of the room
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $topic = '';
|
||||
|
||||
/**
|
||||
* @see wcf\page\IPage::readParameters()
|
||||
*/
|
||||
public function readParameters() {
|
||||
parent::readParameters();
|
||||
|
||||
I18nHandler::getInstance()->register('title');
|
||||
I18nHandler::getInstance()->register('topic');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\form\IForm::readFormParameters()
|
||||
*/
|
||||
public function readFormParameters() {
|
||||
parent::readFormParameters();
|
||||
|
||||
I18nHandler::getInstance()->readValues();
|
||||
|
||||
if (I18nHandler::getInstance()->isPlainValue('title')) $this->title = I18nHandler::getInstance()->getValue('title');
|
||||
if (I18nHandler::getInstance()->isPlainValue('topic')) $this->topic = I18nHandler::getInstance()->getValue('topic');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\form\IForm::validate()
|
||||
*/
|
||||
public function validate() {
|
||||
parent::validate();
|
||||
|
||||
// validate title
|
||||
if (!I18nHandler::getInstance()->validateValue('title')) {
|
||||
throw new UserInputException('title');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\form\IForm::save()
|
||||
*/
|
||||
public function save() {
|
||||
parent::save();
|
||||
|
||||
// save room
|
||||
$chatRoomAction = new \wcf\data\chat\room\ChatRoomAction(array(), 'create', array('data' => array(
|
||||
'title' => $this->title,
|
||||
'topic' => $this->topic
|
||||
)));
|
||||
$chatRoomAction->executeAction();
|
||||
$returnValues = $chatRoomAction->getReturnValues();
|
||||
$chatRoomEditor = new \wcf\data\chat\room\ChatRoomEditor($returnValues['returnValues']);
|
||||
$roomID = $returnValues['returnValues']->roomID;
|
||||
|
||||
if (!I18nHandler::getInstance()->isPlainValue('title')) {
|
||||
I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'));
|
||||
|
||||
// update title
|
||||
$chatRoomEditor->update(array(
|
||||
'title' => 'wcf.chat.room.title'.$roomID
|
||||
));
|
||||
}
|
||||
|
||||
if (!I18nHandler::getInstance()->isPlainValue('topic')) {
|
||||
I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'));
|
||||
|
||||
// update topic
|
||||
$chatRoomEditor->update(array(
|
||||
'topic' => 'wcf.chat.room.topic'.$roomID
|
||||
));
|
||||
}
|
||||
|
||||
$this->saved();
|
||||
|
||||
// reset values
|
||||
$this->topic = $this->title = '';
|
||||
I18nHandler::getInstance()->disableAssignValueVariables();
|
||||
|
||||
// show success
|
||||
WCF::getTPL()->assign(array(
|
||||
'success' => true
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\page\IPage::assignVariables()
|
||||
*/
|
||||
public function assignVariables() {
|
||||
parent::assignVariables();
|
||||
|
||||
I18nHandler::getInstance()->assignVariables();
|
||||
|
||||
WCF::getTPL()->assign(array(
|
||||
'action' => 'add',
|
||||
'title' => $this->title,
|
||||
'topic' => $this->topic
|
||||
));
|
||||
}
|
||||
}
|
127
file/lib/acp/form/ChatRoomEditForm.class.php
Normal file
127
file/lib/acp/form/ChatRoomEditForm.class.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
namespace wcf\acp\form;
|
||||
use wcf\system\language\I18nHandler;
|
||||
use wcf\system\package\PackageDependencyHandler;
|
||||
use wcf\system\WCF;
|
||||
|
||||
/**
|
||||
* Shows the chatroom edit form.
|
||||
*
|
||||
* @author Tim Düsterhus
|
||||
* @copyright 2010-2012 Tim Düsterhus
|
||||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||
* @package timwolla.wcf.chat
|
||||
* @subpackage acp.form
|
||||
*/
|
||||
class ChatRoomEditForm extends ChatRoomAddForm {
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$templateName
|
||||
*/
|
||||
public $templateName = 'chatRoomAdd';
|
||||
|
||||
/**
|
||||
* @see \wcf\acp\form\ACPForm::$activeMenuItem
|
||||
*/
|
||||
public $activeMenuItem = 'wcf.acp.menu.link.chat.room.list';
|
||||
|
||||
/**
|
||||
* @see \wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array('admin.content.chat.canEditRoom');
|
||||
|
||||
/**
|
||||
* room id
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $roomID = 0;
|
||||
|
||||
/**
|
||||
* room object
|
||||
*
|
||||
* @var \wcf\data\chat\room\ChatRoom
|
||||
*/
|
||||
public $roomObj = null;
|
||||
|
||||
/**
|
||||
* @see wcf\page\IPage::readParameters()
|
||||
*/
|
||||
public function readParameters() {
|
||||
parent::readParameters();
|
||||
|
||||
if (isset($_REQUEST['id'])) $this->roomID = intval($_REQUEST['id']);
|
||||
$this->roomObj = new \wcf\data\chat\room\ChatRoom($this->roomID);
|
||||
if (!$this->roomObj->roomID) {
|
||||
throw new \wcf\system\exception\IllegalLinkException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\form\IForm::save()
|
||||
*/
|
||||
public function save() {
|
||||
ACPForm::save();
|
||||
|
||||
$this->title = 'wcf.chat.room.title'.$this->roomObj->roomID;
|
||||
if (I18nHandler::getInstance()->isPlainValue('title')) {
|
||||
I18nHandler::getInstance()->remove($this->title, PackageDependencyHandler::getPackageID('timwolla.wcf.chat'));
|
||||
$this->title = I18nHandler::getInstance()->getValue('title');
|
||||
}
|
||||
else {
|
||||
I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'));
|
||||
}
|
||||
|
||||
$this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID;
|
||||
if (I18nHandler::getInstance()->isPlainValue('topic')) {
|
||||
I18nHandler::getInstance()->remove($this->topic, PackageDependencyHandler::getPackageID('timwolla.wcf.chat'));
|
||||
$this->topic = I18nHandler::getInstance()->getValue('topic');
|
||||
}
|
||||
else {
|
||||
I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'));
|
||||
}
|
||||
|
||||
|
||||
// update room
|
||||
$chatRoomAction = new LabelAction(array($this->roomID), 'update', array('data' => array(
|
||||
'title' => $this->title,
|
||||
'topic' => $this->topic
|
||||
)));
|
||||
$chatRoomAction->executeAction();
|
||||
|
||||
$this->saved();
|
||||
|
||||
// show success
|
||||
WCF::getTPL()->assign(array(
|
||||
'success' => true
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\page\IPage::readData()
|
||||
*/
|
||||
public function readData() {
|
||||
parent::readData();
|
||||
|
||||
if (!count($_POST)) {
|
||||
I18nHandler::getInstance()->setOptions('title', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'), $this->roomObj->title, 'wcf.chat.room.title\d+');
|
||||
I18nHandler::getInstance()->setOptions('topic', PackageDependencyHandler::getPackageID('timwolla.wcf.chat'), $this->roomObj->topic, 'wcf.chat.room.topic\d+');
|
||||
|
||||
$this->title = $this->roomObj->title;
|
||||
$this->topic = $this->roomObj->topic;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see wcf\page\IPage::assignVariables()
|
||||
*/
|
||||
public function assignVariables() {
|
||||
parent::assignVariables();
|
||||
|
||||
I18nHandler::getInstance()->assignVariables((bool) count($_POST));
|
||||
|
||||
WCF::getTPL()->assign(array(
|
||||
'roomID' => $this->roomID,
|
||||
'action' => 'edit'
|
||||
));
|
||||
}
|
||||
}
|
46
file/lib/acp/page/ChatRoomListPage.class.php
Normal file
46
file/lib/acp/page/ChatRoomListPage.class.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace wcf\acp\page;
|
||||
|
||||
/**
|
||||
* Lists available chatrooms.
|
||||
*
|
||||
* @author Tim Düsterhus
|
||||
* @copyright 2010-2012 Tim Düsterhus
|
||||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||
* @package timwolla.wcf.chat
|
||||
* @subpackage acp.page
|
||||
*/
|
||||
class ChatRoomListPage extends \wcf\page\MultipleLinkPage {
|
||||
/**
|
||||
* @see wcf\page\AbstractPage::$neededPermissions
|
||||
*/
|
||||
public $neededPermissions = array(
|
||||
'admin.content.chat.canEditRoom',
|
||||
'admin.content.chat.canDeleteRoom'
|
||||
);
|
||||
|
||||
/**
|
||||
* @see wcf\page\MultipleLinkPage::$objectListClassName
|
||||
*/
|
||||
public $objectListClassName = '\wcf\data\chat\room\ChatRoomList';
|
||||
|
||||
/**
|
||||
* @see wcf\page\MultipleLinkPage::$sortField
|
||||
*/
|
||||
public $sortField = 'position';
|
||||
|
||||
/**
|
||||
* @see wcf\page\MultipleLinkPage::$sortOrder
|
||||
*/
|
||||
public $sortOrder = 'ASC';
|
||||
|
||||
/**
|
||||
* @see wcf\page\IPage::show()
|
||||
*/
|
||||
public function show() {
|
||||
// set active menu item.
|
||||
\wcf\system\menu\acp\ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.chat.room.list');
|
||||
|
||||
parent::show();
|
||||
}
|
||||
}
|
28
file/lib/data/chat/room/ChatRoomAction.class.php
Normal file
28
file/lib/data/chat/room/ChatRoomAction.class.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace wcf\data\chat\room;
|
||||
|
||||
/**
|
||||
* Executes chatroom-related actions.
|
||||
*
|
||||
* @author Tim Düsterhus
|
||||
* @copyright 2010-2012 Tim Düsterhus
|
||||
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
||||
* @package timwolla.wcf.chat
|
||||
* @subpackage data.chat.room
|
||||
*/
|
||||
class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction {
|
||||
/**
|
||||
* @see wcf\data\AbstractDatabaseObjectAction::$className
|
||||
*/
|
||||
protected $className = '\wcf\data\chat\room\ChatRoomEditor';
|
||||
|
||||
/**
|
||||
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
|
||||
*/
|
||||
protected $permissionsDelete = array('admin.content.chat.canDeleteRoom');
|
||||
|
||||
/**
|
||||
* @see wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
|
||||
*/
|
||||
protected $permissionsUpdate = array('admin.content.chat.canEditRoom');
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace wcf\data\chat\room;
|
||||
use \wcf\system\WCF;
|
||||
|
||||
/**
|
||||
* Provides functions to edit chat rooms.
|
||||
@ -20,7 +21,24 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data
|
||||
* Clears the room cache.
|
||||
*/
|
||||
public static function resetCache() {
|
||||
self::getCache();
|
||||
CacheHandler::getInstance()->clearResource('chatrooms');
|
||||
ChatRoom::getCache();
|
||||
\wcf\system\cache\CacheHandler::getInstance()->clearResource('chatrooms');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \wcf\data\DatabaseObjectEditor::deleteAll()
|
||||
*/
|
||||
public static function deleteAll(array $objectIDs = array()) {
|
||||
parent::deleteAll($objectIDs);
|
||||
$packageID = \wcf\system\package\PackageDependencyHandler::getPackageID('timwolla.wcf.chat');
|
||||
|
||||
WCF::getDB()->beginTransaction();
|
||||
foreach ($objectIDs as $objectID) {
|
||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID, $packageID);
|
||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID);
|
||||
}
|
||||
WCF::getDB()->commitTransaction();
|
||||
|
||||
return count($objectIDs);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ CREATE TABLE wcf1_chat_message (
|
||||
DROP TABLE IF EXISTS wcf1_chat_room;
|
||||
CREATE TABLE wcf1_chat_room (
|
||||
roomID int(10) NOT NULL AUTO_INCREMENT,
|
||||
title varchar(25) NOT NULL,
|
||||
title varchar(255) NOT NULL,
|
||||
topic varchar(255) NOT NULL,
|
||||
position int(10) NOT NULL DEFAULT 0,
|
||||
permanent tinyint(1) NOT NULL DEFAULT 1,
|
||||
|
@ -1,5 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/language.xsd" languagecode="de">
|
||||
<category name="wcf.acp.chat">
|
||||
<item name="wcf.acp.chat.room.list"><![CDATA[Chaträume]]></item>
|
||||
<item name="wcf.acp.chat.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
||||
</category>
|
||||
|
||||
<category name="wcf.acp.menu">
|
||||
<item name="wcf.acp.menu.link.chat"><![CDATA[Chat]]></item>
|
||||
<item name="wcf.acp.menu.link.chat.room.list"><![CDATA[Chaträume auflisten]]></item>
|
||||
<item name="wcf.acp.menu.link.chat.room.add"><![CDATA[Chatraum hinzufügen]]></item>
|
||||
</category>
|
||||
|
||||
<category name="wcf.acp.option">
|
||||
<item name="wcf.acp.option.category.chat"><![CDATA[Chat]]></item>
|
||||
<item name="wcf.acp.option.category.chat.general"><![CDATA[Allgemein]]></item>
|
||||
@ -24,11 +35,7 @@
|
||||
<item name="wcf.acp.option.chat_log_archivetime"><![CDATA[Speicherzeit]]></item>
|
||||
<item name="wcf.acp.option.chat_log_archivetime.description"><![CDATA[Gibt die Zeit in Minuten an, die eine Nachricht im Protokoll gespeichert bleibt.]]></item>
|
||||
</category>
|
||||
|
||||
<category name="wcf.header">
|
||||
<item name="wcf.header.menu.chat"><![CDATA[Chat]]></item>
|
||||
</category>
|
||||
|
||||
|
||||
<category name="wcf.chat">
|
||||
<item name="wcf.chat.title"><![CDATA[Chat]]></item>
|
||||
<item name="wcf.chat.protocol"><![CDATA[Protokoll]]></item>
|
||||
@ -55,4 +62,11 @@
|
||||
<!-- 2 = TYPE_LEAVE -->
|
||||
<item name="wcf.chat.message.2"><![CDATA[hat den Chat verlassen.]]></item>
|
||||
</category>
|
||||
|
||||
<!-- I18N Values -->
|
||||
<category name="wcf.chat.room" />
|
||||
|
||||
<category name="wcf.header">
|
||||
<item name="wcf.header.menu.chat"><![CDATA[Chat]]></item>
|
||||
</category>
|
||||
</language>
|
@ -5,7 +5,7 @@
|
||||
<packagedescription><![CDATA[Chat for WoltLab Community Framework™]]></packagedescription>
|
||||
<standalone>0</standalone>
|
||||
<isunique>1</isunique>
|
||||
<version>3.0.0 Alpha 3</version>
|
||||
<version>3.0.0 Alpha 6</version>
|
||||
<date>2011-11-26</date>
|
||||
<plugin>com.woltlab.wcf.bbcode</plugin> <!-- TODO: Correct me -->
|
||||
</packageinformation>
|
||||
@ -25,6 +25,7 @@
|
||||
<instruction type="language">language/*.xml</instruction>
|
||||
<instruction type="file">file.tar</instruction>
|
||||
<instruction type="template">template.tar</instruction>
|
||||
<instruction type="acpTemplate">acptemplate.tar</instruction>
|
||||
<instruction type="sql">install.sql</instruction>
|
||||
<instruction type="objectType">objectType.xml</instruction>
|
||||
<instruction type="option">option.xml</instruction>
|
||||
@ -32,17 +33,22 @@
|
||||
<instruction type="eventListener">eventListener.xml</instruction>
|
||||
<instruction type="templateListener">templatelistener.xml</instruction>
|
||||
<instruction type="aclOption">acloptions.xml</instruction>
|
||||
<instruction type="acpMenu">acpMenu.xml</instruction>
|
||||
<instruction type="userGroupOption">userGroupOption.xml</instruction>
|
||||
</instructions>
|
||||
|
||||
<instructions type="update" fromversion="3.0.0 Alpha *">
|
||||
<instruction type="language">language/*.xml</instruction>
|
||||
<instruction type="file">file.tar</instruction>
|
||||
<instruction type="template">template.tar</instruction>
|
||||
<instruction type="acpTemplate">acptemplate.tar</instruction>
|
||||
<instruction type="objectType">objectType.xml</instruction>
|
||||
<instruction type="option">option.xml</instruction>
|
||||
<instruction type="pageMenu">pagemenu.xml</instruction>
|
||||
<instruction type="eventListener">eventListener.xml</instruction>
|
||||
<instruction type="templateListener">templatelistener.xml</instruction>
|
||||
<instruction type="aclOption">acloptions.xml</instruction>
|
||||
<instruction type="acpMenu">acpMenu.xml</instruction>
|
||||
<instruction type="userGroupOption">userGroupOption.xml</instruction>
|
||||
</instructions>
|
||||
</package>
|
||||
|
31
userGroupOption.xml
Normal file
31
userGroupOption.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/userGroupOption.xsd">
|
||||
<import>
|
||||
<categories>
|
||||
<category name="admin.content.chat">
|
||||
<parent>admin.content</parent>
|
||||
</category>
|
||||
</categories>
|
||||
|
||||
<options>
|
||||
<option name="admin.content.chat.canAddRoom">
|
||||
<categoryname>admin.content.chat</categoryname>
|
||||
<optiontype>boolean</optiontype>
|
||||
<defaultvalue>0</defaultvalue>
|
||||
<admindefaultvalue>1</admindefaultvalue>
|
||||
</option>
|
||||
<option name="admin.content.chat.canEditRoom">
|
||||
<categoryname>admin.content.chat</categoryname>
|
||||
<optiontype>boolean</optiontype>
|
||||
<defaultvalue>0</defaultvalue>
|
||||
<admindefaultvalue>1</admindefaultvalue>
|
||||
</option>
|
||||
<option name="admin.content.chat.canDeleteRoom">
|
||||
<categoryname>admin.content.chat</categoryname>
|
||||
<optiontype>boolean</optiontype>
|
||||
<defaultvalue>0</defaultvalue>
|
||||
<admindefaultvalue>1</admindefaultvalue>
|
||||
</option>
|
||||
</options>
|
||||
</import>
|
||||
</data>
|
Loading…
Reference in New Issue
Block a user