Skip to content

Commit dfc1902

Browse files
committed
3.1.0-b17
1 parent 8eb0c40 commit dfc1902

8 files changed

Lines changed: 75 additions & 22 deletions

ext-mgr-plus_build_changelog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
#### 3.1.0-b17
2+
* Mit der EMP eigenen Variante von `trigger_error` können jetzt nicht nur positive Bestätigungen (Grün) und Fehlermeldungen (Rot) dargestellt werden, sondern auch Warnungen (Orange). Das ist eine konsequente Weiterentwicklung der Änderung in 1.0.1, bei der bereits eine einzige nicht geschaltete Ext genügte, dass für die Bestätigungsmeldung eine rote Box generiert wurde. Dazu waren Änderungen in verschiedenen Dateien notwendig:
3+
* In der PHP Funktion `trigger_error_` wird basierend auf dem übergebenen Error Level in der Template Variable `EXTMGRPLUS_TRIGGER_ERROR` ein Wert von `0` (Info), `1` (Warnung) oder `2` (Fehler) definiert. Bisher wurde in dieser Variable lediglich `true` als Wert verwendet.
4+
* Im `trigger_error` Template wird anhand `EXTMGRPLUS_TRIGGER_ERROR` die passende CSS Klasse verwendet.
5+
* Im CSS neue Regeln für `emp_warning` hinzugefügt.
6+
* Basierend auf der neuen Möglichkeit Warnungen anzeigen zu können, wird jetzt bei teilweise geschalteten Erweiterungen keine rote Box mehr angezeigt, sondern eine orange Box. Eine rote Box wird nur noch dann angezeigt, wenn keine einzige Ext geschaltet werden konnte.
7+
* Core:
8+
* Hilfsfunktion `get_error_level` eingebaut zur Ermittlung des Error Levels nach dem Schalten (Deaktivieren/Aktivieren).
9+
* Die Funktionen zum Aktivieren/Deaktivieren an die neue Hilfsfunktion angepasst.
10+
* ExtMgr Template:
11+
* Mehrere Klassen umbenannt um Kollisionsgefahr mit anderen Exts zu reduzieren.
12+
* JS:
13+
* Code an die umbenannten Klassen angepasst.
14+
* CSS:
15+
* Regeln an die umbenannten Klassen angepasst.
16+
* Regeln für die EMP Warnung hinzugefügt.
17+
118
#### 3.1.0-b16
219
* Fix: Logikfehler bei b15 behoben. Beim Vergleich von Homepage Link und CDB Link wurde nicht berücksichtigt, dass der Homepage Link auch leer sein kann, was dann dazu führen konnte, dass die Zeile für Homepage mit leerem Link angezeigt wurde.
320
* Code Optimierung und Bereinigung:

lukewcs/extmgrplus/adm/style/acp_ext_mgr_plus.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,26 @@ code {
2828
color: black;
2929
}
3030

