This repository has been archived by the owner on May 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tobias Friebel
committed
Jan 8, 2014
1 parent
f2c8710
commit 2a00af1
Showing
16 changed files
with
181 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
/** | ||
|
@@ -43,8 +47,6 @@ public function execute($eventObj, $className, $eventName) | |
'limitThreadView' => $this->limitThreadView, | ||
)); | ||
} | ||
|
||
WCF::getTPL()->append('additionalFields', WCF::getTPL()->fetch('limitThreadView')); | ||
break; | ||
} | ||
} | ||
|
20 changes: 12 additions & 8 deletions
20
files/lib/system/event/listener/LimitThreadViewFeedListener.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
{ | ||
|
@@ -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': | ||
|
@@ -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; | ||
|
@@ -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]); | ||
} | ||
} | ||
} | ||
|
@@ -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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.