From 22d3795aecf0c1ae14bd589cc0d9b05a62e3701a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 4 Feb 2012 20:50:18 +0100 Subject: [PATCH 1/8] Adding ChatRoomListPage --- acpMenu.xml | 22 +++++ acptemplate/chatRoomList.tpl | 96 ++++++++++++++++++++ build.php | 13 ++- file/lib/acp/page/ChatRoomListPage.class.php | 47 ++++++++++ package.xml | 8 +- userGroupOption.xml | 31 +++++++ 6 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 acpMenu.xml create mode 100644 acptemplate/chatRoomList.tpl create mode 100644 file/lib/acp/page/ChatRoomListPage.class.php create mode 100644 userGroupOption.xml diff --git a/acpMenu.xml b/acpMenu.xml new file mode 100644 index 0000000..6d9b743 --- /dev/null +++ b/acpMenu.xml @@ -0,0 +1,22 @@ + + + + + wcf.acp.menu.link.content + + + + index.php/ChatRoomList/ + wcf.acp.menu.link.chat + admin.content.chat.canEditRoom,admin.content.chat.canDeleteRoom + 1 + + + + index.php/ChatRoomAdd/ + wcf.acp.menu.link.chat + admin.content.chat.canAddRoom + 2 + + + diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl new file mode 100644 index 0000000..e4b7140 --- /dev/null +++ b/acptemplate/chatRoomList.tpl @@ -0,0 +1,96 @@ +{include file='header'} + +
+ +
+

{lang}wcf.acp.chat.room.list{/lang}

+
+ + +
+ +
+ {pages print=true assign=pagesLinks controller="ChatRoomList" link="pageNo=%d"} + + {if $__wcf->session->getPermission('admin.content.chat.canAddRoom')} + + {/if} +
+ +{hascontent} +
+
+

