Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Commit

Permalink
Changes for WBB 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Friebel committed Jan 8, 2014
1 parent f2c8710 commit 2a00af1
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 192 deletions.
11 changes: 11 additions & 0 deletions aclOption.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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/aclOption.xsd">
<import>
<options>
<option name="canViewLimitedContent">
<categoryname>user.thread</categoryname>
<objecttype>com.woltlab.wbb.board</objecttype>
</option>
</options>
</import>
</data>
9 changes: 9 additions & 0 deletions acptemplates/__boardAddLimitThreadView.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<dl>
<dt>
<label for="limitThreadView">{lang}wbb.acp.board.limitthreadview{/lang}</label>
</dt>
<dd>
<input type="number" id="limitThreadView" name="limitThreadView" value="{if $limitThreadView}{@$limitThreadView}{/if}" class="tiny" min="0" />
<small>{lang}wbb.acp.board.limitthreadview.description{/lang}</small>
</dd>
</dl>
18 changes: 0 additions & 18 deletions acptemplates/limitThreadView.tpl

This file was deleted.

35 changes: 0 additions & 35 deletions de-informal.utf-8.xml

This file was deleted.

44 changes: 44 additions & 0 deletions eventListener.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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/eventListener.xsd">
<import>
<eventlistener>
<eventclassname><![CDATA[wbb\page\ThreadPage]]></eventclassname>
<eventname>readData</eventname>
<listenerclassname><![CDATA[wbb\system\event\listener\LimitThreadViewListener]]></listenerclassname>
</eventlistener>
<eventlistener>
<eventclassname><![CDATA[wbb\page\ThreadPage]]></eventclassname>
<eventname>assignVariables</eventname>
<listenerclassname><![CDATA[wbb\system\event\listener\LimitThreadViewListener]]></listenerclassname>
</eventlistener>

<eventlistener>
<eventclassname><![CDATA[wbb\page\BoardFeedPage]]></eventclassname>
<eventname>readData</eventname>
<listenerclassname><![CDATA[wbb\system\event\listener\LimitThreadViewFeedListener]]></listenerclassname>
</eventlistener>

<eventlistener>
<eventclassname><![CDATA[wbb\acp\form\BoardAddForm]]></eventclassname>
<environment>admin</environment>
<eventname>assignVariables</eventname>
<listenerclassname><![CDATA[wbb\system\event\listener\LimitThreadViewACPListener]]></listenerclassname>
<inherit>1</inherit>
</eventlistener>
<eventlistener>
<eventclassname><![CDATA[wbb\acp\form\BoardAddForm]]></eventclassname>
<environment>admin</environment>
<eventname>readFormParameters</eventname>
<listenerclassname><![CDATA[wbb\system\event\listener\LimitThreadViewACPListener]]></listenerclassname>
<inherit>1</inherit>
</eventlistener>
<eventlistener>
<eventclassname><![CDATA[wbb\acp\form\BoardAddForm]]></eventclassname>
<environment>admin</environment>
<eventname>save</eventname>
<listenerclassname><![CDATA[wbb\system\event\listener\LimitThreadViewACPListener]]></listenerclassname>
<inherit>1</inherit>
</eventlistener>

</import>
</data>
50 changes: 0 additions & 50 deletions eventlistener.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<?php
namespace wbb\system\event\listener;
use wcf\system\event\IEventListener;
use wcf\system\WCF;

/**
* Copyright (c) 2013 Tobias Friebel
* Authors: Tobias Friebel <[email protected]>
* Provides ACP integration
*
* Lizenz: CC Namensnennung-Keine kommerzielle Nutzung-Keine Bearbeitung
* http://creativecommons.org/licenses/by-nc-nd/2.0/de/
* @author Tobias Friebel <[email protected]>
* @copyright 2014 Tobias Friebel
* @license Creative Commons Attribution-NoDerivatives <http://creativecommons.org/licenses/by-nd/4.0/legalcode>
* @package com.toby.wbb.limitthreadview
* @subpackage system.event.listener
* @category WoltLab Burning Board
*/

require_once(WCF_DIR.'lib/system/event/EventListener.class.php');

