tutto di troppo: fix visualizzazione email. style: riviste icone invio ed elimina, postato aggiungi ticket al grppo e informazioni laterali da a cc.

This commit is contained in:
Gabriele Cimaschi committed 2026-09-09 11:04:14 +02:00
1 parent 9ae0cec0ca
commit cf500aabb3
7 files changed
+743 -85

No files matched your search

+78
View File
@@ -53,6 +53,69 @@ const App = {
}
},
getShortcut(id) {
try {
const stored = localStorage.getItem('otrs_shortcuts');
const customMap = stored ? JSON.parse(stored) : {};
if (customMap[id]) return customMap[id];
} catch (e) {}
const defaults = {
create_ticket_open: { ctrl: true, alt: true, shift: false, key: 'n', enabled: true },
create_ticket_submit: { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true },
quick_edit_save: { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true },
};
return defaults[id] || { ctrl: true, alt: false, shift: false, key: 'Enter', enabled: true };
},
saveCustomShortcut(id, combo) {
try {
const stored = localStorage.getItem('otrs_shortcuts');
const customMap = stored ? JSON.parse(stored) : {};
customMap[id] = combo;
localStorage.setItem('otrs_shortcuts', JSON.stringify(customMap));
} catch (e) {
console.error(e);
}
},
isShortcutTriggered(e, id) {
const sc = this.getShortcut(id);
if (!sc || !sc.enabled) return false;
const isCtrlOrCmd = sc.ctrl ? (e.ctrlKey || e.metaKey) : (!e.ctrlKey && !e.metaKey);
const isAlt = sc.alt ? e.altKey : !e.altKey;
const isShift = sc.shift ? e.shiftKey : !e.shiftKey;
let targetKey = sc.key.toLowerCase();
let pressedKey = e.key.toLowerCase();
if (targetKey === 'space' && (pressedKey === ' ' || pressedKey === 'space')) {
return isCtrlOrCmd && isAlt && isShift;
}
return isCtrlOrCmd && isAlt && isShift && (pressedKey === targetKey);
},
formatShortcutLabel(sc) {
if (!sc) return '';
const parts = [];
if (sc.ctrl) parts.push(navigator.platform.includes('Mac') ? 'Cmd' : 'Ctrl');
if (sc.alt) parts.push('Alt');
if (sc.shift) parts.push('Shift');
let keyName = sc.key;
if (keyName === 'Enter') keyName = 'Invio';
else if (keyName === ' ' || keyName === 'Space') keyName = 'Spazio';
parts.push(keyName);
return parts.join(' + ');
},
linkifyText(text) {
if (!text) return '';
const urlRegex = /(https?:\/\/[^\s<]+)/g;
return text.replace(urlRegex, url => `<a href="${url}" target="_blank" rel="noopener noreferrer" style="color:var(--accent-primary); text-decoration:underline;">${url}</a>`);
},
openTab(id, tn, title) {
const exists = this.tabs.find(t => String(t.id) === String(id));
if (!exists) {
@@ -197,6 +260,16 @@ const App = {
toggleClearBtn();
}
// Global keyboard shortcuts (e.g. Crea Nuovo Ticket)
document.addEventListener('keydown', (e) => {
if (this.isShortcutTriggered(e, 'create_ticket_open')) {
if (window.location.hash !== '#/tickets/new') {
e.preventDefault();
window.location.hash = '#/tickets/new';
}
}
});
// Check DB connection
this.checkConnection();
@@ -369,6 +442,11 @@ const App = {
titleEl.textContent = 'Storico Attività';
ActivityLogView.render();
} else if (hash === '#/shortcuts') {
document.getElementById('nav-shortcuts')?.classList.add('active');
titleEl.textContent = 'Shortcuts';
ShortcutsView.render();
} else if (hash === '#/mail-management') {
document.getElementById('nav-mail-management')?.classList.add('active');
titleEl.textContent = 'Gestione Mail';