Skip to content

Commit

Permalink
v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
IMC-GER committed Dec 15, 2023
1 parent e820bb1 commit 2485e68
Show file tree
Hide file tree
Showing 18 changed files with 544 additions and 61 deletions.
27 changes: 15 additions & 12 deletions README.md
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)
4 changes: 2 additions & 2 deletions numberactivetopics_version.json → activetopics_version.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"stable": {
"1.0": {
"current": "1.0.0",
"current": "1.1.0",
"announcement": "https://www.phpbb.de/community/viewtopic.php?t=246827",
"download": "https://github.com/IMC-GER/phpBB-Number-of-Active-Topics/tags",
"download": "https://github.com/IMC-GER/phpBB-Active-Topics/tags",
"eol": null,
"security": false
}
Expand Down
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 imcger/activetopics/adm/style/event/acp_overall_footer_after.html
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 %}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "imcger/numberactivetopics",
"name": "imcger/activetopics",
"type": "phpbb-extension",
"description": "This extension enables the setting, topics per page for active topics.",
"description": "This extension enables settings for active topics.",
"homepage": "",
"version": "1.0.0",
"time": "2023-07-29",
"version": "1.1.0",
"time": "2023-12-15",
"license": "GPL-2.0-only",
"authors": [{
"name": "Thorsten Ahlers",
Expand All @@ -16,14 +16,14 @@
"php": ">=7.1.3"
},
"extra": {
"display-name": "Number of Active Topics",
"display-name": "Active Topics",
"soft-require": {
"phpbb/phpbb": ">=3.3.0"
},
"version-check": {
"host": "raw.githubusercontent.com",
"directory": "/IMC-GER/phpBB-Number-of-Active-Topics/master",
"filename": "numberactivetopics_version.json",
"directory": "/IMC-GER/phpBB-Active-Topics/master",
"filename": "activetopics_version.json",
"ssl": true
}
}
Expand Down
19 changes: 19 additions & 0 deletions imcger/activetopics/config/services.yml
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 }

103 changes: 103 additions & 0 deletions imcger/activetopics/event/acp_listener.php
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;
}
}
Loading

0 comments on commit 2485e68

Please sign in to comment.