-
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
Showing
18 changed files
with
544 additions
and
61 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 |
---|---|---|
@@ -1,37 +1,40 @@ | ||
# phpBB Number of Active Topics | ||
# phpBB Active Topics | ||
|
||
## Description | ||
If you configure a forum as a category, the active topics of the sub-forums can be displayed there. This extension allows you to set the number of topics. | ||
If you configure a forum as a category, the active topics of the sub-forums can be displayed there. This extension allows you to define the position of the active topics and the number of topics displayed. | ||
|
||
#### Settings in Administration Control Panel | ||
In "Manage Forums" -> "Edit Forum" | ||
- Display active topics above the forums | ||
- Topics per page | ||
|
||
## Screenshots | ||
- [ACP](https://raw.githubusercontent.com/IMC-GER/images/main/screenshots/numberactivetopics/en/acp-edit-forum.png) | ||
- [ACP](https://raw.githubusercontent.com/IMC-GER/images/main/screenshots/activetopics/acp_en.png) | ||
- [Forum](https://raw.githubusercontent.com/IMC-GER/images/main/screenshots/activetopics/forum.png) | ||
|
||
## Requirements | ||
- phpBB 3.3.0 or higher | ||
|
||
## Installation | ||
Copy the extension to `phpBB3/ext/imcger/numberactivetopics`. | ||
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Number of Active Topics" extension. | ||
Copy the extension to `phpBB3/ext/imcger/activetopics`. | ||
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Active Topics" extension. | ||
|
||
## Update | ||
- Navigate in the ACP to `Customise -> Manage extensions`. | ||
- Click the `Disable` link for "Number of Active Topics". | ||
- Delete the `numberactivetopics` folder from `phpBB3/ext/imcger/`. | ||
- Copy the extension to `phpBB3/ext/imcger/numberactivetopics`. | ||
- Go to "ACP" > "Customise" > "Manage extensions" and enable the "Number of Active Topics" extension. | ||
- Click the `Disable` link for "Active Topics". | ||
- Delete the `activetopics` folder from `phpBB3/ext/imcger/`. | ||
- Copy the extension to `phpBB3/ext/imcger/activetopics`. | ||
- Go to "ACP" > "Customise" > "Manage extensions" and enable the "Active Topics" extension. | ||
|
||
## Changelog | ||
|
||
### v1.0.0 (29-07-2023) | ||
### v1.1.0 (15-12-2023) | ||
- Published | ||
|
||
## Uninstallation | ||
- Navigate in the ACP to `Customise -> Manage extensions`. | ||
- Click the `Disable` link for "Number of Active Topics". | ||
- To permanently uninstall, click `Delete Data`, then delete the `numberactivetopics` folder from `phpBB3/ext/imcger/`. | ||
- Click the `Disable` link for "Active Topics". | ||
- To permanently uninstall, click `Delete Data`, then delete the `activetopics` folder from `phpBB3/ext/imcger/`. | ||
|
||
## License | ||
[GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) |
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
28 changes: 16 additions & 12 deletions
28
imcger/numberactivetopics/README.md → imcger/activetopics/README.md
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,37 +1,41 @@ | ||
# phpBB Number of Active Topics | ||
# phpBB Active Topics | ||
|
||
## Description | ||
If you configure a forum as a category, the active topics of the sub-forums can be displayed there. This extension allows you to set the number of topics. | ||
If you configure a forum as a category, the active topics of the sub-forums can be displayed there. | ||
This extension allows you to define the position of the active topics and the number of topics displayed. | ||
|
||
#### Settings in Administration Control Panel | ||
In "Manage Forums" -> "Edit Forum" | ||
- Display active topics above the forums | ||
- Topics per page | ||
|
||
## Screenshots | ||
- [ACP](https://raw.githubusercontent.com/IMC-GER/images/main/screenshots/numberactivetopics/en/acp-edit-forum.png) | ||
- [ACP](https://raw.githubusercontent.com/IMC-GER/images/main/screenshots/activetopics/acp_en.png) | ||
- [Forum](https://raw.githubusercontent.com/IMC-GER/images/main/screenshots/activetopics/forum.png) | ||
|
||
## Requirements | ||
- phpBB 3.3.0 or higher | ||
|
||
## Installation | ||
Copy the extension to `phpBB3/ext/imcger/numberactivetopics`. | ||
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Number of Active Topics" extension. | ||
Copy the extension to `phpBB3/ext/imcger/activetopics`. | ||
Go to "ACP" > "Customise" > "Manage extensions" and enable the "Active Topics" extension. | ||
|
||
## Update | ||
- Navigate in the ACP to `Customise -> Manage extensions`. | ||
- Click the `Disable` link for "Number of Active Topics". | ||
- Delete the `numberactivetopics` folder from `phpBB3/ext/imcger/`. | ||
- Copy the extension to `phpBB3/ext/imcger/numberactivetopics`. | ||
- Go to "ACP" > "Customise" > "Manage extensions" and enable the "Number of Active Topics" extension. | ||
- Click the `Disable` link for "Active Topics". | ||
- Delete the `activetopics` folder from `phpBB3/ext/imcger/`. | ||
- Copy the extension to `phpBB3/ext/imcger/activetopics`. | ||
- Go to "ACP" > "Customise" > "Manage extensions" and enable the "Active Topics" extension. | ||
|
||
## Changelog | ||
|
||
### v1.0.0 (29-07-2023) | ||
### v1.1.0 (15-12-2023) | ||
- Published | ||
|
||
## Uninstallation | ||
- Navigate in the ACP to `Customise -> Manage extensions`. | ||
- Click the `Disable` link for "Number of Active Topics". | ||
- To permanently uninstall, click `Delete Data`, then delete the `numberactivetopics` folder from `phpBB3/ext/imcger/`. | ||
- Click the `Disable` link for "Active Topics". | ||
- To permanently uninstall, click `Delete Data`, then delete the `activetopics` folder from `phpBB3/ext/imcger/`. | ||
|
||
## License | ||
[GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) |
36 changes: 36 additions & 0 deletions
36
imcger/activetopics/adm/style/event/acp_overall_footer_after.html
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,36 @@ | ||
{# | ||
Active Topics | ||
An extension for the phpBB Forum Software package. | ||
|
||
@copyright (c) 2023, Thorsten Ahlers | ||
@license GNU General Public License, version 2 (GPL-2.0) | ||
#} | ||
{% if FORUM_POST || FORUM_LINK || FORUM_CAT %} | ||
<script> | ||
(function($) { // Avoid conflicts with other libraries | ||
|
||
'use strict'; | ||
|
||
// Insert a radio button element after "Activate active topics" to define the position of the active topics | ||
$('#forum_cat_options fieldset dl').after( | ||
'<dl>' + | ||
'<dt><label for="imcger_display_active_position">{{ lang('IMCGER_DISPLAY_ACTIVE_POSITION') ~ lang('COLON') }}</label><br><span>{{ lang('IMCGER_DISPLAY_ACTIVE_POSITION_DESC') }}</span></dt>' + | ||
'<dd><label><input type="radio" class="radio" name="imcger_display_active_position" value="1"{{ IMCGER_DISPLAY_ACTIVE_POSITION == 1 ? ' checked' }}> {{ lang('YES') }}</label>' + | ||
'<label><input type="radio" class="radio" name="imcger_display_active_position" value="0"{{ IMCGER_DISPLAY_ACTIVE_POSITION == 0 ? ' checked' }}> {{ lang('NO') }}</label></dd>' + | ||
'</dl>' | ||
); | ||
|
||
// Enables the setting, number of posts in active topics | ||
$('#forum_type').on('change', function() { | ||
if ($('select#forum_type option:checked').val() == {{ FORUM_CAT }}) { | ||
$('#forum_cat_options fieldset').append($('#topics_per_page').closest('dl')); | ||
} else { | ||
$('#forum_post_options fieldset').append($('#topics_per_page').closest('dl')); | ||
} | ||
}); | ||
|
||
$('#forum_type').trigger('change'); | ||
|
||
})(jQuery); // Avoid conflicts with other libraries | ||
</script> | ||
{% endif %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
services: | ||
imcger.activetopics.acp_listener: | ||
class: imcger\activetopics\event\acp_listener | ||
arguments: | ||
- '@request' | ||
- '@language' | ||
tags: | ||
- { name: event.listener } | ||
|
||
imcger.activetopics.main_listener: | ||
class: imcger\activetopics\event\main_listener | ||
arguments: | ||
- '@template' | ||
- '@dbal.conn' | ||
- '%core.root_path%' | ||
- '%core.php_ext%' | ||
tags: | ||
- { name: event.listener } | ||
|
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,103 @@ | ||
<?php | ||
/** | ||
* Active Topics | ||
* An extension for the phpBB Forum Software package. | ||
* | ||
* @copyright (c) 2023, Thorsten Ahlers | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
namespace imcger\activetopics\event; | ||
|
||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
/** | ||
* Event listener | ||
*/ | ||
class acp_listener implements EventSubscriberInterface | ||
{ | ||
/** @var \phpbb\request\request */ | ||
protected $request; | ||
|
||
/** @var \phpbb\language\language */ | ||
protected $language; | ||
|
||
/** | ||
* listener constructor. | ||
* | ||
* @param \phpbb\request\request $request | ||
* @param \phpbb\language\language $language | ||
*/ | ||
public function __construct | ||
( | ||
\phpbb\request\request $request, | ||
\phpbb\language\language $language | ||
) | ||
{ | ||
$this->request = $request; | ||
$this->language = $language; | ||
} | ||
|
||
/** | ||
* Get subscribed events | ||
* | ||
* @return array | ||
* @static | ||
*/ | ||
public static function getSubscribedEvents() | ||
{ | ||
return [ | ||
'core.acp_manage_forums_request_data' => 'acp_manage_forums_request_data', | ||
'core.acp_manage_forums_initialise_data' => 'acp_manage_forums_initialise_data', | ||
'core.acp_manage_forums_display_form' => 'acp_manage_forums_display_form', | ||
]; | ||
} | ||
|
||
/** | ||
* Submit form (add/update) | ||
* | ||
* @param \phpbb\event\data $event The event object | ||
* @return null | ||
* @access public | ||
*/ | ||
public function acp_manage_forums_request_data($event) | ||
{ | ||
$array = $event['forum_data']; | ||
$array['imcger_display_active_position'] = $this->request->variable('imcger_display_active_position', 0); | ||
$event['forum_data'] = $array; | ||
} | ||
|
||
/** | ||
* Default settings for new forums | ||
* | ||
* @param \phpbb\event\data $event The event object | ||
* @return null | ||
* @access public | ||
*/ | ||
public function acp_manage_forums_initialise_data($event) | ||
{ | ||
if ($event['action'] == 'add') | ||
{ | ||
$array = $event['forum_data']; | ||
$array['imcger_display_active_position'] = '0'; | ||
$event['forum_data'] = $array; | ||
} | ||
} | ||
|
||
/** | ||
* ACP forums template output | ||
* | ||
* @param \phpbb\event\data $event The event object | ||
* @return null | ||
* @access public | ||
*/ | ||
public function acp_manage_forums_display_form($event) | ||
{ | ||
$this->language->add_lang('common', 'imcger/activetopics'); | ||
|
||
$array = $event['template_data']; | ||
$array['IMCGER_DISPLAY_ACTIVE_POSITION'] = $event['forum_data']['imcger_display_active_position']; | ||
$event['template_data'] = $array; | ||
} | ||
} |
Oops, something went wrong.