diff --git a/API/Backend/Draw/models/userfiles.js b/API/Backend/Draw/models/userfiles.js index 8740224c..e6dc8c8d 100644 --- a/API/Backend/Draw/models/userfiles.js +++ b/API/Backend/Draw/models/userfiles.js @@ -141,12 +141,16 @@ const up = async () => { `ALTER TABLE user_files ADD COLUMN IF NOT EXISTS template json NULL;` ) .then(() => { - logger("info", `Added template col`, "user_files"); return null; }) .catch((err) => { - logger("info", `template. Nothing to do...`, "user_files"); - + logger( + "error", + `Failed to adding user_files.template column. DB tables may be out of sync!`, + "user_files", + null, + err + ); return null; }); }; diff --git a/config/js/config.js b/config/js/config.js index 451995f4..7ddb5e87 100644 --- a/config/js/config.js +++ b/config/js/config.js @@ -672,6 +672,10 @@ function initialize() { "checked", cData.time.visible ? true : false ); + $("#tab_time #time_initiallyOpen").prop( + "checked", + cData.time.initiallyOpen ? true : false + ); } $("#tab_time #time_format").val( cData.time ? cData.time.format : "%Y-%m-%dT%H:%M:%SZ" @@ -2178,6 +2182,11 @@ function save(returnJSON) { } else { json.time.visible = false; } + if ($("#tab_time #time_initiallyOpen").prop("checked")) { + json.time.initiallyOpen = true; + } else { + json.time.initiallyOpen = false; + } json.time.format = $("#tab_time #time_format").val(); json.time.initialstart = $("#tab_time #time_initialstart").val(); json.time.initialend = $("#tab_time #time_initialend").val(); diff --git a/docs/pages/Configure/Tabs/Time/Time_Tab.md b/docs/pages/Configure/Tabs/Time/Time_Tab.md index 86619160..3c85871b 100644 --- a/docs/pages/Configure/Tabs/Time/Time_Tab.md +++ b/docs/pages/Configure/Tabs/Time/Time_Tab.md @@ -16,7 +16,11 @@ This enables the user interface for Time. If disabled, global time will not be u ### Visible -Whether or not the Time user interface should be visible. +Whether or not the Time user interface should be visible. This allows time to be enabled while restricting users from using its UI. + +### Initially Open + +If enabled and visible, the Time UI will be initially open on the bottom of the screen. ## Time Format diff --git a/docs/pages/Tools/Draw/Draw.md b/docs/pages/Tools/Draw/Draw.md index fcc30334..a4c8e238 100644 --- a/docs/pages/Tools/Draw/Draw.md +++ b/docs/pages/Tools/Draw/Draw.md @@ -88,8 +88,8 @@ There are five files that are group editable with the correct permission. The gr { "type": "date", "field": "g", - "format": "HH:mm:ss", - "default": "now" + "format": "YYYY-MM-DDTHH:mm:ss", + "default": "2000-01-01T00:00:00" // Can be "NOW", "STARTTIME" or "ENDTIME" too for dynamic defaults } ], "example_2": [ diff --git a/src/essence/Ancillary/Coordinates.js b/src/essence/Ancillary/Coordinates.js index a1df95ef..e6b3d586 100644 --- a/src/essence/Ancillary/Coordinates.js +++ b/src/essence/Ancillary/Coordinates.js @@ -120,11 +120,16 @@ const Coordinates = { offset: [0, 20], }) - if (!(L_.configData.time && L_.configData.time.enabled === true)) { + if ( + !( + L_.configData.time && + L_.configData.time.enabled === true && + L_.configData.time.visible === true + ) + ) { $('#toggleTimeUI').css({ display: 'none' }) $('#CoordinatesDiv').css({ marginRight: '0px' }) } - if (L_.configData.coordinates) { // ll if (L_.configData.coordinates.coordll == false) @@ -266,6 +271,15 @@ const Coordinates = { $('#toggleTimeUI').on('click', toggleTimeUI) Map_.map.on('mousemove', mouseLngLatMove) Map_.map.on('click', urlClick) + + if ( + L_.configData.time && + L_.configData.time.enabled === true && + L_.configData.time.visible === true && + L_.configData.time.initiallyOpen === true + ) { + toggleTimeUI() + } }, refreshDropdown: function () { const names = [] diff --git a/src/essence/Tools/Draw/DrawTool.css b/src/essence/Tools/Draw/DrawTool.css index 213f890a..b358e4e5 100644 --- a/src/essence/Tools/Draw/DrawTool.css +++ b/src/essence/Tools/Draw/DrawTool.css @@ -2577,10 +2577,20 @@ background: var(--color-c); } +#cmExportGeoJSON, +#cmExportSourceGeoJSON { + display: block; +} +#cmExportGeoJSON > div:last-child, +#cmExportSourceGeoJSON > div:last-child { + font-size: 12px; + text-align: right; +} + /*FILE INFO TEMPLATE MODAL*/ #drawToolFileTemplateEditModal { background: var(--color-a-5); - min-width: 600px; + min-width: 624px; } #drawToolFileTemplateEditModalTitle { padding: 0px 0px 0px 10px; diff --git a/src/essence/Tools/Draw/DrawTool.js b/src/essence/Tools/Draw/DrawTool.js index def4cbda..e27f3c73 100644 --- a/src/essence/Tools/Draw/DrawTool.js +++ b/src/essence/Tools/Draw/DrawTool.js @@ -1187,16 +1187,29 @@ var DrawTool = { } } }, - enforceTemplate(geojson, templateObj) { + enforceTemplate(geojson, templateObj, force) { if (templateObj == null || templateObj.template == null) return geojson const templateEnforcedFeatures = [] geojson.features.forEach((f) => { const newF = JSON.parse(JSON.stringify(f)) - newF.properties = newF.properties || {} - templateObj.template.forEach((t) => { - if (!newF.properties.hasOwnProperty([t.field])) - newF.properties[t.field] = t.default - }) + if (force) { + newF.properties = newF.properties || {} + const forcedTemplateProperties = {} + templateObj.template.forEach((t) => { + if (!newF.properties.hasOwnProperty([t.field])) + forcedTemplateProperties[t.field] = t.default + else + forcedTemplateProperties[t.field] = + newF.properties[t.field] + }) + newF.properties = forcedTemplateProperties + } else { + newF.properties = newF.properties || {} + templateObj.template.forEach((t) => { + if (!newF.properties.hasOwnProperty([t.field])) + newF.properties[t.field] = t.default + }) + } templateEnforcedFeatures.push(newF) }) geojson.features = templateEnforcedFeatures diff --git a/src/essence/Tools/Draw/DrawTool_FileModal.js b/src/essence/Tools/Draw/DrawTool_FileModal.js index 29adae6a..8f579164 100644 --- a/src/essence/Tools/Draw/DrawTool_FileModal.js +++ b/src/essence/Tools/Draw/DrawTool_FileModal.js @@ -74,12 +74,12 @@ const DrawTool_FileModal = { } const templateItems = ['NONE'] - .concat(Object.keys(DrawTool.vars.templates)) + .concat(Object.keys(templates)) .concat(Object.keys(allTemplates).sort()) allTemplates = { ...allTemplates, - ...JSON.parse(JSON.stringify(DrawTool.vars.templates || {})), + ...JSON.parse(JSON.stringify(templates || {})), } let body = false diff --git a/src/essence/Tools/Draw/DrawTool_Files.js b/src/essence/Tools/Draw/DrawTool_Files.js index 377800e8..93cb3757 100644 --- a/src/essence/Tools/Draw/DrawTool_Files.js +++ b/src/essence/Tools/Draw/DrawTool_Files.js @@ -531,8 +531,15 @@ var Files = { hideContextMenu(true) + const fileId = elm.attr('file_id') + const file = DrawTool.getFileObjectWithId(fileId) + + const hasTemplate = file?.template?.template != null + let rect = $(this).get(0).getBoundingClientRect() + // Export GeoJSON + // Export GeoJSON [Forced Template] // prettier-ignore let markup = [ "