Skip to content

Commit c453678

Browse files
Refactor module to Joomla 5 structure
1 parent ace21a1 commit c453678

File tree

9 files changed

+280
-120
lines changed

9 files changed

+280
-120
lines changed

src/component/modules/mod_migrationnotice/language/en-GB/en-GB.mod_migrationnotice.ini renamed to src/component/modules/mod_migrationnotice/language/en-GB/mod_migrationnotice.ini

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
; Migration Notice Module Language File
2-
; Copyright (C) 2025 Joomla Academy. All rights reserved.
3-
; License GNU General Public License version 2 or later
42

5-
; Module Description
63
MOD_MIGRATIONNOTICE_XML_DESCRIPTION="A module that helps site administrators explain password resets to end users during and after migration from WordPress to Joomla. Provides clear information about the need to use Joomla's password reset feature due to security requirements when upgrading to a new platform."
74

85
; Basic Configuration
96
MOD_MIGRATIONNOTICE_FIELDSET_BASIC_LABEL="Basic Settings"
107

11-
MOD_MIGRATIONNOTICE_FIELD_SHOW_NOTICE_LABEL="Show Migration Notice"
12-
MOD_MIGRATIONNOTICE_FIELD_SHOW_NOTICE_DESC="Display the migration notice to users."
13-
14-
MOD_MIGRATIONNOTICE_FIELD_NOTICE_TYPE_LABEL="Notice Type"
15-
MOD_MIGRATIONNOTICE_FIELD_NOTICE_TYPE_DESC="Choose what type of information to display to users."
16-
MOD_MIGRATIONNOTICE_OPTION_MIGRATION_ONLY="Migration Information Only"
17-
MOD_MIGRATIONNOTICE_OPTION_PASSWORD_ONLY="Password Reset Information Only"
18-
MOD_MIGRATIONNOTICE_OPTION_BOTH="Both Migration and Password Information"
8+
MOD_MIGRATIONNOTICE_FIELD_CUSTOM_MESSAGE_LABEL="Custom Message"
9+
MOD_MIGRATIONNOTICE_FIELD_CUSTOM_MESSAGE_DESC="Optional custom message to override the default migration message. Leave empty to use default text."
1910

2011
MOD_MIGRATIONNOTICE_FIELD_ALERT_TYPE_LABEL="Alert Style"
2112
MOD_MIGRATIONNOTICE_FIELD_ALERT_TYPE_DESC="Choose the visual style for the alert messages."
@@ -24,27 +15,33 @@ MOD_MIGRATIONNOTICE_OPTION_WARNING="Warning (Yellow)"
2415
MOD_MIGRATIONNOTICE_OPTION_SUCCESS="Success (Green)"
2516
MOD_MIGRATIONNOTICE_OPTION_ERROR="Error (Red)"
2617

18+
MOD_MIGRATIONNOTICE_FIELD_NOTICE_TYPE_LABEL="Notice Type"
19+
MOD_MIGRATIONNOTICE_FIELD_NOTICE_TYPE_DESC="Choose what type of information to display to users."
20+
MOD_MIGRATIONNOTICE_OPTION_MIGRATION_ONLY="Migration Information Only"
21+
MOD_MIGRATIONNOTICE_OPTION_PASSWORD_ONLY="Password Reset Information Only"
22+
MOD_MIGRATIONNOTICE_OPTION_BOTH="Both Migration and Password Information"
23+
24+
MOD_MIGRATIONNOTICE_FIELD_SHOW_NOTICE_LABEL="Show Migration Notice"
25+
MOD_MIGRATIONNOTICE_FIELD_SHOW_NOTICE_DESC="Display the migration notice to users."
26+
2727
MOD_MIGRATIONNOTICE_FIELD_SHOW_RESET_LINK_LABEL="Show Password Reset Link"
2828
MOD_MIGRATIONNOTICE_FIELD_SHOW_RESET_LINK_DESC="Display a direct link to the password reset form."
2929

30-
MOD_MIGRATIONNOTICE_FIELD_CUSTOM_MESSAGE_LABEL="Custom Message"
31-
MOD_MIGRATIONNOTICE_FIELD_CUSTOM_MESSAGE_DESC="Optional custom message to override the default migration message. Leave empty to use default text."
32-
3330
; Frontend Messages
31+
MOD_MIGRATIONNOTICE_ADMIN_TITLE="For Site Administrators"
32+
MOD_MIGRATIONNOTICE_ADMIN_MESSAGE="Site Administrators need to contact the site owner to reset their passwords."
33+
34+
MOD_MIGRATIONNOTICE_GUEST_INFO="If you had an account on our previous website, you'll need to reset your password before logging in."
35+
3436
MOD_MIGRATIONNOTICE_MIGRATION_TITLE="Website Migration Complete"
3537
MOD_MIGRATIONNOTICE_MIGRATION_MESSAGE="Welcome to our upgraded website! We've successfully migrated from WordPress to Joomla to provide you with a better, more secure experience."
3638

