3m-portal/editor.html
Vadym Samoilenko 8092b3e70d Apply Live_v1 update: search/filter, auto-refresh, timeout handling
- dashboard.js: add search, workflow filter, result count, auto-refresh
  every 60s (pauses on hidden tab), formatLocalDate, STEP_LABELS,
  Final Review badge, getSession/redirectToLogin helpers
- server.js: upstream timeout (30s default), IS_PROD flag, logProxyParams
  helper (masks username in prod), 502+CORS on proxy errors, attachTimeout
- auth.js: named constants SESSION_CLIENT_ID/USER_INFO_CLIENT_ID
- dashboard.html: search/filter UI controls, Favicon_logo.png
- login.html, editor.html: switch favicon to Favicon_logo.png
- styles.css: updated stylesheet from Live_v1
- Images/Favicon_logo.png: new favicon asset
- package.json: add engines node>=18

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 10:56:56 +01:00

126 lines
4.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3M - Job Editor</title>
<link rel="icon" type="image/png" href="Images/Favicon_logo.png">
<!-- One2Edit CSS and JS -->
<link rel="stylesheet" href="https://oliver.one2edit.com/css/one2edit.css" type="text/css" media="screen"/>
<script type="text/javascript" src="https://oliver.one2edit.com/scripts/one2edit.js"></script>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
#flashContent {
width: 100vw;
height: 100vh;
}
.loading-message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: #666;
font-size: 18px;
}
.error-message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: #c33;
font-size: 16px;
max-width: 500px;
padding: 20px;
background: #fee;
border-radius: 8px;
}
</style>
</head>
<body>
<div id="flashContent">
<div class="loading-message" id="loadingMessage">
<p>Loading editor...</p>
</div>
</div>
<script>
// Get parameters from URL
const urlParams = new URLSearchParams(window.location.search);
const jobId = urlParams.get('jobId');
// Get session data from sessionStorage
const authConfigStr = sessionStorage.getItem('authConfig');
const externSessionId = sessionStorage.getItem('externSessionId');
if (!jobId || !authConfigStr || !externSessionId) {
document.getElementById('loadingMessage').innerHTML =
'<div class="error-message"><p>Missing session or job information. Please go back to the dashboard and try again.</p></div>';
} else {
const authConfig = JSON.parse(authConfigStr);
// Enable debug mode
one2edit.debug = true;
console.log('Using externSessionId for SDK:', externSessionId);
// Use the externSessionId directly - it is already a valid session
// for the logged-in user who has jobs assigned to them
one2edit.create({
flashvars: {
server: 'https://oliver.one2edit.com/',
sessionId: externSessionId,
clientId: parseInt(authConfig.clientId),
jobEditor: {
jobId: parseInt(jobId)
}
}
});
// Event listeners
one2edit.addEventListener(one2edit.events.Event.INITIALIZE, function(event) {
console.log('Event: INITIALIZE');
const loadingMsg = document.getElementById('loadingMessage');
if (loadingMsg) {
loadingMsg.style.display = 'none';
}
one2edit.editor.showMenu(false); // Hide the main menu bar
});
one2edit.addEventListener(one2edit.events.Event.EDITOR_INITIALIZE, function (event) {
console.log("Event one2edit.events.Event.EDITOR_INITIALIZE");
one2edit.editor.toolbar.removeElement(one2edit.editor.toolbar.getElementById('toolbar_tool_search_replace'));
one2edit.editor.toolbar.removeElement(one2edit.editor.toolbar.getElementById('toolbar_download_pdf'));
one2edit.editor.toolbar.removeElement(one2edit.editor.toolbar.getElementById('toolbar_rotate'));
});
one2edit.addEventListener(one2edit.events.Event.EDITOR_ERROR, function(event) {
console.error('Event: EDITOR_ERROR', event);
const loadingMsg = document.getElementById('loadingMessage');
if (loadingMsg) {
loadingMsg.innerHTML = '<div class="error-message"><p>Error loading editor. Please try again.</p></div>';
}
});
one2edit.addEventListener(one2edit.events.Event.EDITOR_CLOSE, function(event) {
console.log('Event: EDITOR_CLOSE');
// Go back to dashboard
window.location.href = 'dashboard.html';
});
}
</script>
</body>
</html>