From 13be0757957ea81c911d90139c6abed7fbafabfb Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Thu, 29 Apr 2021 10:12:58 +0200 Subject: [PATCH] js-options: storing namespaces info --- oxygen/js-options/options.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/oxygen/js-options/options.js b/oxygen/js-options/options.js index 8da158f..59e276f 100644 --- a/oxygen/js-options/options.js +++ b/oxygen/js-options/options.js @@ -1,10 +1,21 @@ +/* + * Main features + */ + Options = function (authorAccess, namespace) { this.namespace = namespace; this.authorAccess = authorAccess; this.optionsStorage = this.authorAccess.getOptionsStorage(); + if (namespace != Options.SYSTEM) { + var systemOptions = new Options(authorAccess, Options.SYSTEM); + var namespaces = JSON.parse(systemOptions.getOption(Options.NAMESPACES, '{}')); + namespaces[this.namespace] = (new Date()).toISOString(); + systemOptions.setOption(Options.NAMESPACES, JSON.stringify(namespaces)) + } } Options.SYSTEM = '__system__'; +Options.NAMESPACES = '__namespaces__'; Options.prototype.getOption = function (key, defaultValue) { this.optionsStorage.setOptionsDoctypePrefix(this.namespace); @@ -20,7 +31,7 @@ Options.prototype.setOption = function (key, value) { this.optionsStorage.setOption(key, value); } -Options.prototype.getOptions = function (key) { +Options.prototype.getOptions = function () { var results = { }; this.optionsStorage.setOptionsDoctypePrefix(Options.SYSTEM); @@ -30,3 +41,17 @@ Options.prototype.getOptions = function (key) { } return results; } + +/* + * Per file extensions + * + */ + +Options.prototype.setSystemId = function(systemID) { + if (systemID === undefined) { + this.systemID = this.authorAccess.getDocumentController().getAuthorDocumentNode().getSystemID(); + } else { + this.systemID = systemID; + } +} +