Merge branch 'q' into staging

This commit is contained in:
yflory
2020-04-15 17:03:02 +02:00
21 changed files with 318 additions and 507 deletions

View File

@@ -1606,11 +1606,7 @@ define([
.text(Messages.accessButton))
.click(common.prepareFeedback(type))
.click(function () {
require(['/common/inner/access.js'], function (Access) {
Access.getAccessModal(common, {}, function (e) {
if (e) { console.error(e); }
});
});
sframeChan.event('EV_ACCESS_OPEN');
});
break;
case 'properties':
@@ -1625,11 +1621,7 @@ define([
if (!data) {
return void UI.alert(Messages.autostore_notAvailable);
}
require(['/common/inner/properties.js'], function (Properties) {
Properties.getPropertiesModal(common, {}, function (e) {
if (e) { console.error(e); }
});
});
sframeChan.event('EV_PROPERTIES_OPEN');
});
});
break;
@@ -2642,17 +2634,13 @@ define([
});
};
UIElements.initFilePicker = function (common, cfg) {
var onSelect = cfg.onSelect || $.noop;
UIElements.openFilePicker = function (common, types, cb) {
var sframeChan = common.getSframeChannel();
sframeChan.on("EV_FILE_PICKED", function (data) {
onSelect(data);
sframeChan.query("Q_FILE_PICKER_OPEN", types, function (err, data) {
if (err) { return; }
cb(data);
});
};
UIElements.openFilePicker = function (common, types) {
var sframeChan = common.getSframeChannel();
sframeChan.event("EV_FILE_PICKER_OPEN", types);
};
UIElements.openTemplatePicker = function (common, force) {
var metadataMgr = common.getMetadataMgr();
@@ -2675,29 +2663,25 @@ define([
return;
}
delete pickerCfg.hidden;
common.openFilePicker(pickerCfg);
var first = true; // We can only pick a template once (for a new document)
var fileDialogCfg = {
onSelect: function (data) {
if (data.type === type && first) {
UI.addLoadingScreen({hideTips: true});
var chatChan = common.getPadChat();
var cursorChan = common.getCursorChannel();
sframeChan.query('Q_TEMPLATE_USE', {
href: data.href,
chat: chatChan,
cursor: cursorChan
}, function () {
first = false;
UI.removeLoadingScreen();
Feedback.send('TEMPLATE_USED');
});
if (focus) { focus.focus(); }
return;
}
common.openFilePicker(pickerCfg, function (data) {
if (data.type === type && first) {
UI.addLoadingScreen({hideTips: true});
var chatChan = common.getPadChat();
var cursorChan = common.getCursorChannel();
sframeChan.query('Q_TEMPLATE_USE', {
href: data.href,
chat: chatChan,
cursor: cursorChan
}, function () {
first = false;
UI.removeLoadingScreen();
Feedback.send('TEMPLATE_USED');
});
if (focus) { focus.focus(); }
return;
}
};
common.initFilePicker(fileDialogCfg);
});
};
sframeChan.query("Q_TEMPLATE_EXIST", type, function (err, data) {