31-
.inactive {
31+
.emp_inactive {
3232
opacity: 0.5;
3333
}
3434

35-
.unavailable {
35+
.emp_unavailable {
3636
opacity: 0.3;
3737
}
3838

39+
.errorbox.emp_warning {
40+
background-color: #ffbb33;
41+
}
42+
43+
.errorbox.emp_warning :is(a, a:visited) {
44+
color: #505050;
45+
}
46+
47+
.errorbox.emp_warning :is(h3, p, a:hover) {
48+
color: #303030;
49+
}
50+
3951
.extmgrplus_footer {
4052
margin-top: 1em;
4153
text-align: center;
@@ -49,7 +61,7 @@ code {
4961
}
5062

5163
button:is(.button1, .button2) {
52-
color: #000;
64+
color: #000000;
5365
background-image: -webkit-linear-gradient(top, #d2d2d2 0%, #efefef 100%);
5466
background-image: linear-gradient(to bottom, #d2d2d2 0%, #efefef 100%);
5567
padding: 3px 2px;

lukewcs/extmgrplus/adm/style/acp_ext_mgr_plus_acp_ext_list.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h1>{{ lang('EXTENSIONS_ADMIN') }}</h1>
8888
<fieldset class="ext_properties" style="display: none;">
8989
<legend>{{ lang('EXTMGRPLUS_SECTION_SETTINGS') }}</legend>
9090

91-
<dl{{ !EXTMGRPLUS_SWITCH_ORDER_AND_IGNORE ? ' class="inactive"' }}>
91+
<dl{{ !EXTMGRPLUS_SWITCH_ORDER_AND_IGNORE ? ' class="emp_inactive"' }}>
9292
<dt>
9393
<label>{{ lang('EXTMGRPLUS_ORDER', common.icon('fa-sort')) ~ lang('COLON') }}</label><br>
9494
</dt>
@@ -104,7 +104,7 @@ <h1>{{ lang('EXTENSIONS_ADMIN') }}</h1>
104104
</dd>
105105
</dl>
106106

107-
<dl{{ !EXTMGRPLUS_SWITCH_ORDER_AND_IGNORE ? ' class="inactive"' }}>
107+
<dl{{ !EXTMGRPLUS_SWITCH_ORDER_AND_IGNORE ? ' class="emp_inactive"' }}>
108108
<dt>
109109
<label>{{ lang('EXTMGRPLUS_IGNORE', common.icon('fa-ban')) ~ lang('COLON') }}</label><br>
110110
</dt>
@@ -275,7 +275,7 @@ <h1>{{ lang('EXTENSIONS_ADMIN') }}</h1>
275275
{% if EXTMGRPLUS_LIST_MODULES[ext.NAME] is defined %}
276276
<a href="{{ EXTMGRPLUS_LIST_MODULES[ext.NAME] }}" title="{{ lang('EXTMGRPLUS_TOOLTIP_SETTINGS') }}">{{ lang('SETTINGS') }}</a>
277277
{% else %}
278-
<span class="unavailable">{{ lang('SETTINGS') }}</span>
278+
<span class="emp_unavailable">{{ lang('SETTINGS') }}</span>
279279
{% endif %}
280280
{% endif %}
281281
{% endapply %}
@@ -296,7 +296,7 @@ <h1>{{ lang('EXTENSIONS_ADMIN') }}</h1>
296296
<td style="display: none;">
297297
{% apply spaceless %}
298298
{% if ext.NAME is defined && ext.NAME != 'lukewcs/extmgrplus' && EXTMGRPLUS_SWITCH_ORDER_AND_IGNORE %}
299-
<input type="text" name="ext_order[{{ ext.NAME }}]" size="2" maxlength="3"{{ EXTMGRPLUS_LIST_IGNORE[ext.NAME] is defined ? ' class="inactive"' }} title="{{ lang('EXTMGRPLUS_TOOLTIP_ORDER')|e('html') }}" value="{{ EXTMGRPLUS_LIST_ORDER[ext.NAME] ?? '' }}" pattern="^\+?[0-9]{1,2}$">
299+
<input type="text" name="ext_order[{{ ext.NAME }}]" size="2" maxlength="3"{{ EXTMGRPLUS_LIST_IGNORE[ext.NAME] is defined ? ' class="emp_inactive"' }} title="{{ lang('EXTMGRPLUS_TOOLTIP_ORDER')|e('html') }}" value="{{ EXTMGRPLUS_LIST_ORDER[ext.NAME] ?? '' }}" pattern="^\+?[0-9]{1,2}$">
300300
{% endif %}
301301
{% endapply %}
302302
</td>

lukewcs/extmgrplus/adm/style/acp_ext_mgr_plus_acp_ext_list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function setButtonState(e) {
9797
};
9898

9999
function setInputBoxState(e) {
100-
$('input[name="ext_order[' + e.currentTarget.value + ']"]').toggleClass('inactive', e.currentTarget.checked);
100+
$('input[name="ext_order[' + e.currentTarget.value + ']"]').toggleClass('emp_inactive', e.currentTarget.checked);
101101
};
102102

103103
/*

lukewcs/extmgrplus/adm/style/acp_ext_mgr_plus_message_body.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h1>{{ lang('EXTENSIONS_ADMIN') }}</h1>
2222
<p>{{ lang('EXTENSION_' ~ EXTMGRPLUS_ACTION_MODE ~ '_EXPLAIN') }}</p>
2323
{%- endif %}
2424

25-
<div class="{{ S_USER_NOTICE ? 'successbox' : 'errorbox' }}">
25+
<div class="{{ {0: 'successbox', 1: 'errorbox emp_warning', 2: 'errorbox'}[EXTMGRPLUS_TRIGGER_ERROR] }}">
2626
<h3>{{ MESSAGE_TITLE }}</h3>
2727

2828
<p>{{ MESSAGE_TEXT }}</p>

lukewcs/extmgrplus/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"description": "Adds the option to disable and re-enable all installed extensions at once to the extension management. Individual selections can be made using checkboxes. In addition, sequence groups and dependencies can be defined or extensions can be ignored. The version check is carried out in blocks and provides detailed information. Additional information is displayed in the extension management.",
55
"homepage": "https://github.com/LukeWCS/ext-mgr-plus",
6-
"version": "3.1.0-b16",
7-
"time": "2025-04-23",
6+
"version": "3.1.0-b17",
7+
"time": "2025-06-02",
88
"license": "GPL-2.0-only",
99
"authors": [
1010
{

lukewcs/extmgrplus/core/ext_mgr_plus.php

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public function ext_manager_after($event): void
305305
*/
306306
public function change_msg_template(): void
307307
{
308-
if ($this->template->retrieve_var('EXTMGRPLUS_TRIGGER_ERROR'))
308+
if ($this->template->retrieve_var('EXTMGRPLUS_TRIGGER_ERROR') !== null)
309309
{
310310
$this->template->set_filenames(['body' => '@lukewcs_extmgrplus/acp_ext_mgr_plus_message_body.html']);
311311
}
@@ -486,7 +486,7 @@ private function exts_disable(): void
486486
}
487487
$this->common->trigger_error_(
488488
$this->language->lang('EXTMGRPLUS_MSG_DEACTIVATION', $ext_count_success, $ext_count_enabled) . ($msg_failed ?? ''),
489-
(($ext_count_success != $ext_count_enabled || $safe_time_exceeded) ? E_USER_WARNING : E_USER_NOTICE),
489+
$this->get_error_level($ext_count_success, $ext_count_enabled, $safe_time_exceeded),
490490
'RETURN_TO_EXTENSION_LIST'
491491
);
492492
}
@@ -604,7 +604,7 @@ private function exts_enable(): void
604604
}
605605
$this->common->trigger_error_(
606606
$this->language->lang('EXTMGRPLUS_MSG_ACTIVATION', $ext_count_success, $ext_count_disabled) . ($msg_failed ?? ''),
607-
(($ext_count_success != $ext_count_disabled || $safe_time_exceeded) ? E_USER_WARNING : E_USER_NOTICE),
607+
$this->get_error_level($ext_count_success, $ext_count_disabled, $safe_time_exceeded),
608608
'RETURN_TO_EXTENSION_LIST'
609609
);
610610
}
@@ -642,6 +642,25 @@ private function create_failed_msg(string $display_name, string $ext_version, st
642642
);
643643
}
644644

645+
/*
646+
Helper function for trigger_error
647+
*/
648+
function get_error_level(int $count_success, int $count_total, bool $safe_time_exceeded): int
649+
{
650+
if ($count_success == 0 || $safe_time_exceeded)
651+
{
652+
return E_USER_WARNING;
653+
}
654+
else if ($count_success != $count_total)
655+
{
656+
return E_USER_NOTICE + E_USER_WARNING;
657+
}
658+
else
659+
{
660+
return E_USER_NOTICE;
661+
}
662+
}
663+
645664
/*
646665
Determine all extensions that have new migrations from the passed list of extensions
647666
*/
@@ -697,14 +716,14 @@ private function get_module_links(): array
697716
global $module;
698717

699718
$module_urls = [];
700-
foreach (array_filter($module->module_ary, fn($row) => $row['name'] != '' && $row['display'] == 1) as $module_)
719+
foreach (array_filter($module->module_ary, fn($row): bool => $row['name'] != '' && $row['display'] == 1) as $module_row)
701720
{
702-
preg_match('/\\\\(.+?)\\\\(.+?)\\\\.*/', $module_['name'], $matches);
721+
preg_match('/\\\\(.+?)\\\\(.+?)\\\\.*/', $module_row['name'], $matches);
703722
$tech_name = (count($matches) == 3) ? $matches[1] . '/' . $matches[2] : false;
704723
if ($tech_name !== false && !isset($module_urls[$tech_name]))
705724
{
706-
$module_name = str_replace('\\', '-', $module_['name']);
707-
$module_urls[$tech_name] = append_sid("{$this->phpbb_admin_path}index.{$this->php_ext}", "i={$module_name}&amp;mode={$module_['mode']}");
725+
$module_name = str_replace('\\', '-', $module_row['name']);
726+
$module_urls[$tech_name] = append_sid("{$this->phpbb_admin_path}index.{$this->php_ext}", "i={$module_name}&amp;mode={$module_row['mode']}");
708727
}
709728
}
710729

lukewcs/extmgrplus/core/ext_mgr_plus_common.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,20 @@ public function check_form_key_(string $key): void
158158
/*
159159
Wrapper for trigger_error
160160
*/
161-
public function trigger_error_(string $message, int $error_type, ?string $back_link_lang_var = null): void
161+
public function trigger_error_(string $message, int $error_level, ?string $back_link_lang_var = null): void
162162
{
163-
if ($error_type == E_USER_NOTICE && $this->config['extmgrplus_switch_auto_redirect'])
163+
if ($error_level == E_USER_NOTICE && $this->config['extmgrplus_switch_auto_redirect'])
164164
{
165165
meta_refresh(1, $this->rotate_get_params($this->u_action));
166166
$this->template->assign_var('EXTMGRPLUS_AUTO_REDIRECT', true);
167167
}
168-
$this->template->assign_var('EXTMGRPLUS_TRIGGER_ERROR', true);
169-
trigger_error($message . $this->back_link($back_link_lang_var), $error_type);
168+
$error_type = [
169+
E_USER_NOTICE => 0,
170+
E_USER_NOTICE + E_USER_WARNING => 1,
171+
E_USER_WARNING => 2,
172+
][$error_level] ?? 1;
173+
$this->template->assign_var('EXTMGRPLUS_TRIGGER_ERROR', $error_type);
174+
trigger_error($message . $this->back_link($back_link_lang_var), ($error_type == 1) ? E_USER_WARNING : $error_level);
170175
}
171176

172177
public function back_link(?string $lang_var = null): string

0 commit comments

Comments
 (0)