3739
MOD_MIGRATIONNOTICE_PASSWORD_TITLE="Important: Password Reset Required"
3840
MOD_MIGRATIONNOTICE_PASSWORD_MESSAGE="For security reasons, your existing password cannot be transferred from the previous platform. Please use the password reset feature below to create a new password for your account."
3941

40-
MOD_MIGRATIONNOTICE_GUEST_INFO="If you had an account on our previous website, you'll need to reset your password before logging in."
41-
42-
MOD_MIGRATIONNOTICE_ADMIN_TITLE="For Site Administrators"
43-
MOD_MIGRATIONNOTICE_ADMIN_MESSAGE="Site Administrators need to contact the site owner to reset their passwords."
44-
4542
; Buttons and Links
4643
MOD_MIGRATIONNOTICE_LOGIN_BUTTON="Login"
4744
MOD_MIGRATIONNOTICE_RESET_PASSWORD_BUTTON="Reset Password"
4845

49-
; Legacy compatibility (aligns with script.php overrides)
50-
MOD_MIGRATION_NOTICE="Your site has been migrated from WordPress. For security, existing WordPress passwords cannot be used in Joomla. Please reset your password using the 'Forgot Password' link."OD_MIGRATION_NOTICE="Your site has been migrated from WordPress. For security, existing WordPress passwords cannot be used in Joomla. Please reset your password using the ‘Forgot Password’ link."
46+
; Legacy compatibility / general notice
47+
MOD_MIGRATION_NOTICE="Your site has been migrated from WordPress. For security, existing WordPress passwords cannot be used in Joomla. Please reset your password using the 'Forgot Password' link."

src/component/modules/mod_migrationnotice/language/en-GB/en-GB.mod_migrationnotice.sys.ini renamed to src/component/modules/mod_migrationnotice/language/en-GB/mod_migrationnotice.sys.ini

File renamed without changes.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* @package Migration Notice Module
3+
* @subpackage mod_migrationnotice
4+
* @copyright Copyright (C) 2025 Joomla Academy. All rights reserved.
5+
* @license GNU General Public License version 2 or later; see LICENSE.txt
6+
*/
7+
8+
.migration-notice-module .alert {
9+
margin-bottom: 1rem;
10+
}
11+
12+
.migration-notice-module .alert-heading {
13+
margin-bottom: 0.75rem;
14+
font-size: 1.1rem;
15+
}
16+
17+
.migration-notice-module .alert-heading .icon-info-circle,
18+
.migration-notice-module .alert-heading .icon-key {
19+
margin-right: 0.5rem;
20+
}
21+
22+
.migration-notice-module .btn {
23+
margin-top: 0.5rem;
24+
}
25+
26+
.migration-notice-module .btn .icon-lock,
27+
.migration-notice-module .btn .icon-refresh {
28+
margin-right: 0.25rem;
29+
}
30+
31+
.migration-notice-module .admin-info {
32+
border-left: 4px solid #17a2b8;
33+
}
34+
35+
@media (max-width: 576px) {
36+
.migration-notice-module .btn {
37+
width: 100%;
38+
margin-top: 0.75rem;
39+
}
40+
}

src/component/modules/mod_migrationnotice/mod_migrationnotice.php

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/component/modules/mod_migrationnotice/mod_migrationnotice.xml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* @package Migration Notice Module
5+
* @subpackage mod_migrationnotice
6+
* @copyright Copyright (C) 2025 Open Source Matters, Inc.
7+
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
-->
210
<extension type="module" version="5.0" client="site" method="upgrade">
3-
<name>mod_migrationnotice</name>
4-
<title>Migration Notice Module</title>
11+
<name>MOD_MIGRATIONNOTICE</name>
512
<description>MOD_MIGRATIONNOTICE_XML_DESCRIPTION</description>
613
<version>1.0.0</version>
714
<author>Joomla Academy</author>
@@ -10,15 +17,23 @@
1017
<copyright>Copyright (C) 2025 Joomla Academy. All rights reserved.</copyright>
1118
<license>GNU General Public License version 2 or later</license>
1219

20+
<namespace path="src">Joomla\Module\MigrationNotice</namespace>
21+
1322
<files>
14-
<filename module="mod_migrationnotice">mod_migrationnotice.php</filename>
23+
<folder module="mod_migrationnotice">services</folder>
24+
<folder>src</folder>
1525
<folder>tmpl</folder>
1626
<folder>language</folder>
27+
<folder>media</folder>
1728
</files>
1829

