Compare commits
7 Commits
5.0.1
...
8f45736b1b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f45736b1b | ||
|
|
8385197f11 | ||
|
|
ca16e3ca39 | ||
|
|
c194661fa3 | ||
|
|
e539c60e9b | ||
|
|
bea25d8396 | ||
|
|
b4506a0a3e |
2
.github/workflows/php-lint.yml
vendored
2
.github/workflows/php-lint.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
matrix:
|
||||
php-version: ['8.2', '8.3', '8.4']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Setup PHP ${{ matrix.php-version }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
2
.github/workflows/phpcs.yml
vendored
2
.github/workflows/phpcs.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
phpcs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
@@ -86,3 +86,5 @@ CREATE TABLE IF NOT EXISTS `ident_switch`
|
||||
INDEX `IX_ident_switch_iid`(`iid`),
|
||||
INDEX `IX_ident_switch_parent_id`(`parent_id`)
|
||||
);
|
||||
|
||||
INSERT INTO `system` (`name`, `value`) VALUES ('ident_switch-version', '2026021000');
|
||||
|
||||
@@ -85,3 +85,5 @@ CREATE TABLE ident_switch
|
||||
CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id);
|
||||
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
||||
CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id);
|
||||
|
||||
INSERT INTO system (name, value) VALUES ('ident_switch-version', '2026021000');
|
||||
|
||||
@@ -84,3 +84,5 @@ CREATE TABLE ident_switch
|
||||
CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id);
|
||||
CREATE INDEX IX_ident_switch_iid ON ident_switch(iid);
|
||||
CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id);
|
||||
|
||||
INSERT INTO system (name, value) VALUES ('ident_switch-version', '2026021000');
|
||||
|
||||
4
composer.lock
generated
4
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "46b2d3558cb304fde0539d1b85971382",
|
||||
"content-hash": "c1389b5e002c6014eeddc8105bf77db1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "roundcube/plugin-installer",
|
||||
@@ -154,5 +154,5 @@
|
||||
"ext-ctype": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.9.0"
|
||||
}
|
||||
|
||||
@@ -56,10 +56,13 @@ function plugin_switchIdent_init() {
|
||||
$("INPUT[name='_ident_switch.form.sieve.host']").attr('placeholder', initialImapHost);
|
||||
}
|
||||
|
||||
// Re-apply preconfig from current email (handles form re-render after create abort
|
||||
// where PHP record may lack email, so readonly was not set server-side)
|
||||
// Disable mode select until a valid email is entered
|
||||
var $modeSelect = $("SELECT[name='_ident_switch.form.common.mode']");
|
||||
if (initialEmail && initialEmail.indexOf('@') > 0) {
|
||||
$modeSelect.prop('disabled', false);
|
||||
plugin_switchIdent_onEmailChange(initialEmail);
|
||||
} else {
|
||||
$modeSelect.prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,6 +281,9 @@ function plugin_switchIdent_onEmailChange(email) {
|
||||
var domain = email.substring(atPos + 1).toLowerCase();
|
||||
if (!domain) return;
|
||||
|
||||
// Enable mode select now that we have a valid email
|
||||
$("SELECT[name='_ident_switch.form.common.mode']").prop('disabled', false);
|
||||
|
||||
// Update label and username placeholders to match current email
|
||||
$("INPUT[name='_ident_switch.form.common.label']").attr('placeholder', email);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ $(function() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Place switcher in Larry skin: replace username in top-right corner.
|
||||
* Place switcher in Larry skin: replace username in top-right corner of #topline.
|
||||
*/
|
||||
function plugin_switchIdent_addCbLarry($wrapper, $sw) {
|
||||
var $topRight = $('#topline .topright');
|
||||
@@ -65,12 +65,6 @@ function plugin_switchIdent_addCbLarry($wrapper, $sw) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$sw.css({
|
||||
'font-weight': 'bold',
|
||||
'max-width': '200px',
|
||||
'text-overflow': 'ellipsis'
|
||||
});
|
||||
|
||||
$topRight.find('.username').hide();
|
||||
$topRight.prepend($wrapper);
|
||||
return true;
|
||||
@@ -104,7 +98,6 @@ function plugin_switchIdent_addCbElastic($wrapper, $sw) {
|
||||
'font-weight': 'bold',
|
||||
'color': 'inherit',
|
||||
'box-shadow': 'none',
|
||||
'max-width': '200px',
|
||||
'text-overflow': 'ellipsis',
|
||||
'padding': '0 1.2em 0 0.25em'
|
||||
});
|
||||
|
||||
@@ -15,8 +15,12 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Account switcher <select>: hide native arrow, show SVG chevron */
|
||||
.ident-switch-wrapper select {
|
||||
/* Account switcher <select>: hide native arrow, show SVG chevron.
|
||||
Scoped to Elastic (.header-title.username) and Larry (#topline .topright) where
|
||||
the switcher replaces a styled header label; Classic uses Roundcube's native
|
||||
select rendering instead (see #taskbar rule below). */
|
||||
.header-title.username .ident-switch-wrapper select,
|
||||
#topline .topright .ident-switch-wrapper select {
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
@@ -27,6 +31,62 @@
|
||||
background-size: 10px 6px;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prevent flash of original username before JS prepends the switcher.
|
||||
* The JS hides these elements at DOMReady, but the CSS rules below hide them
|
||||
* earlier (during initial render) — only loaded when the switcher will actually
|
||||
* be shown, so users without secondary accounts keep the default username display.
|
||||
*/
|
||||
|
||||
/* Elastic skin: switcher is prepended inside .header-title.username.
|
||||
Hide the original username via visibility on the parent (affects the text
|
||||
node), then re-show the wrapper. Unlike color/font-size, this preserves the
|
||||
parent's flex/line-height context, keeping the wrapper vertically centered. */
|
||||
.header-title.username {
|
||||
visibility: hidden;
|
||||
}
|
||||
.header-title.username > *:not(.ident-switch-wrapper) {
|
||||
display: none;
|
||||
}
|
||||
.header-title.username > .ident-switch-wrapper {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* Larry skin: switcher is prepended next to .username inside #topline .topright */
|
||||
#topline .topright > .username {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Larry skin: blend the <select> into the dark #topline header (Larry styles a
|
||||
<span> here, not a <select>, so without these the native white control sticks
|
||||
out on the dark background). */
|
||||
#topline .topright .ident-switch-wrapper {
|
||||
width: auto;
|
||||
}
|
||||
#topline .topright .ident-switch-wrapper select {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
color: inherit;
|
||||
font-weight: bold;
|
||||
padding: 0 1.2em 0 0.25em;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* Classic skin: switcher is prepended inside #taskbar (right-aligned, nowrap, 24px tall).
|
||||
Drop width:100% so it sits inline before the menu links instead of pushing them
|
||||
off-screen. The select keeps Roundcube's default native rendering. */
|
||||
#taskbar > .ident-switch-wrapper {
|
||||
width: auto;
|
||||
vertical-align: middle;
|
||||
margin-right: 8px;
|
||||
}
|
||||
#taskbar > .ident-switch-wrapper select {
|
||||
max-width: 180px;
|
||||
position: relative;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
/* Unread badge */
|
||||
.ident-switch-badge {
|
||||
flex-shrink: 0;
|
||||
|
||||
@@ -158,10 +158,6 @@ class ident_switch extends rcube_plugin
|
||||
default => null,
|
||||
};
|
||||
|
||||
if ($rc->task === 'mail') {
|
||||
$this->include_stylesheet('ident_switch.css');
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
@@ -188,7 +184,9 @@ class ident_switch extends rcube_plugin
|
||||
$iid = intval($iid_s);
|
||||
}
|
||||
|
||||
$accNames = [$_SESSION['global_alias'] ?? $rc->user->data['username']];
|
||||
$primaryIdentity = $rc->user->get_identity();
|
||||
$primaryName = !empty($primaryIdentity['name']) ? $primaryIdentity['name'] : null;
|
||||
$accNames = [$_SESSION['global_alias'] ?? $primaryName ?? $rc->user->data['username']];
|
||||
$accValues = [-1];
|
||||
$accSelected = -1;
|
||||
$iidMap = [0 => -1]; // primary account: iid 0 → select value -1
|
||||
@@ -216,6 +214,7 @@ class ident_switch extends rcube_plugin
|
||||
return;
|
||||
}
|
||||
|
||||
$this->include_stylesheet('ident_switch.css');
|
||||
$this->include_script('ident_switch-switch.js');
|
||||
|
||||
// Pass config to JS environment
|
||||
@@ -223,7 +222,7 @@ class ident_switch extends rcube_plugin
|
||||
|
||||
$select = new html_select([
|
||||
'id' => 'plugin-ident_switch-account',
|
||||
'style' => 'display: none; padding: 0;',
|
||||
'style' => 'display: none;',
|
||||
'onchange' => 'plugin_switchIdent_switch(this.value);',
|
||||
]);
|
||||
$select->add($accNames, $accValues);
|
||||
|
||||
@@ -177,6 +177,9 @@ class IdentSwitchChecker
|
||||
$host = 'tls://' . $host;
|
||||
}
|
||||
|
||||
$primaryIdentity = $rc->user->get_identity();
|
||||
$primaryName = !empty($primaryIdentity['name']) ? $primaryIdentity['name'] : null;
|
||||
|
||||
return [
|
||||
'iid' => 0,
|
||||
'imap_host' => $host,
|
||||
@@ -185,7 +188,7 @@ class IdentSwitchChecker
|
||||
'username' => $rc->user->data['username'],
|
||||
'password' => $_SESSION['password' . $postfix],
|
||||
'email' => $rc->user->data['username'],
|
||||
'label' => $_SESSION['global_alias'] ?? $rc->user->data['username'],
|
||||
'label' => $_SESSION['global_alias'] ?? $primaryName ?? $rc->user->data['username'],
|
||||
'notify_basic' => null,
|
||||
'notify_sound' => null,
|
||||
'notify_desktop' => null,
|
||||
|
||||
Reference in New Issue
Block a user