16334_sum.patch
| new/src/com/goldencode/p2j/ui/client/driver/web/res/p2j.client.css 2025-12-19 22:15:54 +0000 | ||
|---|---|---|
| 2 | 2 |
** Module : p2j.client.css |
| 3 | 3 |
** Abstract : Common CSS styles for the web client. |
| 4 | 4 |
** |
| 5 |
** Copyright (c) 2021-2024, Golden Code Development Corporation.
|
|
| 5 |
** Copyright (c) 2021-2025, Golden Code Development Corporation.
|
|
| 6 | 6 |
** |
| 7 | 7 |
** -#- -I- --Date-- ------------------------------Description---------------------------------- |
| 8 | 8 |
** 001 SBI 20210629 Added the web client CSS styles. |
| 9 | 9 |
** 002 HC 20231005 Implemented focus transfer when opening modal windows on top of driver |
| 10 | 10 |
** widgets. |
| 11 | 11 |
** 003 SB 20240627 Add class for dynamically setting cursor property. |
| 12 |
** 004 SBI 20251220 Added new styles to support dojo based dialogs. |
|
| 12 | 13 |
*/ |
| 13 | 14 |
/* |
| 14 | 15 |
** This program is free software: you can redistribute it and/or modify |
| ... | ... | |
| 103 | 104 |
position: fixed; |
| 104 | 105 |
background: white; |
| 105 | 106 |
width: 300px; |
| 106 |
height: 200px;
|
|
| 107 |
height: auto;
|
|
| 107 | 108 |
display: flex; |
| 108 | 109 |
flex-direction: column; |
| 109 | 110 |
flex-wrap: nowrap; |
| 110 | 111 |
align-items: flex-start; |
| 112 |
overflow: auto; |
|
| 111 | 113 |
} |
| 112 | 114 |
.title {
|
| 113 | 115 |
position : relative; |
| ... | ... | |
| 131 | 133 |
position : relative; |
| 132 | 134 |
background : white; |
| 133 | 135 |
text-align : center; |
| 136 |
padding : 5px; |
|
| 134 | 137 |
} |
| 135 | 138 |
.buttons {
|
| 136 | 139 |
position : relative; |
| ... | ... | |
| 141 | 144 |
justify-content : space-around; |
| 142 | 145 |
} |
| 143 | 146 |
.button {
|
| 147 |
display : inline; |
|
| 144 | 148 |
position : relative; |
| 145 | 149 |
align-self : center; |
| 146 | 150 |
text-align : center; |
| ... | ... | |
| 160 | 164 |
canvas:focus {
|
| 161 | 165 |
outline: none; |
| 162 | 166 |
} |
| 167 |
.dijitDialog.noTitleBar .dijitDialogTitleBar {
|
|
| 168 |
/* hide title bar */ |
|
| 169 |
display: none !important; |
|
| 170 |
} |
|
| 171 | ||
| 172 |
.dijitDialog.noTitleBar .dijitDialogPaneContent {
|
|
| 173 |
/* adjust spacing when titlebar is hidden */ |
|
| 174 |
padding-top: 0px; |
|
| 175 |
} |
|
| 176 |
.dijitDialogPaneContent.dijitDialogSingleChild {
|
|
| 177 |
padding: 0 !important; |
|
| 178 |
} |
|
| 179 |
.dialogFWDOverride {
|
|
| 180 |
width: 300px; |
|
| 181 |
height: auto; |
|
| 182 |
} |
|
| 183 |
.borderContainerFWDOverride {
|
|
| 184 |
height: auto; |
|
| 185 |
margin: 0 !important; |
|
| 186 |
border: none !important; |
|
| 187 |
padding: 0 !important; |
|
| 188 |
} |
|
| 189 |
.centerPaneFWDOverride {
|
|
| 190 |
font-size : 14px; |
|
| 191 |
height: auto; |
|
| 192 |
overflow: auto !important; |
|
| 193 |
margin: 0 !important; |
|
| 194 |
border: none !important; |
|
| 195 |
padding: 0 !important; |
|
| 196 |
width: 100%; |
|
| 197 |
position: relative; |
|
| 198 |
} |
|
| 199 |
.topPaneFWDOverride {
|
|
| 200 |
height: auto; |
|
| 201 |
margin: 0 !important; |
|
| 202 |
border: none !important; |
|
| 203 |
width : 100%; |
|
| 204 |
padding: 0 !important; |
|
| 205 |
} |
|
| 206 |
.bottomPaneFWDOverride {
|
|
| 207 |
height: auto; |
|
| 208 |
margin: 0 !important; |
|
| 209 |
border: none !important; |
|
| 210 |
width : 100%; |
|
| 211 |
padding: 0 !important; |
|
| 212 |
overflow: auto !important; |
|
| 213 |
} |
|
| 214 |
.hidePane {
|
|
| 215 |
display : none !important; |
|
| 216 |
} |
|
| 217 |
.loadingDialogTitleFWDOverride {
|
|
| 218 |
padding : 1px 0px 1px 0px !important; |
|
| 219 |
font-size: 12px !important; |
|
| 220 |
} |
|
| 221 |
.loadingDialogFWDOverride {
|
|
| 222 |
font-size: 12px !important; |
|
| 223 |
} |
|
| new/src/com/goldencode/p2j/ui/client/driver/web/res/p2j.js 2025-12-19 21:56:27 +0000 | ||
|---|---|---|
| 72 | 72 |
** 029 PMP 20250916 Initialized networkSocket module. |
| 73 | 73 |
** 030 SB 20251113 Remove the cursor overlay on mouse clicks as well if there was no previous mouse move. |
| 74 | 74 |
** 031 SBI 20251210 Added repeat key.(refs: #10984, #10982, #10836) |
| 75 |
** 032 SBI 20251220 Reused dojo dialogs, fixed isDialogDisplayed to block user events |
|
| 76 |
** to be sent to the java web client if ModalDialog is displayed. |
|
| 75 | 77 |
*/ |
| 76 | 78 |
/* |
| 77 | 79 |
** This program is free software: you can redistribute it and/or modify |
| ... | ... | |
| 171 | 173 |
|
| 172 | 174 |
/** The dialog identifiers */ |
| 173 | 175 |
const DIALOGS = { OPENPOPUP : "openMimeResource"}
|
| 174 |
|
|
| 175 |
/** The instance of the unique copy/cut/paste notification dialog. */ |
|
| 176 |
var dialog; |
|
| 177 | 176 |
|
| 178 | 177 |
/** The open popup dialog */ |
| 179 | 178 |
var openPopupDialog; |
| 180 | 179 |
|
| 180 |
/** The set of displayed ModalDialogs */ |
|
| 181 |
var dialogs = new Set(); |
|
| 182 |
|
|
| 181 | 183 |
/** The notification templates to prompt a user to do an action */ |
| 182 | 184 |
var prompts = {};
|
| 183 | 185 |
|
| ... | ... | |
| 594 | 596 |
var loadingProgressBar = new dijit.ProgressBar( |
| 595 | 597 |
{
|
| 596 | 598 |
maximum: 100, |
| 597 |
style: "font-weight: bold" |
|
| 599 |
style: "font-weight: bold;"
|
|
| 598 | 600 |
}); |
| 599 | 601 |
var loadingDialog = new ModalDialog(id, |
| 600 | 602 |
document.body, |
| 601 | 603 |
"", |
| 602 | 604 |
"", |
| 603 |
true); |
|
| 605 |
true, |
|
| 606 |
{"noTitle" : false, "closable" : false});
|
|
| 604 | 607 |
var progressTimer; |
| 605 | 608 |
|
| 606 | 609 |
function setLoadingCheckpoint(value) |
| 607 | 610 |
{
|
| 611 |
if (loadingDialog.isDisposed()) |
|
| 612 |
{
|
|
| 613 |
return; |
|
| 614 |
} |
|
| 608 | 615 |
loadingProgressBar.set({"value" : value});
|
| 609 | 616 |
var v0 = loadingProgressBar.get("value");
|
| 610 | 617 |
var time = 1; |
| ... | ... | |
| 645 | 652 |
loadingDialog.setTitle(i18n.gettext("Loading..."));
|
| 646 | 653 |
loadingDialog.setContent({htmlElement : loadingProgressBar.domNode});
|
| 647 | 654 |
loadingProgressBar.startup(); |
| 648 |
loadingDialog.overrideDialogStyle({"height" :"40px"});
|
|
| 649 |
loadingDialog.overrideTitleStyle({"padding" :"1px"});
|
|
| 655 |
loadingDialog.overrideDialogStyle("loadingDialogFWDOverride");
|
|
| 656 |
loadingDialog.overrideTitleStyle("loadingDialogTitleFWDOverride");
|
|
| 650 | 657 |
loadingDialog.show(); |
| 651 | 658 |
setLoadingCheckpoint(0); |
| 652 | 659 |
|
| ... | ... | |
| 1198 | 1205 |
*/ |
| 1199 | 1206 |
function createInternalDialog(id, container, text, tooltip, keyDownHandler) |
| 1200 | 1207 |
{
|
| 1201 |
var dlg = new ModalDialog(id, container, text, tooltip, false); |
|
| 1208 |
var dlg = new ModalDialog(id, container, text, tooltip, false, {"noTitle" : true, "closable" : false});
|
|
| 1202 | 1209 |
|
| 1203 | 1210 |
if (keyDownHandler) |
| 1204 | 1211 |
{
|
| ... | ... | |
| 1209 | 1216 |
}; |
| 1210 | 1217 |
|
| 1211 | 1218 |
/** |
| 1212 |
* Tests if the clipboard dialog is active.
|
|
| 1219 |
* Tests if there is an active modal dialog.
|
|
| 1213 | 1220 |
*/ |
| 1214 | 1221 |
function isDialogDisplayed() |
| 1215 | 1222 |
{
|
| 1216 |
return (dialog != null) && (dialog != undefined);
|
|
| 1223 |
return dialogs.size > 0;
|
|
| 1217 | 1224 |
} |
| 1218 | 1225 |
|
| 1219 | 1226 |
me.isDialogDisplayed = isDialogDisplayed; |
| ... | ... | |
| 1228 | 1235 |
*/ |
| 1229 | 1236 |
function createOpenPopupDialog(keyDownHandler) |
| 1230 | 1237 |
{
|
| 1231 |
if (!openPopupDialog || openPopupDialog.disposed)
|
|
| 1238 |
if (!isDialogDisplayed())
|
|
| 1232 | 1239 |
{
|
| 1233 | 1240 |
openPopupDialog = createInternalDialog(DIALOGS[OPENPOPUP], |
| 1234 | 1241 |
document.body, |
| ... | ... | |
| 1345 | 1352 |
if (openPopupDialog) |
| 1346 | 1353 |
{
|
| 1347 | 1354 |
openPopupDialog.close(); |
| 1355 |
openPopupDialog = null; |
|
| 1348 | 1356 |
} |
| 1349 | 1357 |
} |
| 1350 | 1358 |
}); |
| ... | ... | |
| 1952 | 1960 |
* @param {Boolean} hidden
|
| 1953 | 1961 |
* True value indicates that the new created dialog must be hidden. So it requires to |
| 1954 | 1962 |
* invoke its show()/hide() methods to control its visibility. |
| 1963 |
* @param {Object} titleOption
|
|
| 1964 |
* Title option object with the following properties: |
|
| 1965 |
* noTitle true or false - the dialog title is hidden or not |
|
| 1966 |
* closable true or false - the X cancel button is displayed or not |
|
| 1955 | 1967 |
*/ |
| 1956 |
function ModalDialog (id, container, text, tooltip, hidden) |
|
| 1968 |
function ModalDialog (id, container, text, tooltip, hidden, titleOption)
|
|
| 1957 | 1969 |
{
|
| 1958 |
var overlayId = getOverlayId(id); |
|
| 1959 |
var zIndex = getMaxZIndex(); |
|
| 1960 |
var overlay = createOverlayPanel(overlayId, zIndex, container); |
|
| 1961 |
var dialog = document.createElement("div");
|
|
| 1962 |
dialog.id = id; |
|
| 1963 |
var titleEl = document.createTextNode("");
|
|
| 1964 |
/** header panel */ |
|
| 1965 |
var titleDiv = document.createElement("div");
|
|
| 1966 |
titleDiv.appendChild(titleEl); |
|
| 1967 |
titleDiv.className = "title"; |
|
| 1968 |
dialog.appendChild(titleDiv); |
|
| 1969 |
/** content panel */ |
|
| 1970 |
var contentDiv = document.createElement("div");
|
|
| 1971 |
contentDiv.className = "content"; |
|
| 1972 |
//fill text content |
|
| 1973 |
setTextContent(text); |
|
| 1974 |
dialog.appendChild(contentDiv); |
|
| 1975 |
dialog.tabIndex = 1; |
|
| 1976 |
dialog.className = "dialog centered"; |
|
| 1977 |
dialog.style.zIndex = zIndex + 1; |
|
| 1978 |
dialog.title = tooltip; |
|
| 1979 |
container.appendChild(dialog); |
|
| 1970 |
var that = this; |
|
| 1971 |
that.id = id; |
|
| 1972 |
that.text = text; |
|
| 1973 |
that.tooltip = tooltip; |
|
| 1974 |
that.noTitle = (titleOption && titleOption.noTitle) ? true : false; |
|
| 1975 |
that.closable = (titleOption && titleOption.closable) ? true : false; |
|
| 1976 |
that.container = container; |
|
| 1977 |
|
|
| 1980 | 1978 |
// create application events listeners map |
| 1981 |
dialog.listeners = new Map();
|
|
| 1979 |
that.listeners = new Map();
|
|
| 1982 | 1980 |
// create html document events triggers map |
| 1983 |
dialog.triggers = new Map();
|
|
| 1981 |
that.triggers = new Map();
|
|
| 1984 | 1982 |
// save the overlay panel instance |
| 1985 |
dialog.overlay = overlay; |
|
| 1983 |
var titleDiv; |
|
| 1984 |
var contentDiv; |
|
| 1986 | 1985 |
/** buttons panel */ |
| 1987 | 1986 |
var buttonsDiv; |
| 1988 | 1987 |
/** footer panel */ |
| 1989 | 1988 |
var footerDiv; |
| 1990 | 1989 |
/** disposed state */ |
| 1991 |
dialog.disposed = false;
|
|
| 1990 |
that.disposed = false;
|
|
| 1992 | 1991 |
/** visibility state */ |
| 1993 |
dialog.visible = false;
|
|
| 1992 |
that.visible = false;
|
|
| 1994 | 1993 |
/** Represents the locked state that must protect dialog from modifications */ |
| 1995 |
dialog.locked = false;
|
|
| 1994 |
that.locked = false;
|
|
| 1996 | 1995 |
/** Stack of postponed actions applied to this dialog */ |
| 1997 |
dialog.postponedActions = []; |
|
| 1996 |
that.postponedActions = []; |
|
| 1997 |
|
|
| 1998 |
/** Create backbone dojo dialog */ |
|
| 1999 |
function createDojoDialog(container) |
|
| 2000 |
{
|
|
| 2001 |
dojo.require("dojo.Deferred");
|
|
| 2002 |
var createDialogDeferred = new dojo.Deferred(); |
|
| 2003 |
|
|
| 2004 |
require(["dojo/dom","dojo/dom-style", "dojo/dom-class", "dojo/dom-attr", "dojo/dom-construct", "dijit/registry", "dijit/Dialog", "dijit/layout/ContentPane", "dijit/layout/BorderContainer", "dijit/form/Button", "dojo/domReady!"], |
|
| 2005 |
function(dom, domStyle, domClass, domAttr, domConstruct, registry, Dialog, ContentPane, BorderContainer, Button) |
|
| 2006 |
{
|
|
| 2007 |
try |
|
| 2008 |
{
|
|
| 2009 |
var dojoDialog = new Dialog( |
|
| 2010 |
{
|
|
| 2011 |
id : that.id, |
|
| 2012 |
className: "dialogFWDOverride", |
|
| 2013 |
autofocus: false, |
|
| 2014 |
refocus: false, |
|
| 2015 |
closable: that.closable, |
|
| 2016 |
}); |
|
| 2017 |
var borderContainer = new BorderContainer( |
|
| 2018 |
{
|
|
| 2019 |
design: 'headline', |
|
| 2020 |
className: 'borderContainerFWDOverride', |
|
| 2021 |
}); |
|
| 2022 |
var centerPane = new ContentPane({
|
|
| 2023 |
region: 'center', |
|
| 2024 |
className: 'centerPaneFWDOverride', |
|
| 2025 |
}); |
|
| 2026 |
|
|
| 2027 |
var textDiv = domConstruct.create('div', { className: 'text' }, centerPane.containerNode);
|
|
| 2028 |
textDiv.appendChild(document.createTextNode(text)); |
|
| 2029 |
var topPane = new ContentPane({
|
|
| 2030 |
region: 'top', |
|
| 2031 |
className: 'topPaneFWDOverride', |
|
| 2032 |
}); |
|
| 2033 |
hidePane(topPane.domNode, true); |
|
| 2034 |
var footerPane = new ContentPane({
|
|
| 2035 |
region: 'bottom', |
|
| 2036 |
className: 'bottomPaneFWDOverride', |
|
| 2037 |
}); |
|
| 2038 |
hidePane(footerPane.domNode, true); |
|
| 2039 |
|
|
| 2040 |
borderContainer.addChild(centerPane); |
|
| 2041 |
borderContainer.addChild(topPane); |
|
| 2042 |
borderContainer.addChild(footerPane); |
|
| 2043 |
borderContainer.placeAt(dojoDialog.containerNode); |
|
| 2044 |
centerPane.startup(); |
|
| 2045 |
topPane.startup(); |
|
| 2046 |
footerPane.startup(); |
|
| 2047 |
borderContainer.startup(); |
|
| 2048 |
|
|
| 2049 |
|
|
| 2050 |
function computeDialogSize() |
|
| 2051 |
{
|
|
| 2052 |
// max 80% of viewport |
|
| 2053 |
var maxHeight = Math.round(window.innerHeight * 0.8); |
|
| 2054 |
var maxWidth = Math.round(window.innerWidth * 0.8); |
|
| 2055 |
|
|
| 2056 |
if(!borderContainer.domNode) |
|
| 2057 |
{
|
|
| 2058 |
return {
|
|
| 2059 |
"height" : maxHeight, |
|
| 2060 |
"width" : maxWidth, |
|
| 2061 |
"titleHeight" : 0, |
|
| 2062 |
"contentHeight" : 0, |
|
| 2063 |
"topHeight" : 0, |
|
| 2064 |
"footerHeight" : 0, |
|
| 2065 |
"borderContainerTop" : 0, |
|
| 2066 |
"centerPaneTop" : 0 |
|
| 2067 |
}; |
|
| 2068 |
} |
|
| 2069 |
|
|
| 2070 |
borderContainer.domNode.style.height = 'auto'; |
|
| 2071 |
|
|
| 2072 |
var centerNode = centerPane.domNode; |
|
| 2073 |
var contentHeight = 0; |
|
| 2074 |
var contentWidth = 0; |
|
| 2075 |
if(centerNode) |
|
| 2076 |
{
|
|
| 2077 |
contentHeight = Math.max(centerNode.scrollHeight, centerNode.offsetHeight || 0); |
|
| 2078 |
contentWidth = Math.max(centerNode.scrollWidth, centerNode.offsetWidth || 0); |
|
| 2079 |
} |
|
| 2080 |
|
|
| 2081 |
var topHeight = topPane.domNode ? topPane.domNode.offsetHeight : 0; |
|
| 2082 |
var footerHeight = footerPane.domNode ? footerPane.domNode.offsetHeight : 0; |
|
| 2083 |
var footerInnerHeight = footerPane.containerNode ? footerPane.containerNode.offsetHeight : 0; |
|
| 2084 |
var footerOnlyChild = footerPane.containerNode.firstElementChild; |
|
| 2085 |
if (footerOnlyChild) |
|
| 2086 |
{
|
|
| 2087 |
footerHeight = Math.max(footerHeight, footerOnlyChild.offsetHeight); |
|
| 2088 |
//console.debug("footerOnlyChild.offsetHeight=" + footerOnlyChild.offsetHeight);
|
|
| 2089 |
} |
|
| 2090 |
footerHeight = Math.max(footerHeight, footerInnerHeight); |
|
| 2091 |
var titleBar = dojoDialog.titleBar; |
|
| 2092 |
var titleHeight = titleBar ? titleBar.offsetHeight : 0; |
|
| 2093 |
|
|
| 2094 |
var dialogHeight = titleHeight + topHeight + contentHeight + footerHeight; |
|
| 2095 |
|
|
| 2096 |
|
|
| 2097 |
return {
|
|
| 2098 |
height : Math.min(dialogHeight, maxHeight), |
|
| 2099 |
width: contentWidth, |
|
| 2100 |
titleHeight : titleHeight, |
|
| 2101 |
contentHeight : contentHeight, |
|
| 2102 |
topHeight: topHeight, |
|
| 2103 |
footerHeight : footerHeight, |
|
| 2104 |
borderContainerTop : borderContainer.domNode.offsetTop, |
|
| 2105 |
centerPaneTop : centerNode.offsetTop |
|
| 2106 |
}; |
|
| 2107 |
} |
|
| 2108 |
|
|
| 2109 |
function toggleCssForNode(node, cssStyleName, value) |
|
| 2110 |
{
|
|
| 2111 |
domClass.toggle(node, cssStyleName, value); |
|
| 2112 |
} |
|
| 2113 |
that.toggleCssForNode = toggleCssForNode; |
|
| 2114 |
|
|
| 2115 |
function toggleTitle(value) |
|
| 2116 |
{
|
|
| 2117 |
toggleCssForNode(dojoDialog.domNode, 'noTitleBar', value); |
|
| 2118 |
} |
|
| 2119 |
that.toggleTitle = toggleTitle; |
|
| 2120 |
|
|
| 2121 |
function hidePane(paneNode, value) |
|
| 2122 |
{
|
|
| 2123 |
toggleCssForNode(paneNode, 'hidePane', value); |
|
| 2124 |
} |
|
| 2125 |
that.hidePane = hidePane; |
|
| 2126 |
|
|
| 2127 |
function unregistry() |
|
| 2128 |
{
|
|
| 2129 |
var still = registry.byId(that.id); |
|
| 2130 |
if(still) |
|
| 2131 |
{
|
|
| 2132 |
try |
|
| 2133 |
{
|
|
| 2134 |
registry.remove(that.id); |
|
| 2135 |
} |
|
| 2136 |
catch(e) |
|
| 2137 |
{
|
|
| 2138 |
console.error('registry.remove failed', e);
|
|
| 2139 |
} |
|
| 2140 |
} |
|
| 2141 |
} |
|
| 2142 |
that.unregistry = unregistry; |
|
| 2143 |
|
|
| 2144 |
function doDialogLayout() |
|
| 2145 |
{
|
|
| 2146 |
var dim = computeDialogSize(); |
|
| 2147 |
// console.debug("doDialogLayout(): dim=" + JSON.stringify(dim));
|
|
| 2148 |
topPane.domNode.style.height = dim.topHeight + 'px'; |
|
| 2149 |
footerPane.domNode.style.height = dim.footerHeight + 'px'; |
|
| 2150 |
dojoDialog.domNode.style.height = dim.height + 'px'; |
|
| 2151 |
|
|
| 2152 |
var topPanelHeight = topPane.domNode.offsetHeight; |
|
| 2153 |
var centerPanelHeight = centerPane.domNode.offsetHeight; |
|
| 2154 |
centerPane.domNode.style.top = topPane.domNode.offsetHeight + 'px'; |
|
| 2155 |
footerPane.domNode.style.top = (topPane.domNode.offsetHeight + centerPane.domNode.offsetHeight) + 'px'; |
|
| 2156 |
|
|
| 2157 |
var centerPanelWidth = Math.max(centerPane.domNode.scrollWidth, centerPane.domNode.offsetWidth); |
|
| 2158 |
var topPanelWidth = Math.max(topPane.domNode.scrollWidth, topPane.domNode.offsetWidth); |
|
| 2159 |
var footerPanelWidth = Math.max(footerPane.domNode.scrollWidth, footerPane.domNode.offsetWidth); |
|
| 2160 |
var borderPanelWidth = Math.max(borderContainer.domNode.scrollWidth,borderContainer.domNode.offsetWidth); |
|
| 2161 |
borderPanelWidth = Math.max(dim.width, topPanelWidth, centerPanelWidth, footerPanelWidth, borderPanelWidth); |
|
| 2162 |
|
|
| 2163 |
borderContainer.domNode.style.width = borderPanelWidth + 'px'; |
|
| 2164 |
borderContainer.resize(); |
|
| 2165 |
//dojoDialog.resize(); |
|
| 2166 |
} |
|
| 2167 |
that.doDialogLayout = doDialogLayout; |
|
| 2168 |
|
|
| 2169 |
dojoDialog.on('show', doDialogLayout);
|
|
| 2170 |
|
|
| 2171 |
if (that.noTitle) |
|
| 2172 |
{
|
|
| 2173 |
domClass.add(dojoDialog.domNode, 'noTitleBar'); |
|
| 2174 |
domAttr.set(dojoDialog.domNode, 'aria-label', that.tooltip); |
|
| 2175 |
} |
|
| 2176 |
dojoDialog.placeAt(container); |
|
| 2177 |
dojoDialog.startup(); |
|
| 2178 |
that.dojoDialog = dojoDialog; |
|
| 2179 |
that.centerPane = centerPane; |
|
| 2180 |
that.footerPane = footerPane; |
|
| 2181 |
that.topPane = topPane; |
|
| 2182 |
contentDiv = centerPane.containerNode; |
|
| 2183 |
footerDiv = footerPane.containerNode; |
|
| 2184 |
buttonsDiv = topPane.containerNode; |
|
| 2185 |
titleDiv = dojoDialog.titleBar; |
|
| 2186 |
createDialogDeferred.resolve(true); |
|
| 2187 |
} |
|
| 2188 |
catch(e) |
|
| 2189 |
{
|
|
| 2190 |
createDialogDeferred.reject(e); |
|
| 2191 |
} |
|
| 2192 |
}); |
|
| 2193 |
return createDialogDeferred; |
|
| 2194 |
} |
|
| 1998 | 2195 |
|
| 1999 | 2196 |
setVisible(false); |
| 2000 | 2197 |
|
| 2001 | 2198 |
function setVisible(status) |
| 2002 | 2199 |
{
|
| 2003 |
dialog.visible = status;
|
|
| 2004 |
//console.debug(dialog.id + " visible = " + dialog.visible);
|
|
| 2200 |
that.visible = status;
|
|
| 2201 |
// console.debug(that.id + " visible = " + that.visible);
|
|
| 2005 | 2202 |
} |
| 2006 | 2203 |
|
| 2007 | 2204 |
// initial state is hidden |
| 2008 |
changeDisplayStyle(overlay, "none"); |
|
| 2009 |
changeVisibilityStyle(dialog, "collapse"); |
|
| 2205 |
var createDialogAction = createDojoDialog(container); |
|
| 2010 | 2206 |
|
| 2011 | 2207 |
if (!hidden) |
| 2012 | 2208 |
{
|
| 2013 | 2209 |
show(); |
| 2014 | 2210 |
} |
| 2015 | 2211 |
|
| 2212 |
function logError(msg) |
|
| 2213 |
{
|
|
| 2214 |
return function (e) |
|
| 2215 |
{
|
|
| 2216 |
console.error(msg, e); |
|
| 2217 |
} |
|
| 2218 |
} |
|
| 2219 |
|
|
| 2220 |
function updateLayout() |
|
| 2221 |
{
|
|
| 2222 |
if (that.disposed) |
|
| 2223 |
{
|
|
| 2224 |
return; |
|
| 2225 |
} |
|
| 2226 |
|
|
| 2227 |
createDialogAction.then(() => |
|
| 2228 |
{
|
|
| 2229 |
that.doDialogLayout(); |
|
| 2230 |
}, logError("createDojoDialog() failed"));
|
|
| 2231 |
} |
|
| 2232 |
|
|
| 2233 |
this.updateLayout = updateLayout; |
|
| 2234 |
|
|
| 2016 | 2235 |
function show() |
| 2017 | 2236 |
{
|
| 2018 |
if (dialog.disposed)
|
|
| 2237 |
if (that.disposed || that.visible)
|
|
| 2019 | 2238 |
{
|
| 2020 | 2239 |
return; |
| 2021 | 2240 |
} |
| 2022 | 2241 |
|
| 2023 |
if (!isVisible())
|
|
| 2242 |
createDialogAction.then(() =>
|
|
| 2024 | 2243 |
{
|
| 2025 |
updateZIndex(); |
|
| 2026 |
changeDisplayStyle(overlay, "block"); |
|
| 2027 |
changeVisibilityStyle(dialog, "visible"); |
|
| 2028 |
setVisible(true); |
|
| 2029 |
} |
|
| 2244 |
that.dojoDialog.show().then(function() |
|
| 2245 |
{
|
|
| 2246 |
setVisible(true); |
|
| 2247 |
dialogs.add(that.id); |
|
| 2248 |
// console.debug("show " + that.id + " " + dialogs.size);
|
|
| 2249 |
}, logError("dojoDialog.show() failed"));
|
|
| 2250 |
}, logError("createDojoDialog() failed"));
|
|
| 2030 | 2251 |
} |
| 2031 | 2252 |
|
| 2032 | 2253 |
this.show = show; |
| 2033 |
|
|
| 2034 | 2254 |
function hide() |
| 2035 | 2255 |
{
|
| 2036 |
if (isVisible()) |
|
| 2037 |
{
|
|
| 2038 |
changeDisplayStyle(overlay, "none");
|
|
| 2039 |
changeVisibilityStyle(dialog, "collapse");
|
|
| 2040 |
setVisible(false);
|
|
| 2041 |
var listener = dialog.listeners.get("onHide");
|
|
| 2042 |
if (listener)
|
|
| 2256 |
if (!isVisible())
|
|
| 2257 |
{
|
|
| 2258 |
return;
|
|
| 2259 |
}
|
|
| 2260 |
createDialogAction.then(() =>
|
|
| 2261 |
{
|
|
| 2262 |
that.dojoDialog.hide().then(() =>
|
|
| 2043 | 2263 |
{
|
| 2044 |
listener(); |
|
| 2045 |
} |
|
| 2046 |
} |
|
| 2264 |
var listener = that.listeners.get("onHide");
|
|
| 2265 |
if (listener) |
|
| 2266 |
{
|
|
| 2267 |
listener(); |
|
| 2268 |
} |
|
| 2269 |
setVisible(false); |
|
| 2270 |
dialogs.delete(that.id); |
|
| 2271 |
// console.debug("hide " + that.id + " " + dialogs.size);
|
|
| 2272 |
}, logError("dojoDialog.hide() failed"));
|
|
| 2273 |
}, logError("createDojoDialog() failed"));
|
|
| 2047 | 2274 |
} |
| 2048 | 2275 |
|
| 2049 | 2276 |
this.hide = hide; |
| ... | ... | |
| 2053 | 2280 |
*/ |
| 2054 | 2281 |
function isVisible() |
| 2055 | 2282 |
{
|
| 2056 |
return dialog.visible;
|
|
| 2283 |
return that.visible;
|
|
| 2057 | 2284 |
} |
| 2058 | 2285 |
|
| 2059 | 2286 |
this.isVisible = isVisible; |
| 2060 | 2287 |
|
| 2061 |
/** |
|
| 2062 |
* Update z-index |
|
| 2063 |
*/ |
|
| 2064 |
function updateZIndex() |
|
| 2065 |
{
|
|
| 2066 |
var zIndex = getMaxZIndex(); |
|
| 2067 |
overlay.style.zIndex = zIndex; |
|
| 2068 |
dialog.style.zIndex = zIndex + 1; |
|
| 2069 |
} |
|
| 2070 |
|
|
| 2071 |
function overrideDialogStyle(styleObject) |
|
| 2072 |
{
|
|
| 2073 |
setStyleForElement(dialog, styleObject); |
|
| 2288 |
function overrideDialogStyle(cssStyleName) |
|
| 2289 |
{
|
|
| 2290 |
createDialogAction.then( |
|
| 2291 |
function() |
|
| 2292 |
{
|
|
| 2293 |
that.toggleCssForNode(that.dojoDialog.domNode, cssStyleName, true); |
|
| 2294 |
}, |
|
| 2295 |
logError("createDojoDialog() failed"));
|
|
| 2074 | 2296 |
} |
| 2075 | 2297 |
|
| 2076 | 2298 |
this.overrideDialogStyle = overrideDialogStyle; |
| 2077 | 2299 |
|
| 2078 |
function overrideTitleStyle(styleObject)
|
|
| 2300 |
function overrideTitleStyle(cssStyleName)
|
|
| 2079 | 2301 |
{
|
| 2080 |
setStyleForElement(titleDiv, styleObject); |
|
| 2302 |
createDialogAction.then( |
|
| 2303 |
function() |
|
| 2304 |
{
|
|
| 2305 |
that.toggleCssForNode(titleDiv, cssStyleName, true); |
|
| 2306 |
}, |
|
| 2307 |
logError("createDojoDialog() failed"));
|
|
| 2081 | 2308 |
} |
| 2082 | 2309 |
|
| 2083 | 2310 |
this.overrideTitleStyle = overrideTitleStyle; |
| ... | ... | |
| 2104 | 2331 |
*/ |
| 2105 | 2332 |
function setContent(component) |
| 2106 | 2333 |
{
|
| 2107 |
removeAllChildren(contentDiv); |
|
| 2108 |
|
|
| 2109 |
if (component.htmlElement) |
|
| 2334 |
createDialogAction.then(function(resolved) |
|
| 2110 | 2335 |
{
|
| 2111 |
contentDiv.appendChild(component.htmlElement); |
|
| 2112 |
} |
|
| 2336 |
removeAllChildren(contentDiv); |
|
| 2337 |
|
|
| 2338 |
if (component.htmlElement) |
|
| 2339 |
{
|
|
| 2340 |
contentDiv.appendChild(component.htmlElement); |
|
| 2341 |
} |
|
| 2342 |
}, |
|
| 2343 |
logError("createDojoDialog() failed"));
|
|
| 2113 | 2344 |
} |
| 2114 | 2345 |
|
| 2115 | 2346 |
this.setContent = setContent; |
| ... | ... | |
| 2122 | 2353 |
*/ |
| 2123 | 2354 |
function setTextContent(text) |
| 2124 | 2355 |
{
|
| 2125 |
removeAllChildren(contentDiv); |
|
| 2126 |
|
|
| 2127 |
var textEl = document.createTextNode(text); |
|
| 2128 |
var textDiv = document.createElement("div");
|
|
| 2129 |
textDiv.appendChild(textEl); |
|
| 2130 |
textDiv.className = "text centered"; |
|
| 2131 |
contentDiv.appendChild(textDiv); |
|
| 2356 |
createDialogAction.then(function(resolved) |
|
| 2357 |
{
|
|
| 2358 |
removeAllChildren(contentDiv); |
|
| 2359 |
|
|
| 2360 |
var textEl = document.createTextNode(text); |
|
| 2361 |
var textDiv = document.createElement("div");
|
|
| 2362 |
textDiv.appendChild(textEl); |
|
| 2363 |
textDiv.className = "text"; |
|
| 2364 |
contentDiv.appendChild(textDiv); |
|
| 2365 |
}, |
|
| 2366 |
logError("createDojoDialog() failed"));
|
|
| 2132 | 2367 |
} |
| 2133 | 2368 |
|
| 2134 | 2369 |
this.setTextContent = setTextContent; |
| ... | ... | |
| 2141 | 2376 |
*/ |
| 2142 | 2377 |
function setButtons(components) |
| 2143 | 2378 |
{
|
| 2144 |
if (buttonsDiv) |
|
| 2379 |
createDialogAction.then( |
|
| 2380 |
function(resolved) |
|
| 2145 | 2381 |
{
|
| 2382 |
if (that.topPane.domNode) |
|
| 2383 |
{
|
|
| 2384 |
that.hidePane(that.topPane.domNode, false); |
|
| 2385 |
} |
|
| 2146 | 2386 |
removeAllChildren(buttonsDiv); |
| 2147 |
} |
|
| 2148 |
else |
|
| 2149 |
{
|
|
| 2150 |
buttonsDiv = document.createElement("div");
|
|
| 2151 |
buttonsDiv.className = "buttons spring"; |
|
| 2152 |
dialog.appendChild(buttonsDiv); |
|
| 2153 |
} |
|
| 2154 |
if (!Array.isArray(components)) |
|
| 2155 |
{
|
|
| 2156 |
return; |
|
| 2157 |
} |
|
| 2158 |
for (var i = 0; i < components.length; i++) |
|
| 2159 |
{
|
|
| 2160 |
var component = components[i]; |
|
| 2161 |
var buttonElem; |
|
| 2162 |
if (component.type == "button") |
|
| 2163 |
{
|
|
| 2164 |
buttonElem = document.createElement("button");
|
|
| 2165 |
buttonElem.className = "button"; |
|
| 2166 |
buttonElem.type = "button"; |
|
| 2167 |
var labelText = document.createTextNode(component.label); |
|
| 2168 |
buttonElem.appendChild(labelDiv); |
|
| 2169 |
buttonElem.tabIndex = 0; |
|
| 2170 |
buttonElem.onclick = component.onclick; |
|
| 2171 |
|
|
| 2172 |
} |
|
| 2173 |
else |
|
| 2174 |
{
|
|
| 2175 |
buttonElem = document.createElement("div");
|
|
| 2176 |
buttonElem.className = "button"; |
|
| 2177 |
//add html element |
|
| 2178 |
buttonElem.appendChild(component.htmlElement); |
|
| 2179 |
} |
|
| 2180 |
buttonsDiv.appendChild(buttonElem); |
|
| 2181 |
} |
|
| 2387 |
for (var i = 0; i < components.length; i++) |
|
| 2388 |
{
|
|
| 2389 |
var component = components[i]; |
|
| 2390 |
var buttonElem; |
|
| 2391 |
if (component.type == "button") |
|
| 2392 |
{
|
|
| 2393 |
buttonElem = document.createElement("button");
|
|
| 2394 |
buttonElem.className = "button"; |
|
| 2395 |
buttonElem.type = "button"; |
|
| 2396 |
var labelText = document.createTextNode(component.label); |
|
| 2397 |
buttonElem.appendChild(labelText); |
|
| 2398 |
buttonElem.tabIndex = 0; |
|
| 2399 |
buttonElem.onclick = component.onclick; |
|
| 2400 |
} |
|
| 2401 |
else |
|
| 2402 |
{
|
|
| 2403 |
buttonElem = document.createElement("div");
|
|
| 2404 |
buttonElem.className = "button"; |
|
| 2405 |
//add html element |
|
| 2406 |
buttonElem.appendChild(component.htmlElement); |
|
| 2407 |
} |
|
| 2408 |
buttonsDiv.appendChild(buttonElem); |
|
| 2409 |
} |
|
| 2410 |
}, |
|
| 2411 |
logError("createDojoDialog() failed"));
|
|
| 2182 | 2412 |
} |
| 2183 | 2413 |
|
| 2184 | 2414 |
this.setButtons = setButtons; |
| ... | ... | |
| 2191 | 2421 |
*/ |
| 2192 | 2422 |
function setFooter(component) |
| 2193 | 2423 |
{
|
| 2194 |
if (footerDiv) |
|
| 2195 |
{
|
|
| 2196 |
removeAllChildren(footerDiv); |
|
| 2197 |
} |
|
| 2198 |
else |
|
| 2199 |
{
|
|
| 2200 |
footerDiv = document.createElement("div");
|
|
| 2201 |
footerDiv.className = "footer spring"; |
|
| 2202 |
dialog.appendChild(footerDiv); |
|
| 2203 |
} |
|
| 2204 |
|
|
| 2205 |
if (component.htmlElement) |
|
| 2206 |
{
|
|
| 2207 |
footerDiv.appendChild(component.htmlElement); |
|
| 2208 |
} |
|
| 2424 |
createDialogAction.then( |
|
| 2425 |
function(resolved) |
|
| 2426 |
{
|
|
| 2427 |
if (that.footerPane) |
|
| 2428 |
{
|
|
| 2429 |
that.hidePane(that.footerPane.domNode, false); |
|
| 2430 |
} |
|
| 2431 |
if (footerDiv) |
|
| 2432 |
{
|
|
| 2433 |
removeAllChildren(footerDiv); |
|
| 2434 |
} |
|
| 2435 |
|
|
| 2436 |
if (component.htmlElement) |
|
| 2437 |
{
|
|
| 2438 |
footerDiv.appendChild(component.htmlElement); |
|
| 2439 |
} |
|
| 2440 |
}, |
|
| 2441 |
logError("createDojoDialog() failed"));
|
|
| 2209 | 2442 |
} |
| 2210 | 2443 |
|
| 2211 | 2444 |
this.setFooter = setFooter; |
| ... | ... | |
| 2244 | 2477 |
*/ |
| 2245 | 2478 |
function setTitle(title) |
| 2246 | 2479 |
{
|
| 2247 |
removeAllChildren(titleDiv); |
|
| 2248 | 2480 |
if (title) |
| 2249 | 2481 |
{
|
| 2250 |
title = title.trim(); |
|
| 2251 |
titleDiv.appendChild(document.createTextNode(title)); |
|
| 2482 |
title = title.trim(); |
|
| 2483 |
that.noTitle = title.length == 0; |
|
| 2484 |
} |
|
| 2485 |
createDialogAction.then( |
|
| 2486 |
function(resolved) |
|
| 2487 |
{
|
|
| 2488 |
that.toggleTitle(that.noTitle); |
|
| 2252 | 2489 |
if (title) |
| 2253 | 2490 |
{
|
| 2254 |
var baseClass = titleDiv.className; |
|
| 2255 |
if (baseClass.indexOf("spring") < 0)
|
|
| 2256 |
{
|
|
| 2257 |
titleDiv.className = baseClass + " spring"; |
|
| 2258 |
} |
|
| 2491 |
title = title.trim(); |
|
| 2492 |
|
|
| 2493 |
that.dojoDialog.set("title", title);
|
|
| 2259 | 2494 |
} |
| 2260 |
} |
|
| 2495 |
}, |
|
| 2496 |
logError("createDojoDialog() failed"));
|
|
| 2261 | 2497 |
} |
| 2262 | 2498 |
|
| 2263 | 2499 |
this.setTitle = setTitle; |
| ... | ... | |
| 2277 | 2513 |
{
|
| 2278 | 2514 |
if (documentListener) |
| 2279 | 2515 |
{
|
| 2280 |
var chainedListeners = dialog.triggers.get(eventType);
|
|
| 2516 |
var chainedListeners = that.triggers.get(eventType);
|
|
| 2281 | 2517 |
if (!chainedListeners) |
| 2282 | 2518 |
{
|
| 2283 | 2519 |
chainedListeners = new ChainedListeners(); |
| 2284 |
dialog.triggers.set(eventType, chainedListeners);
|
|
| 2520 |
that.triggers.set(eventType, chainedListeners);
|
|
| 2285 | 2521 |
var wrappedChainedListener = function(event) |
| 2286 | 2522 |
{
|
| 2287 |
dialog.locked = true;
|
|
| 2523 |
that.locked = true;
|
|
| 2288 | 2524 |
chainedListeners.handle(event); |
| 2289 |
dialog.locked = false;
|
|
| 2290 |
while(dialog.postponedActions.length > 0)
|
|
| 2525 |
that.locked = false;
|
|
| 2526 |
while(that.postponedActions.length > 0)
|
|
| 2291 | 2527 |
{
|
| 2292 |
var action = dialog.postponedActions.pop();
|
|
| 2528 |
var action = that.postponedActions.pop();
|
|
| 2293 | 2529 |
action(); |
| 2294 | 2530 |
} |
| 2295 | 2531 |
} |
| ... | ... | |
| 2310 | 2546 |
} |
| 2311 | 2547 |
else |
| 2312 | 2548 |
{
|
| 2313 |
dialog.listeners.set(eventType, handler);
|
|
| 2549 |
that.listeners.set(eventType, handler);
|
|
| 2314 | 2550 |
} |
| 2315 | 2551 |
}; |
| 2316 | 2552 |
|
| ... | ... | |
| 2324 | 2560 |
*/ |
| 2325 | 2561 |
function removeTrigger(eventType) |
| 2326 | 2562 |
{
|
| 2327 |
var chainedListeners = dialog.triggers.get(eventType);
|
|
| 2563 |
var chainedListeners = that.triggers.get(eventType);
|
|
| 2328 | 2564 |
if (chainedListeners) |
| 2329 | 2565 |
{
|
| 2330 | 2566 |
window.removeEventListener(eventType, chainedListeners.wrappedChainedListener, true); |
| 2331 |
dialog.triggers.delete(eventType);
|
|
| 2567 |
that.triggers.delete(eventType);
|
|
| 2332 | 2568 |
} |
| 2333 | 2569 |
else |
| 2334 | 2570 |
{
|
| 2335 |
dialog.listeners.delete(eventType);
|
|
| 2571 |
that.listeners.delete(eventType);
|
|
| 2336 | 2572 |
} |
| 2337 | 2573 |
}; |
| 2338 | 2574 |
|
| ... | ... | |
| 2343 | 2579 |
*/ |
| 2344 | 2580 |
function close() |
| 2345 | 2581 |
{
|
| 2346 |
if (dialog.locked) |
|
| 2347 |
{
|
|
| 2348 |
dialog.postponedActions.push(function() {close();});
|
|
| 2349 |
return; |
|
| 2350 |
} |
|
| 2351 |
if (!dialog.disposed) |
|
| 2352 |
{
|
|
| 2353 |
hide(); |
|
| 2354 |
dialog.parentNode.removeChild(dialog); |
|
| 2355 |
var overlay = dialog.overlay; |
|
| 2356 |
if (overlay) |
|
| 2357 |
{
|
|
| 2358 |
overlay.parentNode.removeChild(overlay); |
|
| 2359 |
} |
|
| 2360 |
if (buttonsDiv) |
|
| 2361 |
{
|
|
| 2362 |
removeAllChildren(buttonsDiv); |
|
| 2363 |
} |
|
| 2364 |
if (footerDiv) |
|
| 2365 |
{
|
|
| 2366 |
removeAllChildren(footerDiv); |
|
| 2367 |
} |
|
| 2368 |
var listener = dialog.listeners.get("onClose");
|
|
| 2369 |
|
|
| 2370 |
dialog.triggers.forEach( |
|
| 2371 |
function(handler, eventType, triggers) |
|
| 2372 |
{
|
|
| 2373 |
removeTrigger(eventType); |
|
| 2374 |
}); |
|
| 2375 |
dialog.listeners.forEach( |
|
| 2376 |
function(handler, eventType, triggers) |
|
| 2377 |
{
|
|
| 2378 |
removeTrigger(eventType); |
|
| 2379 |
}); |
|
| 2380 |
|
|
| 2381 |
dialog.disposed = true; |
|
| 2382 |
|
|
| 2383 |
if (listener) |
|
| 2384 |
{
|
|
| 2385 |
listener(); |
|
| 2386 |
} |
|
| 2387 |
} |
|
| 2582 |
// console.debug("close() " + that.id);
|
|
| 2583 |
if (that.locked) |
|
| 2584 |
{
|
|
| 2585 |
that.postponedActions.push(function() {close();});
|
|
| 2586 |
return; |
|
| 2587 |
} |
|
| 2588 |
if (that.disposed) |
|
| 2589 |
{
|
|
| 2590 |
return; |
|
| 2591 |
} |
|
| 2592 |
createDialogAction.then(() => |
|
| 2593 |
{
|
|
| 2594 |
// console.debug("close() dispose part: " + that.id);
|
|
| 2595 |
that.dojoDialog.hide().then(()=> |
|
| 2596 |
{
|
|
| 2597 |
if (that.dojoDialog) |
|
| 2598 |
{
|
|
| 2599 |
that.dojoDialog.destroyRecursive(); |
|
| 2600 |
} |
|
| 2601 |
if (that.dojoDialog.domNode) |
|
| 2602 |
{
|
|
| 2603 |
that.container.removeChild(that.dojoDialog.domNode); |
|
| 2604 |
} |
|
| 2605 |
|
|
| 2606 |
if (buttonsDiv) |
|
| 2607 |
{
|
|
| 2608 |
removeAllChildren(buttonsDiv); |
|
| 2609 |
} |
|
| 2610 |
buttonsDiv = null; |
|
| 2611 |
if (footerDiv) |
|
| 2612 |
{
|
|
| 2613 |
removeAllChildren(footerDiv); |
|
| 2614 |
} |
|
| 2615 |
footerDiv = null; |
|
| 2616 |
that.dojoDialog = null; |
|
| 2617 |
|
|
| 2618 |
var listener = that.listeners.get("onClose");
|
|
| 2619 |
|
|
| 2620 |
that.triggers.forEach( |
|
| 2621 |
function(handler, eventType, triggers) |
|
| 2622 |
{
|
|
| 2623 |
removeTrigger(eventType); |
|
| 2624 |
}); |
|
| 2625 |
that.listeners.forEach( |
|
| 2626 |
function(handler, eventType, triggers) |
|
| 2627 |
{
|
|
| 2628 |
removeTrigger(eventType); |
|
| 2629 |
}); |
|
| 2630 |
|
|
| 2631 |
if (listener) |
|
| 2632 |
{
|
|
| 2633 |
listener(); |
|
| 2634 |
} |
|
| 2635 |
that.unregistry(); |
|
| 2636 |
that.disposed = true; |
|
| 2637 |
dialogs.delete(that.id); |
|
| 2638 |
// console.debug("close() " + that.id + " " + dialogs.size);
|
|
| 2639 |
}, |
|
| 2640 |
logError("dojoDialog.hide() failed"));
|
|
| 2641 |
}, |
|
| 2642 |
logError("createDojoDialog() failed"));
|
|
| 2388 | 2643 |
}; |
| 2389 | 2644 |
|
| 2390 | 2645 |
this.close = close; |
| ... | ... | |
| 2394 | 2649 |
*/ |
| 2395 | 2650 |
function isDisposed() |
| 2396 | 2651 |
{
|
| 2397 |
return dialog.disposed;
|
|
| 2652 |
return that.disposed;
|
|
| 2398 | 2653 |
} |
| 2399 | 2654 |
|
| 2400 | 2655 |
this.isDisposed = isDisposed; |
| 2401 | 2656 |
|
| 2402 |
/** |
|
| 2403 |
* Creates the overlay panel that must cover the displayed page. |
|
| 2404 |
* |
|
| 2405 |
* @param {String} id
|
|
| 2406 |
* The element unique identifier. |
|
| 2407 |
* @param {Number} zIndex
|
|
| 2408 |
* The maximal z-index calculated for the current page. |
|
| 2409 |
* @param {HtmlElement} container
|
|
| 2410 |
* The container element. |
|
| 2411 |
* |
|
| 2412 |
* @return The overlay panel. |
|
| 2413 |
*/ |
|
| 2414 |
function createOverlayPanel(id, zIndex, container) |
|
| 2415 |
{
|
|
| 2416 |
var overlayPanel = document.getElementById(id); |
|
| 2417 |
|
|
| 2418 |
if (!overlayPanel) |
|
| 2419 |
{
|
|
| 2420 |
overlayPanel = document.createElement("div");
|
|
| 2421 |
overlayPanel.id = id; |
|
| 2422 |
overlayPanel.className = "overlay"; |
|
| 2423 |
} |
|
| 2424 |
if (!container.contains(overlayPanel)) |
|
| 2425 |
{
|
|
| 2426 |
container.appendChild(overlayPanel); |
|
| 2427 |
} |
|
| 2428 |
overlayPanel.style.zIndex = zIndex; |
|
| 2429 |
|
|
| 2430 |
return overlayPanel; |
|
| 2431 |
}; |
|
| 2432 |
|
|
| 2433 |
/** |
|
| 2434 |
* Gets the modal dialog overlay panel unique identifier. |
|
| 2435 |
* |
|
| 2436 |
* @param {String} dialogId
|
|
| 2437 |
* The dialog unique identifier. |
|
| 2438 |
* |
|
| 2439 |
* @return The overlay element unique identifier. |
|
| 2440 |
*/ |
|
| 2441 |
function getOverlayId(dialogId) |
|
| 2442 |
{
|
|
| 2443 |
return dialogId + "_overlay"; |
|
| 2444 |
} |
|
| 2445 | 2657 |
}; |
| 2446 | 2658 |
|
| 2447 | 2659 |
/** |
| new/src/com/goldencode/p2j/ui/client/driver/web/res/p2j.logger.js 2025-12-19 21:57:54 +0000 | ||
|---|---|---|
| 18 | 18 |
** dojo library has been loaded. |
| 19 | 19 |
** 006 SBI 20220518 Added enable()/disable() logging functionality. |
| 20 | 20 |
** 007 PMP 20241126 Removed unused createClipboardDialog and replaced its usage with requestClipboardWrite. |
| 21 |
** 008 SBI 20251220 Fixed the dialog size to fit the screen view port. |
|
| 21 | 22 |
*/ |
| 22 | 23 |
/* |
| 23 | 24 |
** This program is free software: you can redistribute it and/or modify |
| ... | ... | |
| 107 | 108 |
require(["dojo/dom","dojo/dom-style", "dojo/dom-construct", "dijit/Dialog", "dijit/form/Textarea", "dijit/form/Button", "dojo/domReady!"], |
| 108 | 109 |
function(dom, domStyle, domConstruct, Dialog, Textarea, Button) |
| 109 | 110 |
{
|
| 110 |
var style = "width:800px;height:600px;display:flex;flex-direction:column;";
|
|
| 111 |
var style = "width:80vw;height:80vh;display:flex;flex-direction:column;";
|
|
| 111 | 112 |
var div = domConstruct.create("div", { style: style });
|
| 112 | 113 |
dialog = new Dialog( |
| 113 | 114 |
{
|
| ... | ... | |
| 131 | 132 |
|
| 132 | 133 |
dialog.addLogs = addLogs; |
| 133 | 134 |
|
| 134 |
style = "width:100%;height:100px;display:flex;flex-direction: row;padding:10px;";
|
|
| 135 |
style = "width:100%;height:50px;display:flex;flex-direction: row;padding:10px;";
|
|
| 135 | 136 |
var buttonPanelDiv = domConstruct.create("div", { style: style }, div);
|
| 136 | 137 |
var button = domConstruct.create("button", { }, buttonPanelDiv);
|
| 137 | 138 |
button.id = "copyLogsToClipboard"; |
| new/src/com/goldencode/p2j/ui/client/driver/web/res/p2j.socket.js 2025-12-19 22:14:36 +0000 | ||
|---|---|---|
| 195 | 195 |
** information sent by client to the JS web client. |
| 196 | 196 |
** IMS 20250527 Added SET_WINDOW_STATE instead of SET_ICONIFICATIO_STATE. Modified |
| 197 | 197 |
** SET_WINDOW_STATE for treating window state information sent by client to the JS web client. |
| 198 |
** 078 SBI 20251220 Changed ModalDialog parameters, hide the restore connection dialog |
|
| 199 |
** if the server unavailable dialog is shown. |
|
| 198 | 200 |
*/ |
| 199 | 201 | |
| 200 | 202 |
/* |
| ... | ... | |
| 5503 | 5505 |
{
|
| 5504 | 5506 |
if (!serverUnavailableDialog.isDisposed()) |
| 5505 | 5507 |
{
|
| 5508 |
if (hideRestoreConnectionDialog) |
|
| 5509 |
{
|
|
| 5510 |
clearTimeout(hideRestoreConnectionDialog); |
|
| 5511 |
} |
|
| 5512 |
if (restoreConnectionDialog) |
|
| 5513 |
{
|
|
| 5514 |
restoreConnectionDialog.hide(); |
|
| 5515 |
} |
|
| 5516 | ||
| 5506 | 5517 |
serverUnavailableDialog.show(); |
| 5507 | 5518 |
} |
| 5508 | 5519 |
}); |
| ... | ... | |
| 5626 | 5637 |
document.body, |
| 5627 | 5638 |
tryToConnectMessage + " " + p2j.pressEscape, |
| 5628 | 5639 |
p2j.pressEscape, |
| 5629 |
true); |
|
| 5640 |
true, {"noTitle" : false, "closable" : false});
|
|
| 5630 | 5641 |
restoreConnectionDialog.addTrigger("keydown", function(event)
|
| 5631 | 5642 |
{
|
| 5632 | 5643 |
if (event.keyCode == keys.ESCAPE) |
| ... | ... | |
| 5639 | 5650 |
} |
| 5640 | 5651 |
restoreConnectionDialog.close(); |
| 5641 | 5652 |
connectivityTimer.kill(); |
| 5653 |
|
|
| 5642 | 5654 |
// Redirect to the logout page if a user cancels this dialog |
| 5643 | 5655 |
doRedirectToLogoutPage(); |
| 5644 | 5656 |
} |
| ... | ... | |
| 5648 | 5660 |
document.body, |
| 5649 | 5661 |
connectionRestoredMessage + " " + p2j.pressAnyKey, |
| 5650 | 5662 |
p2j.pressAnyKey, |
| 5651 |
true); |
|
| 5663 |
true, {"noTitle" : true, "closable" : false});
|
|
| 5652 | 5664 |
connectionRestoredDialog.addTrigger("keydown", function(event)
|
| 5653 | 5665 |
{
|
| 5654 | 5666 |
p2j.consumeEvent(event); |
| ... | ... | |
| 5660 | 5672 |
document.body, |
| 5661 | 5673 |
serverUnavailableMessage + " " + p2j.pressEscape, |
| 5662 | 5674 |
p2j.pressEscape, |
| 5663 |
true); |
|
| 5675 |
true, {"noTitle" : true, "closable" : false});
|
|
| 5664 | 5676 |
serverUnavailableDialog.addTrigger("keydown", function(event)
|
| 5665 | 5677 |
{
|
| 5666 | 5678 |
if (event.keyCode == keys.ESCAPE) |
| new/src/com/goldencode/p2j/ui/client/gui/driver/web/res/p2j.screen.js 2025-12-19 21:54:09 +0000 | ||
|---|---|---|
| 253 | 253 |
** owner of the dialog/alert box is a modal window. |
| 254 | 254 |
** 096 IMS 20250527 Added a new state in window class. {@code "this.windowState = commonWindowState.UNINITIALIZED"}
|
| 255 | 255 |
** referring to an invalid or uninitialized windowState value. Added an enum object with window states. |
| 256 |
** Added a new method updateWindowState to update the window state. Refs #9973a. |
|
| 256 |
** Added a new method updateWindowState to update the window state. Refs #9973a. |
|
| 257 |
** 097 SBI 20251220 Improved the logic to show Uploading notification dialog. |
|
| 257 | 258 |
*/ |
| 258 | 259 | |
| 259 | 260 |
/* |
| ... | ... | |
| 1839 | 1840 |
document.body, |
| 1840 | 1841 |
SignatureWidget.warning + " " + p2j.pressEscape, |
| 1841 | 1842 |
p2j.pressEscape, |
| 1842 |
true); |
|
| 1843 |
true, {"noTitle" : true, "closable" : false});
|
|
| 1843 | 1844 |
var hideAlertDialog = setTimeout(function() |
| 1844 | 1845 |
{
|
| 1845 | 1846 |
alertDialog.close(); |
| ... | ... | |
| 7350 | 7351 |
document.body, |
| 7351 | 7352 |
p2j.i18n.gettext("Grant access to upload/select system files?"),
|
| 7352 | 7353 |
"", |
| 7353 |
true); |
|
| 7354 |
true, {"noTitle" : false, "closable" : false});
|
|
| 7354 | 7355 |
dialog.setTitle(p2j.i18n.gettext("Security Warning"));
|
| 7355 | 7356 |
|
| 7356 | 7357 |
const label = p2j.i18n.gettext("OK");
|
| ... | ... | |
| 7399 | 7400 |
document.body, |
| 7400 | 7401 |
"", |
| 7401 | 7402 |
"", |
| 7402 |
true); |
|
| 7403 |
true, {"noTitle" : false, "closable" : false});
|
|
| 7403 | 7404 |
actionResultsDialog.setTitle(p2j.i18n.gettext("Uploading..."));
|
| 7404 | 7405 |
actionResultsDialog.setContent({htmlElement : l.domNode});
|
| 7405 | 7406 |
|
| ... | ... | |
| 7410 | 7411 |
dojo.query(".dojoxUploaderFileList").style({ border: "0px", "min-height": "0px" });
|
| 7411 | 7412 |
dojo.query(".dojoxUploaderFileListTable").style({ display: "none" });
|
| 7412 | 7413 |
} |
| 7414 |
// 1 onChange: |
|
| 7415 |
// Fires when files are selected |
|
| 7416 |
// Event is an array of last files selected |
|
| 7417 |
|
|
| 7418 |
// 2 onBegin: |
|
| 7419 |
// Fires when upload begins |
|
| 7420 |
|
|
| 7421 |
// 3 onProgress: |
|
| 7422 |
// Fires on upload progress. Event is a normalized object of common properties |
|
| 7423 |
// from HTML5 uploaders and the Flash uploader. Will not fire for IFrame. |
|
| 7424 |
// customEvent: |
|
| 7425 |
// - bytesLoaded: Number: |
|
| 7426 |
// Amount of bytes uploaded so far of entire payload (all files) |
|
| 7427 |
// - bytesTotal: Number: |
|
| 7428 |
// Amount of bytes of entire payload (all files) |
|
| 7429 |
// - type: String: |
|
| 7430 |
// Type of event (progress or load) |
|
| 7431 |
// - timeStamp: Number: |
|
| 7432 |
// Timestamp of when event occurred |
|
| 7433 |
|
|
| 7434 |
// 4 onComplete: |
|
| 7435 |
// Fires when all files have uploaded |
|
| 7436 |
// 5 onCancel: |
|
| 7437 |
// Fires when dialog box has been closed |
|
| 7438 |
// without a file selection |
|
| 7439 |
// 6 onAbort |
|
| 7440 |
// Fires when upload in progress was canceled |
|
| 7441 |
// 7 onError: |
|
| 7442 |
// Fires on errors |
|
| 7413 | 7443 | |
| 7414 | 7444 |
dojo.connect(u, "onBegin", function (files) |
| 7415 | 7445 |
{
|
| 7416 |
//console.debug("onBegin");
|
|
| 7446 |
// console.debug("onBegin");
|
|
| 7417 | 7447 |
closeButton.set('disabled', true);
|
| 7418 | 7448 |
}); |
| 7419 | 7449 |
|
| 7420 | 7450 |
var closeTimeout; |
| 7421 | 7451 |
var closeAction = function() |
| 7422 | 7452 |
{
|
| 7453 |
if (closeTimeout) |
|
| 7454 |
{
|
|
| 7455 |
clearTimeout(closeTimeout); |
|
| 7456 |
} |
|
| 7423 | 7457 |
actionResultsDialog.close(); |
| 7424 | 7458 |
dialog.close(); |
| 7425 | 7459 |
} |
| ... | ... | |
| 7428 | 7462 |
|
| 7429 | 7463 |
dojo.connect(u, "onProgress", function (event) |
| 7430 | 7464 |
{
|
| 7431 |
//console.debug("onProgress");
|
|
| 7432 |
if (event.type == "load") |
|
| 7433 |
{
|
|
| 7434 |
//console.debug("onProgress --> " + JSON.stringify(event));
|
|
| 7435 |
if (closeTimeout) |
|
| 7436 |
{
|
|
| 7437 |
clearTimeout(closeTimeout); |
|
| 7438 |
} |
|
| 7439 |
closeAction(); |
|
| 7465 |
// console.debug("onProgress");
|
|
| 7466 |
if (actionResultsDialog.isVisible()) |
|
| 7467 |
{
|
|
| 7468 |
actionResultsDialog.updateLayout(); |
|
| 7469 |
} |
|
| 7470 |
else |
|
| 7471 |
{
|
|
| 7472 |
actionResultsDialog.show(); |
|
| 7440 | 7473 |
} |
| 7441 | 7474 |
}); |
| 7442 | 7475 |
dojo.connect(u, "onError", function (error) |
| 7443 | 7476 |
{
|
| 7444 |
//console.debug("onError");
|
|
| 7445 |
var errorString = JSON.stringify(error);
|
|
| 7446 |
console.error(errorString); |
|
| 7477 |
// console.debug("onError");
|
|
| 7478 |
var errorString = error ? JSON.stringify(error) : "";
|
|
| 7479 | ||
| 7447 | 7480 |
var resultDiv = dojo.create('div',
|
| 7448 | 7481 |
{ innerHTML: p2j.i18n.ngettext("Error '%2' when uploading %1 file.",
|
| 7449 | 7482 |
"Error '%2' when uploading %1 files.", |
| 7450 | 7483 |
actionResultsDialog.files.length, |
| 7451 | 7484 |
errorString)}); |
| 7485 |
resultDiv.className = "text"; |
|
| 7452 | 7486 |
actionResultsDialog.setFooter({htmlElement : resultDiv});
|
| 7453 |
if (!actionResultsDialog.isVisible()) |
|
| 7487 |
if (actionResultsDialog.isVisible()) |
|
| 7488 |
{
|
|
| 7489 |
actionResultsDialog.updateLayout(); |
|
| 7490 |
} |
|
| 7491 |
else |
|
| 7454 | 7492 |
{
|
| 7455 | 7493 |
actionResultsDialog.show(); |
| 7456 | 7494 |
} |
| ... | ... | |
| 7462 | 7500 | |
| 7463 | 7501 |
dojo.connect(u, "onChange", function (files) |
| 7464 | 7502 |
{
|
| 7465 |
//console.debug("onChange");
|
|
| 7503 |
// console.debug("onChange");
|
|
| 7466 | 7504 |
if (upload) |
| 7467 | 7505 |
{
|
| 7468 | 7506 |
var result = checkUploadedFiles(u.getFileList()); |
| 7469 | 7507 |
if (result["status"]) |
| 7470 | 7508 |
{
|
| 7471 |
u.upload(); |
|
| 7509 |
try |
|
| 7510 |
{
|
|
| 7511 |
u.upload(); |
|
| 7512 |
} |
|
| 7513 |
catch(e) |
|
| 7514 |
{
|
|
| 7515 |
console.error("u.upload() failed", e);
|
|
| 7516 |
} |
|
| 7472 | 7517 |
dialog.hide(); |
| 7473 | 7518 |
actionResultsDialog.files = files; |
| 7474 | 7519 |
actionResultsDialog.show(); |
| ... | ... | |
| 7476 | 7521 |
else |
| 7477 | 7522 |
{
|
| 7478 | 7523 |
actionResultsDialog.setTextContent(result["error"] + " " + p2j.pressAnyKey); |
| 7479 |
actionResultsDialog.addTrigger("keydown", function(event)
|
|
| 7524 |
actionResultsDialog.addTrigger("keyup", function(event)
|
|
| 7480 | 7525 |
{
|
| 7481 | 7526 |
p2j.consumeEvent(event); |
| 7482 | 7527 |
closeAction(); |
| ... | ... | |
| 7495 | 7540 |
} |
| 7496 | 7541 |
|
| 7497 | 7542 |
p2j.socket.sendFileChoose(uploadId, selectedFiles, uploadedFiles, direct, false); |
| 7498 |
|
|
| 7499 | 7543 |
closeAction(); |
| 7500 | 7544 |
return; |
| 7501 | 7545 |
} |
| ... | ... | |
| 7503 | 7547 | |
| 7504 | 7548 |
dojo.connect(u, "onComplete", function(files) |
| 7505 | 7549 |
{
|
| 7506 |
//console.debug("onComplete");
|
|
| 7507 |
for (var i = 0; i < files.length; i++)
|
|
| 7550 |
// console.debug("onComplete");
|
|
| 7551 |
if (files)
|
|
| 7508 | 7552 |
{
|
| 7509 |
if (files[i].file) |
|
| 7510 |
{
|
|
| 7511 |
uploadedFiles.push(files[i].file); |
|
| 7512 |
} |
|
| 7513 |
if (files[i].name) |
|
| 7514 |
{
|
|
| 7515 |
selectedFiles.push(files[i].name); |
|
| 7516 |
} |
|
| 7553 |
for (var i = 0; i < files.length; i++) |
|
| 7554 |
{
|
|
| 7555 |
if (files[i].file) |
|
| 7556 |
{
|
|
| 7557 |
uploadedFiles.push(files[i].file); |
|
| 7558 |
} |
|
| 7559 |
if (files[i].name) |
|
| 7560 |
{
|
|
| 7561 |
selectedFiles.push(files[i].name); |
|
| 7562 |
} |
|
| 7563 |
} |
|
| 7564 |
|
|
| 7565 |
p2j.socket.sendFileChoose(uploadId, selectedFiles, uploadedFiles, direct, false); |
|
| 7517 | 7566 |
} |
| 7518 |
|
|
| 7519 |
p2j.socket.sendFileChoose(uploadId, selectedFiles, uploadedFiles, direct, false); |
|
| 7520 |
|
|
| 7521 | 7567 |
if (!multiple) |
| 7522 | 7568 |
{
|
| 7523 | 7569 |
closeAction(); |
| ... | ... | |
| 7539 | 7585 |
"Error when uploading %1 files", |
| 7540 | 7586 |
actionResultsDialog.files.length) }); |
| 7541 | 7587 |
} |
| 7542 |
|
|
| 7588 |
resultDiv.className = "text"; |
|
| 7543 | 7589 |
actionResultsDialog.setFooter({htmlElement : resultDiv});
|
| 7590 |
|
|
| 7591 |
if (actionResultsDialog.isVisible()) |
|
| 7592 |
{
|
|
| 7593 |
actionResultsDialog.updateLayout(); |
|
| 7594 |
} |
|
| 7595 |
else |
|
| 7596 |
{
|
|
| 7597 |
actionResultsDialog.show(); |
|
| 7598 |
} |
|
| 7599 |
|
|
| 7544 | 7600 |
closeTimeout = setTimeout(closeAction, delayForCloseAction); |
| 7545 | 7601 |
}); |
| 7546 | 7602 | |
| ... | ... | |
| 7554 | 7610 | |
| 7555 | 7611 |
dialog.addTrigger("onClose", finalHandler, false);
|
| 7556 | 7612 | |
| 7557 |
me.processMouse = direct;
|
|
| 7613 |
me.processMouse = false;
|
|
| 7558 | 7614 |
|
| 7559 | 7615 |
if (direct) |
| 7560 | 7616 |
{
|
| 7617 |
//direct upload |
|
| 7618 |
var target; |
|
| 7619 |
var cancelListener = () => {
|
|
| 7620 |
// console.debug('File selection cancelled by user.');
|
|
| 7621 |
closeAction(); |
|
| 7622 |
if (target) |
|
| 7623 |
{
|
|
| 7624 |
target.removeEventListener('cancel', cancelListener);
|
|
| 7625 |
target = null; |
|
| 7626 |
} |
|
| 7627 |
}; |
|
| 7561 | 7628 |
var children = u.domNode.children; |
| 7562 | 7629 |
for (var i = 0; i < children.length; i++) |
| 7563 | 7630 |
{
|
| 7564 | 7631 |
if (children[i].tagName.toLowerCase() === "input" && children[i].type === "file") |
| 7565 | 7632 |
{
|
| 7566 |
children[i].click(); |
|
| 7633 |
target = children[i]; |
|
| 7634 |
target.addEventListener('cancel', cancelListener);
|
|
| 7635 |
target.click(); |
|
| 7567 | 7636 |
break; |
| 7568 | 7637 |
} |
| 7569 | 7638 |
} |