class LimitThreadViewACPListener implements EventListener
class LimitThreadViewACPListener implements IEventListener
{
private $limitThreadView = 0;
public $limitThreadView = 0;
private $isSave = false;

/**
Expand Down Expand Up @@ -43,8 +47,6 @@ public function execute($eventObj, $className, $eventName)
'limitThreadView' => $this->limitThreadView,
));
}

WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('limitThreadView'));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<?php
namespace wbb\system\event\listener;
use wcf\system\event\IEventListener;
use wcf\system\WCF;

/**
* Copyright (c) 2013 Tobias Friebel
* Authors: Tobias Friebel <[email protected]>
* Limits thread feeds to configured length
*
* Lizenz: CC Namensnennung-Keine kommerzielle Nutzung-Keine Bearbeitung
* http://creativecommons.org/licenses/by-nc-nd/2.0/de/
* @author Tobias Friebel <[email protected]>
* @copyright 2014 Tobias Friebel
* @license Creative Commons Attribution-NoDerivatives <http://creativecommons.org/licenses/by-nd/4.0/legalcode>
* @package com.toby.wbb.limitthreadview
* @subpackage system.event.listener
* @category WoltLab Burning Board
*/

require_once(WCF_DIR.'lib/system/event/EventListener.class.php');

class LimitThreadViewFeedListener implements EventListener
class LimitThreadViewFeedListener implements IEventListener
{
/**
* @see EventListener::execute()
Expand Down
37 changes: 19 additions & 18 deletions files/lib/system/event/listener/LimitThreadViewListener.class.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<?php
namespace wbb\system\event\listener;
use wcf\system\event\IEventListener;
use wcf\system\WCF;

/**
* Copyright (c) 2013 Tobias Friebel
* Authors: Tobias Friebel <[email protected]>
* Limits thread to configured length
*
* Lizenz: CC Namensnennung-Keine kommerzielle Nutzung-Keine Bearbeitung
* http://creativecommons.org/licenses/by-nc-nd/2.0/de/
* @author Tobias Friebel <[email protected]>
* @copyright 2014 Tobias Friebel
* @license Creative Commons Attribution-NoDerivatives <http://creativecommons.org/licenses/by-nd/4.0/legalcode>
* @package com.toby.wbb.limitthreadview
* @subpackage system.event.listener
* @category WoltLab Burning Board
*/

require_once (WCF_DIR . 'lib/system/event/EventListener.class.php');

class LimitThreadViewListener implements EventListener
class LimitThreadViewListener implements IEventListener
{
/**
* @see EventListener::execute()
* @see \wcf\system\event\IEventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
Expand All @@ -26,9 +30,6 @@ public function execute($eventObj, $className, $eventName)
else
$limitCount = LIMIT_THREAD_VIEW_DEFAULT_LIMIT;

if ($eventObj->countItems() <= $limitCount)
return;

switch ($eventName)
{
case 'readData':
Expand All @@ -49,6 +50,9 @@ public function execute($eventObj, $className, $eventName)
break;

case 'assignVariables':
if ($eventObj->countItems() <= $limitCount)
return;

if ($limitCount <= $eventObj->itemsPerPage)
{
$eventObj->pages = 1;
Expand All @@ -62,10 +66,10 @@ public function execute($eventObj, $className, $eventName)

if ($eventObj->pageNo == $pageMaxNo && $count < $eventObj->itemsPerPage)
{
foreach ($eventObj->postList->posts as $i => $post)
foreach ($eventObj->objectList as $i => $post)
{
if ($i >= $count)
unset($eventObj->postList->posts[$i]);
unset($eventObj->objectList[$i]);
}
}
}
Expand All @@ -75,10 +79,7 @@ public function execute($eventObj, $className, $eventName)
$limitBox = WCF::getLanguage()->getDynamicVariable('wbb.thread.limitthreadview',
array('posts' => $eventObj->countItems()));

WCF :: getTPL()->append('userMessages', $limitBox);

if (LIMIT_THREAD_VIEW_SHOW_WARNING_DOWN)
WCF :: getTPL()->append('additionalBoxes', $limitBox);
WCF :: getTPL()->assign('limitMessageBox', $limitBox);
}
break;
}
Expand Down
10 changes: 2 additions & 8 deletions install.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
ALTER TABLE wbb1_1_board ADD
limitThreadView TINYINT( 1 ) NOT NULL DEFAULT -1;

ALTER TABLE wbb1_1_board_to_group ADD
canViewLimitedContent TINYINT(1) NOT NULL DEFAULT -1;

ALTER TABLE wbb1_1_board_to_user ADD
canViewLimitedContent TINYINT(1) NOT NULL DEFAULT -1;
ALTER TABLE wbb1_board ADD
limitThreadView TINYINT( 1 ) NOT NULL DEFAULT -1;
7 changes: 4 additions & 3 deletions de.utf-8.xml → language/de.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "DTD/language.dtd">
<language languagecode="de">
<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" languagename="Deutsch" countrycode="de">

<category name="wbb.acp.board">
<item name="wbb.acp.board.limitthreadview"><![CDATA[Themenansicht limitieren]]></item>
Expand All @@ -9,7 +10,7 @@
</category>

<category name="wbb.thread">
<item name="wbb.thread.limitthreadview"><![CDATA[<p class="info">Ihr Zugriff auf dieses Thema wurde eingeschränkt. Insgesamt gibt es {#$posts} {if $posts == 1}Beitrag{else}Beiträge{/if} in diesem Thema.<br />Um sie alle lesen zu können müssen Sie sich vorher <a href="index.php?page=Register">registrieren</a>/freischalten lassen.</p>]]></item>
<item name="wbb.thread.limitthreadview"><![CDATA[<p class="info">Ihr Zugriff auf dieses Thema wurde eingeschränkt. Insgesamt gibt es {#$posts} {if $posts == 1}Beitrag{else}Beiträge{/if} in diesem Thema.<br />Um sie alle lesen zu können müssen Sie sich vorher <a href="index.php/Disclaimer/">registrieren</a> oder freischalten lassen.</p>]]></item>
</category>

<category name="wcf.acp.group">
Expand Down
7 changes: 4 additions & 3 deletions en.utf-8.xml → language/en.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "DTD/language.dtd">
<language languagecode="en">
<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="en" languagename="English" countrycode="gb">code="en">

<category name="wbb.acp.board">
<item name="wbb.acp.board.limitthreadview"><![CDATA[Limit Threadview]]></item>
Expand All @@ -9,7 +10,7 @@
</category>

<category name="wbb.thread">
<item name="wbb.thread.limitthreadview"><![CDATA[Your access to this forum was limited. Overall there {if $posts == 1}is{else}are{/if} {#$posts} {if $posts == 1}post{else}posts{/if} in this thread.<br />To read them all you should <a href="index.php?page=Register">register</a> or let you unlock.]]></item>
<item name="wbb.thread.limitthreadview"><![CDATA[Your access to this forum was limited. Overall there {if $posts == 1}is{else}are{/if} {#$posts} {if $posts == 1}post{else}posts{/if} in this thread.<br />To read them all you should <a href="index.php/Disclaimer/">register</a> or let you unlock.]]></item>
</category>

<category name="wcf.acp.group">
Expand Down
Loading

0 comments on commit 2a00af1

Please sign in to comment.