diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index a5c1396c2..82e1f113d 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1621,7 +1621,17 @@ define([ if (!data) { return void UI.alert(Messages.autostore_notAvailable); } - sframeChan.event('EV_PROPERTIES_OPEN'); + sframeChan.query('Q_PROPERTIES_OPEN', null, function (err, data) { + if (!data || !data.cmd) { return; } + if (data.cmd === "UPDATE_METADATA") { + if (!data.key) { return; } + var metadataMgr = common.getMetadataMgr(); + var md = Util.clone(metadataMgr.getMetadata()); + md[data.key] = data.value; + if (!data.value) { delete md[data.key]; } + metadataMgr.updateMetadata(md); + } + }); }); }); break; diff --git a/www/common/inner/properties.js b/www/common/inner/properties.js index 5a17a2c76..3dd3d972a 100644 --- a/www/common/inner/properties.js +++ b/www/common/inner/properties.js @@ -58,6 +58,7 @@ define([ Messages.cba_disable = "Clear all colors and disable"; // XXX if (owned && priv.app === 'code') { (function () { + var sframeChan = common.getSframeChannel(); var md = metadataMgr.getMetadata(); var div = h('div'); var hint = h('div.cp-app-prop-hint', Messages.cba_hint); @@ -73,10 +74,12 @@ define([ classes: 'btn-primary' }, function () { $button.remove(); - var md = Util.clone(metadataMgr.getMetadata()); - md.enableColors = true; + sframeChan.event("EV_SECURE_ACTION", { + cmd: 'UPDATE_METADATA', + key: 'enableColors', + value: true + }); common.setAttribute(['code', 'enableColors'], true); - metadataMgr.updateMetadata(md); setButton(false); }); return; @@ -87,10 +90,12 @@ define([ classes: 'btn-danger' }, function () { $button.remove(); - var md = Util.clone(metadataMgr.getMetadata()); - md.enableColors = false; + sframeChan.event("EV_SECURE_ACTION", { + cmd: 'UPDATE_METADATA', + key: 'enableColors', + value: false + }); common.setAttribute(['code', 'enableColors'], false); - metadataMgr.updateMetadata(md); setButton(true); }); }; diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 0e87439b5..4fa73e109 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -1036,8 +1036,8 @@ define([ initSecureModal('filepicker', data || {}, cb); }); - sframeChan.on('EV_PROPERTIES_OPEN', function (data) { - initSecureModal('properties', data || {}, null); + sframeChan.on('Q_PROPERTIES_OPEN', function (data, cb) { + initSecureModal('properties', data || {}, cb); }); sframeChan.on('EV_ACCESS_OPEN', function (data) {