30+
<media destination="mod_migrationnotice" folder="media">
31+
<folder>css</folder>
32+
</media>
33+
1934
<languages>
20-
<language tag="en-GB">language/en-GB/en-GB.mod_migrationnotice.ini</language>
21-
<language tag="en-GB">language/en-GB/en-GB.mod_migrationnotice.sys.ini</language>
35+
<language tag="en-GB">language/en-GB/mod_migrationnotice.ini</language>
36+
<language tag="en-GB">language/en-GB/mod_migrationnotice.sys.ini</language>
2237
</languages>
2338

2439
<scriptfile>script.php</scriptfile>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* @package Migration Notice Module
5+
* @subpackage mod_migrationnotice
6+
* @copyright Copyright (C) 2025 Open Source Matters, Inc.
7+
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
10+
\defined('_JEXEC') or die;
11+
12+
use Joomla\CMS\Extension\Service\Provider\Module as ModuleServiceProvider;
13+
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory as ModuleDispatcherFactoryServiceProvider;
14+
use Joomla\DI\Container;
15+
use Joomla\DI\ServiceProviderInterface;
16+
17+
return new class () implements ServiceProviderInterface {
18+
/**
19+
* Registers the service provider with a DI container.
20+
*
21+
* @param Container $container The DI container.
22+
*
23+
* @return void
24+
*
25+
* @since 1.0.0
26+
*/
27+
public function register(Container $container): void
28+
{
29+
$container->registerServiceProvider(new ModuleDispatcherFactoryServiceProvider('\\Joomla\\Module\\MigrationNotice'));
30+
$container->registerServiceProvider(new ModuleServiceProvider());
31+
}
32+
};
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
3+
/**
4+
* @package Migration Notice Module
5+
* @subpackage mod_migrationnotice
6+
* @copyright Copyright (C) 2025 Open Source Matters, Inc.
7+
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
10+
namespace Joomla\Module\MigrationNotice\Site\Dispatcher;
11+
12+
\defined('_JEXEC') or die;
13+
14+
use Joomla\CMS\Application\CMSApplicationInterface;
15+
use Joomla\CMS\Dispatcher\DispatcherInterface;
16+
use Joomla\CMS\Helper\ModuleHelper;
17+
use Joomla\CMS\HTML\HTMLHelper;
18+
use Joomla\Input\Input;
19+
use Joomla\Registry\Registry;
20+
use Joomla\Module\MigrationNotice\Site\Helper\MigrationNoticeHelper;
21+
22+
/**
23+
* Dispatcher class for mod_migrationnotice
24+
*
25+
* @since 1.0.0
26+
*/
27+
class Dispatcher implements DispatcherInterface
28+
{
29+
/**
30+
* The module object
31+
*
32+
* @var \stdClass
33+
*
34+
* @since 1.0.0
35+
*/
36+
protected $module;
37+
38+
/**
39+
* The application object
40+
*
41+
* @var CMSApplicationInterface
42+
*
43+
* @since 1.0.0
44+
*/
45+
protected $app;
46+
47+
/**
48+
* The input object
49+
*
50+
* @var Input
51+
*
52+
* @since 1.0.0
53+
*/
54+
protected $input;
55+
56+
/**
57+
* Constructor for Dispatcher
58+
*
59+
* @param \stdClass $module The module object
60+
* @param CMSApplicationInterface $app The application object
61+
* @param Input $input The input object
62+
*
63+
* @since 1.0.0
64+
*/
65+
public function __construct(\stdClass $module, CMSApplicationInterface $app, Input $input)
66+
{
67+
$this->module = $module;
68+
$this->app = $app;
69+
$this->input = $input;
70+
}
71+
72+
/**
73+
* Dispatch a module
74+
*
75+
* @return void
76+
*
77+
* @since 1.0.0
78+
*/
79+
public function dispatch()
80+
{
81+
// Load the language file
82+
$language = $this->app->getLanguage();
83+
$language->load('mod_migrationnotice', JPATH_BASE . '/modules/mod_migrationnotice');
84+
85+
// Get module parameters
86+
$params = new Registry($this->module->params);
87+
88+
// Check if the notice should be shown
89+
$showNotice = (bool) $params->get('show_notice', 1);
90+
91+
if (!$showNotice) {
92+
return;
93+
}
94+
95+
// Get the helper directly
96+
$helper = new MigrationNoticeHelper();
97+
98+
// Prepare module data
99+
$moduleData = $helper->getModuleData($params, $this->app);
100+
101+
// Load the module CSS
102+
HTMLHelper::_('stylesheet', 'mod_migrationnotice/module.css', ['version' => 'auto', 'relative' => true]);
103+
104+
// Include the template
105+
require ModuleHelper::getLayoutPath('mod_migrationnotice', $params->get('layout', 'default'));
106+
}
107+
}

0 commit comments

Comments
 (0)