1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Fixing ACP

This commit is contained in:
max-m 2013-01-27 20:10:06 +01:00
parent 6359d0382e
commit e07be6695e
5 changed files with 30 additions and 36 deletions

View File

@ -1,15 +1,9 @@
{include file='header' pageTitle='wcf.acp.chat.room.'|concat:$action} {include file='header' pageTitle='chat.acp.room.'|concat:$action}
<script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/WCF.ACL.js"></script> <script type="text/javascript" src="{@$__wcf->getPath('wcf')}js/WCF.ACL.js"></script>
<script type="text/javascript"> <script type="text/javascript">
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
WCF.Icon.addObject({
'wcf.icon.delete': '{@$__wcf->getPath('wcf')}icon/delete.svg',
'wcf.icon.user': '{@$__wcf->getPath('wcf')}icon/user.svg',
'wcf.icon.users': '{@$__wcf->getPath('wcf')}icon/users.svg'
});
new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}, ''{if $roomID|isset}, {@$roomID}{/if}); new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}, ''{if $roomID|isset}, {@$roomID}{/if});
}); });
//]]> //]]>
@ -17,7 +11,7 @@
<header class="boxHeadline"> <header class="boxHeadline">
<hgroup> <hgroup>
<h1>{lang}wcf.acp.chat.room.{$action}{/lang}</h1> <h1>{lang}chat.acp.room.{$action}{/lang}</h1>
</hgroup> </hgroup>
</header> </header>
@ -32,18 +26,18 @@
<div class="contentNavigation"> <div class="contentNavigation">
<nav> <nav>
<ul> <ul>
<li><a href="{link application='chat' controller='ChatRoomList'}{/link}" title="{lang}wcf.acp.menu.link.chat.room.list{/lang}" class="button"><img src="{@$__wcf->getPath('wcf')}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.menu.link.chat.room.list{/lang}</span></a></li> <li><a href="{link application='chat' controller='roomList'}{/link}" title="{lang}chat.acp.menu.link.room.list{/lang}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}chat.acp.menu.link.room.list{/lang}</span></a></li>
</ul> </ul>
</nav> </nav>
</div> </div>
<form method="post" action="{if $action == 'add'}{link application='chat' controller='ChatRoomAdd'}{/link}{else}{link application='chat' controller='ChatRoomEdit' id=$roomID}{/link}{/if}"> <form method="post" action="{if $action == 'add'}{link application='chat' controller='roomAdd'}{/link}{else}{link application='chat' controller='roomEdit' id=$roomID}{/link}{/if}">
<div class="container containerPadding sortableListContainer marginTop shadow"> <div class="container containerPadding sortableListContainer marginTop shadow">
<fieldset> <fieldset>
<legend>{lang}wcf.acp.chat.room.data{/lang}</legend> <legend>{lang}chat.acp.room.data{/lang}</legend>
<dl{if $errorField == 'title'} class="formError"{/if}> <dl{if $errorField == 'title'} class="formError"{/if}>
<dt><label for="title">{lang}wcf.acp.chat.room.title{/lang}</label></dt> <dt><label for="title">{lang}chat.acp.room.title{/lang}</label></dt>
<dd> <dd>
<input type="text" id="title" name="title" value="{$title}" autofocus="autofocus" class="long" /> <input type="text" id="title" name="title" value="{$title}" autofocus="autofocus" class="long" />
{if $errorField == 'title'} {if $errorField == 'title'}
@ -51,17 +45,17 @@
{if $errorType == 'empty'} {if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang} {lang}wcf.global.form.error.empty{/lang}
{else} {else}
{lang}wcf.acp.chat.room.title.error.{@$errorType}{/lang} {lang}chat.acp.room.title.error.{@$errorType}{/lang}
{/if} {/if}
</small> </small>
{/if} {/if}
</dd> </dd>
</dl> </dl>
{include file='multipleLanguageInputJavascript' elementIdentifier='title'} {include file='multipleLanguageInputJavascript' elementIdentifier='title' forceSelection='false'}
<dl{if $errorField == 'topic'} class="formError"{/if}> <dl{if $errorField == 'topic'} class="formError"{/if}>
<dt><label for="topic">{lang}wcf.acp.chat.room.topic{/lang}</label></dt> <dt><label for="topic">{lang}chat.acp.room.topic{/lang}</label></dt>
<dd> <dd>
<input type="text" id="topic" name="topic" value="{$topic}" class="long" /> <input type="text" id="topic" name="topic" value="{$topic}" class="long" />
{if $errorField == 'topic'} {if $errorField == 'topic'}
@ -69,14 +63,14 @@
{if $errorType == 'empty'} {if $errorType == 'empty'}
{lang}wcf.global.form.error.empty{/lang} {lang}wcf.global.form.error.empty{/lang}
{else} {else}
{lang}wcf.acp.chat.room.topic.error.{@$errorType}{/lang} {lang}chat.acp.room.topic.error.{@$errorType}{/lang}
{/if} {/if}
</small> </small>
{/if} {/if}
</dd> </dd>
</dl> </dl>
{include file='multipleLanguageInputJavascript' elementIdentifier='topic'} {include file='multipleLanguageInputJavascript' elementIdentifier='topic' forceSelection='false'}
<dl id="groupPermissions"> <dl id="groupPermissions">
<dt>{lang}wcf.acp.acl.permissions{/lang}</dt> <dt>{lang}wcf.acp.acl.permissions{/lang}</dt>