{lang}wcf.acp.chat.room.list{/lang} {#$items}

+
+ + + + + + + + {event name='headColumns'} + + + + + {content} + {foreach from=$objects item=chatRoom} + + + + + + {event name='columns'} + + {/foreach} + {/content} + +
{lang}wcf.global.objectID{/lang}{lang}wcf.acp.chat.room.title{/lang}
+ {if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} + + {else} + + {/if} + {if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')} + + {else} + + {/if} + + {event name='buttons'} +

{@$chatRoom->roomID}

{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')}{$chatRoom->title|language}{else}{$chatRoom->title|language}{/if}

+ +
+ +
+ {@$pagesLinks} + + {if $__wcf->session->getPermission('admin.content.chat.canAddRoom')} + + {/if} +
+{hascontentelse} +
+
+

{lang}wcf.acp.chat.room.noneAvailable{/lang}

+
+
+{/hascontent} + +{include file='footer'} \ No newline at end of file diff --git a/build.php b/build.php index f10da56..5b96816 100755 --- a/build.php +++ b/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 << + * @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(); + } +} diff --git a/package.xml b/package.xml index 7c3bf7b..1424b36 100644 --- a/package.xml +++ b/package.xml @@ -5,7 +5,7 @@ 0 1 - 3.0.0 Alpha 3 + 3.0.0 Alpha 4 2011-11-26 com.woltlab.wcf.bbcode @@ -25,6 +25,7 @@ language/*.xml file.tar template.tar + acptemplate.tar install.sql objectType.xml option.xml @@ -32,17 +33,22 @@ eventListener.xml templatelistener.xml acloptions.xml + acpMenu.xml + userGroupOption.xml language/*.xml file.tar template.tar + acptemplate.tar objectType.xml option.xml pagemenu.xml eventListener.xml templatelistener.xml acloptions.xml + acpMenu.xml + userGroupOption.xml diff --git a/userGroupOption.xml b/userGroupOption.xml new file mode 100644 index 0000000..aad3e80 --- /dev/null +++ b/userGroupOption.xml @@ -0,0 +1,31 @@ + + + + + + admin.content + + + + + + + + + + \ No newline at end of file From fdfc16f6a3da13b2641e8e76d991e48835a7c923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 4 Feb 2012 20:59:40 +0100 Subject: [PATCH 2/8] Language items for ACP --- acpMenu.xml | 4 ++-- file/lib/acp/page/ChatRoomListPage.class.php | 2 +- language/de.xml | 21 +++++++++++++++----- package.xml | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/acpMenu.xml b/acpMenu.xml index 6d9b743..2752765 100644 --- a/acpMenu.xml +++ b/acpMenu.xml @@ -5,14 +5,14 @@ wcf.acp.menu.link.content - + index.php/ChatRoomList/ wcf.acp.menu.link.chat admin.content.chat.canEditRoom,admin.content.chat.canDeleteRoom 1 - + index.php/ChatRoomAdd/ wcf.acp.menu.link.chat admin.content.chat.canAddRoom diff --git a/file/lib/acp/page/ChatRoomListPage.class.php b/file/lib/acp/page/ChatRoomListPage.class.php index 86e3f84..47a86b6 100644 --- a/file/lib/acp/page/ChatRoomListPage.class.php +++ b/file/lib/acp/page/ChatRoomListPage.class.php @@ -40,7 +40,7 @@ class ChatRoomListPage extends \wcf\page\MultipleLinkPage { */ public function show() { // set active menu item. - \wcf\system\menu\acp\ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.chat.list'); + \wcf\system\menu\acp\ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.chat.room.list'); parent::show(); } diff --git a/language/de.xml b/language/de.xml index 5330609..a4534f9 100644 --- a/language/de.xml +++ b/language/de.xml @@ -1,5 +1,16 @@ + + + + + + + + + + + @@ -24,11 +35,7 @@ - - - - - + @@ -55,4 +62,8 @@ + + + + \ No newline at end of file diff --git a/package.xml b/package.xml index 1424b36..b701f61 100644 --- a/package.xml +++ b/package.xml @@ -5,7 +5,7 @@ 0 1 - 3.0.0 Alpha 4 + 3.0.0 Alpha 5 2011-11-26 com.woltlab.wcf.bbcode From d79552c371b6503448a86f126ab323a646a6acfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 4 Feb 2012 21:06:44 +0100 Subject: [PATCH 3/8] Chatrooms can be deleted now --- file/lib/acp/page/ChatRoomListPage.class.php | 9 +++--- .../data/chat/room/ChatRoomAction.class.php | 28 +++++++++++++++++++ .../data/chat/room/ChatRoomEditor.class.php | 4 +-- 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 file/lib/data/chat/room/ChatRoomAction.class.php diff --git a/file/lib/acp/page/ChatRoomListPage.class.php b/file/lib/acp/page/ChatRoomListPage.class.php index 47a86b6..efbe911 100644 --- a/file/lib/acp/page/ChatRoomListPage.class.php +++ b/file/lib/acp/page/ChatRoomListPage.class.php @@ -4,12 +4,11 @@ /** * Lists available chatrooms. * - * @author Tim Düsterhus - * @copyright 2011-2012 Tim Düsterhus - * @license GNU Lesser General Public License - * @package com.woltlab.wcf.bbcode + * @author Tim Düsterhus + * @copyright 2010-2012 Tim Düsterhus + * @license Creative Commons Attribution-NonCommercial-ShareAlike + * @package timwolla.wcf.chat * @subpackage acp.page - * @category Community Framework */ class ChatRoomListPage extends \wcf\page\MultipleLinkPage { /** diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/chat/room/ChatRoomAction.class.php new file mode 100644 index 0000000..09f2a28 --- /dev/null +++ b/file/lib/data/chat/room/ChatRoomAction.class.php @@ -0,0 +1,28 @@ + + * @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'); +} diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/chat/room/ChatRoomEditor.class.php index 73e0a2a..ee1a1a5 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/chat/room/ChatRoomEditor.class.php @@ -20,7 +20,7 @@ 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'); } } From cb64177639f59943193a8867bfa6dfcf85790879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 4 Feb 2012 21:09:23 +0100 Subject: [PATCH 4/8] Update badge as well --- acptemplate/chatRoomList.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index e4b7140..2b16686 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -9,7 +9,7 @@