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

Adding ChatRoomListPage

This commit is contained in:
Tim Düsterhus 2012-02-04 20:50:18 +01:00
parent 3172d9d666
commit 22d3795aec
6 changed files with 215 additions and 2 deletions

22
acpMenu.xml Normal file
View 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.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.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>

View 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'));
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'}

View File

@ -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);

View File

@ -0,0 +1,47 @@
<?php
namespace wcf\acp\page;
/**
* Lists available chatrooms.
*
* @author Tim Düsterhus
* @copyright 2011-2012 Tim Düsterhus
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf.bbcode
* @subpackage acp.page
* @category Community Framework
*/
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.list');
parent::show();
}
}

View File

@ -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 4</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
View 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>