View File

@ -4,14 +4,14 @@
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
new WCF.Action.Delete('\\chat\\data\\room\\RoomAction', $('.chatRoomRow')); new WCF.Action.Delete('\\chat\\data\\room\\RoomAction', $('.chatRoomRow'));
new WCF.Sortable.List('chatRoomList', '\\chat\\data\\room\\RoomAction', {@$startIndex-1}); new WCF.Sortable.List('roomList', '\\chat\\data\\room\\RoomAction', {@$startIndex-1});
}); });
//]]> //]]>
</script> </script>
<header class="boxHeadline"> <header class="boxHeadline">
<hgroup> <hgroup>
<h1>{lang}wcf.acp.chat.room.list{/lang}</h1> <h1>{lang}chat.acp.room.list{/lang}</h1>
</hgroup> </hgroup>
</header> </header>
@ -19,30 +19,30 @@
{if $__wcf->session->getPermission('admin.chat.canAddRoom')} {if $__wcf->session->getPermission('admin.chat.canAddRoom')}
<nav> <nav>
<ul> <ul>
<li><a href="{link application='chat' controller='ChatRoomAdd'}{/link}" title="{lang}chat.acp.room.add{/lang}" class="button"><img src="{@$__wcf->getPath('wcf')}icon/add.svg" alt="" class="icon24" /> <span>{lang}chat.acp.room.add{/lang}</span></a></li> <li><a href="{link application='chat' controller='roomAdd'}{/link}" title="{lang}chat.acp.room.add{/lang}" class="button"><img src="{@$__wcf->getPath('wcf')}icon/add.svg" alt="" class="icon24" /> <span>{lang}chat.acp.room.add{/lang}</span></a></li>
</ul> </ul>
</nav> </nav>
{/if} {/if}
</div> </div>
{hascontent} {hascontent}
<section id="chatRoomList" class="container containerPadding sortableListContainer marginTop shadow"> <section id="roomList" class="container containerPadding sortableListContainer marginTop shadow">
<ol class="sortableList" data-object-id="0" start="{$startIndex}"> <ol class="sortableList" data-object-id="0" start="{$startIndex}">
{content} {content}
{foreach from=$objects item=chatRoom} {foreach from=$objects item=chatRoom}
<li class="sortableNode sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}"> <li class="sortableNode sortableNoNesting chatRoomRow" data-object-id="{@$chatRoom->roomID}">
<span class="sortableNodeLabel"> <span class="sortableNodeLabel">
{if $__wcf->session->getPermission('admin.chat.canEditRoom')} {if $__wcf->session->getPermission('admin.chat.canEditRoom')}
<a href="{link application='chat'controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a> <a href="{link application='chat' controller='roomEdit' id=$chatRoom->roomID}{/link}">{$chatRoom->title|language}</a>
{else} {else}
{$chatRoom->title|language} {$chatRoom->title|language}
{/if} {/if}
<span class="statusDisplay sortableButtonContainer"> <span class="statusDisplay sortableButtonContainer">
{if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} {if $__wcf->session->getPermission('admin.chat.canEditRoom')}
<a href="{link application='chat' controller='ChatRoomEdit' id=$chatRoom->roomID}{/link}"><img src="{@$__wcf->getPath('wcf')}icon/edit.svg" alt="" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip icon16" /></a> <a href="{link application='chat' controller='roomEdit' id=$chatRoom->roomID}{/link}"><span title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip icon icon16 icon-edit" /></a>
{/if} {/if}
{if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')} {if $__wcf->session->getPermission('admin.chat.canDeleteRoom')}
<img src="{@$__wcf->getPath('wcf')}icon/delete.svg" alt="" title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton jsTooltip icon16" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}chat.acp.room.delete.sure{/lang}" /> <span title="{lang}wcf.global.button.delete{/lang}" class="jsDeleteButton jsTooltip icon icon16 icon-remove" data-object-id="{@$chatRoom->roomID}" data-confirm-message="{lang}chat.acp.room.delete.sure{/lang}" />
{/if} {/if}
</span> </span>
</span> </span>

View File

@ -1,5 +1,5 @@
<?php <?php
namespace wcf\acp\form; namespace chat\acp\form;
use \wcf\system\exception\UserInputException; use \wcf\system\exception\UserInputException;
use \wcf\system\language\I18nHandler; use \wcf\system\language\I18nHandler;
use \wcf\system\WCF; use \wcf\system\WCF;
@ -88,21 +88,21 @@ public function save() {
parent::save(); parent::save();
// save room // save room
$this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array(), 'create', array('data' => array( $this->objectAction = new \chat\data\room\RoomAction(array(), 'create', array('data' => array(
'title' => $this->title, 'title' => $this->title,
'topic' => $this->topic 'topic' => $this->topic
))); )));
$this->objectAction->executeAction(); $this->objectAction->executeAction();
$returnValues = $this->objectAction->getReturnValues(); $returnValues = $this->objectAction->getReturnValues();
$chatRoomEditor = new \wcf\data\chat\room\ChatRoomEditor($returnValues['returnValues']); $roomEditor = new \chat\data\room\RoomEditor($returnValues['returnValues']);
$roomID = $returnValues['returnValues']->roomID; $roomID = $returnValues['returnValues']->roomID;
if (!I18nHandler::getInstance()->isPlainValue('title')) { if (!I18nHandler::getInstance()->isPlainValue('title')) {
I18nHandler::getInstance()->save('title', 'chat.room.title'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID()); I18nHandler::getInstance()->save('title', 'chat.room.title'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID());
// update title // update title
$chatRoomEditor->update(array( $roomEditor->update(array(
'title' => 'wcf.chat.room.title'.$roomID 'title' => 'chat.room.title'.$roomID
)); ));
} }
@ -110,13 +110,13 @@ public function save() {
I18nHandler::getInstance()->save('topic', 'chat.room.topic'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID()); I18nHandler::getInstance()->save('topic', 'chat.room.topic'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID());
// update topic // update topic
$chatRoomEditor->update(array( $roomEditor->update(array(
'topic' => 'chat.room.topic'.$roomID 'topic' => 'chat.room.topic'.$roomID
)); ));
} }
\wcf\system\acl\ACLHandler::getInstance()->save($roomID, $this->objectTypeID); \wcf\system\acl\ACLHandler::getInstance()->save($roomID, $this->objectTypeID);
\wcf\system\chat\permission\ChatPermissionHandler::clearCache(); \chat\system\permission\permissionHandler::clearCache();
$this->saved(); $this->saved();

View File

@ -1,5 +1,5 @@
<?php <?php
namespace wcf\acp\form; namespace chat\acp\form;
use \wcf\system\language\I18nHandler; use \wcf\system\language\I18nHandler;
use \wcf\system\WCF; use \wcf\system\WCF;
@ -21,7 +21,7 @@ class RoomEditForm extends RoomAddForm {
/** /**
* @see \wcf\acp\form\ACPForm::$activeMenuItem * @see \wcf\acp\form\ACPForm::$activeMenuItem
*/ */
public $activeMenuItem = 'wcf.acp.menu.link.room.list'; public $activeMenuItem = 'chat.acp.menu.link.room.list';
/** /**
* @see \wcf\page\AbstractPage::$neededPermissions * @see \wcf\page\AbstractPage::$neededPermissions

View File

@ -1,5 +1,5 @@
<?php <?php
namespace wcf\acp\page; namespace chat\acp\page;
/** /**
* Lists available chatrooms. * Lists available chatrooms.