|
|
@ -5,15 +5,18 @@ define([
|
|
|
|
'/common/sframe-channel.js',
|
|
|
|
'/common/sframe-channel.js',
|
|
|
|
'/common/sframe-common-title.js',
|
|
|
|
'/common/sframe-common-title.js',
|
|
|
|
'/common/sframe-common-interface.js',
|
|
|
|
'/common/sframe-common-interface.js',
|
|
|
|
|
|
|
|
'/common/sframe-common-history.js',
|
|
|
|
'/common/metadata-manager.js',
|
|
|
|
'/common/metadata-manager.js',
|
|
|
|
|
|
|
|
|
|
|
|
'/common/cryptpad-common.js'
|
|
|
|
'/common/cryptpad-common.js'
|
|
|
|
], function (nThen, Messages, CpNfInner, SFrameChannel, Title, UI, MetadataMgr, Cryptpad) {
|
|
|
|
], function (nThen, Messages, CpNfInner, SFrameChannel, Title, UI, History, MetadataMgr, Cryptpad) {
|
|
|
|
|
|
|
|
|
|
|
|
// Chainpad Netflux Inner
|
|
|
|
// Chainpad Netflux Inner
|
|
|
|
var funcs = {};
|
|
|
|
var funcs = {};
|
|
|
|
var ctx = {};
|
|
|
|
var ctx = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
funcs.Messages = Messages;
|
|
|
|
|
|
|
|
|
|
|
|
funcs.startRealtime = function (options) {
|
|
|
|
funcs.startRealtime = function (options) {
|
|
|
|
if (ctx.cpNfInner) { return ctx.cpNfInner; }
|
|
|
|
if (ctx.cpNfInner) { return ctx.cpNfInner; }
|
|
|
|
options.sframeChan = ctx.sframeChan;
|
|
|
|
options.sframeChan = ctx.sframeChan;
|
|
|
@ -23,6 +26,13 @@ define([
|
|
|
|
return ctx.cpNfInner;
|
|
|
|
return ctx.cpNfInner;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
funcs.getMetadataMgr = function () {
|
|
|
|
|
|
|
|
return ctx.metadataMgr;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
funcs.getCryptpadCommon = function () {
|
|
|
|
|
|
|
|
return Cryptpad;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var isLoggedIn = funcs.isLoggedIn = function () {
|
|
|
|
var isLoggedIn = funcs.isLoggedIn = function () {
|
|
|
|
if (!ctx.cpNfInner) { throw new Error("cpNfInner is not ready!"); }
|
|
|
|
if (!ctx.cpNfInner) { throw new Error("cpNfInner is not ready!"); }
|
|
|
|
return ctx.cpNfInner.metadataMgr.getPrivateData().accountName;
|
|
|
|
return ctx.cpNfInner.metadataMgr.getPrivateData().accountName;
|
|
|
@ -38,6 +48,9 @@ define([
|
|
|
|
funcs.createUserAdminMenu = UI.createUserAdminMenu;
|
|
|
|
funcs.createUserAdminMenu = UI.createUserAdminMenu;
|
|
|
|
funcs.displayAvatar = UI.displayAvatar;
|
|
|
|
funcs.displayAvatar = UI.displayAvatar;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// History
|
|
|
|
|
|
|
|
funcs.getHistory = function (config) { return History.create(funcs, config); };
|
|
|
|
|
|
|
|
|
|
|
|
// Title module
|
|
|
|
// Title module
|
|
|
|
funcs.createTitle = Title.create;
|
|
|
|
funcs.createTitle = Title.create;
|
|
|
|
|
|
|
|
|
|
|
@ -79,6 +92,13 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
funcs.getFullHistory = function (realtime, cb) {
|
|
|
|
|
|
|
|
ctx.sframeChan.on('EV_RT_HIST_MESSAGE', function (content) {
|
|
|
|
|
|
|
|
realtime.message(content);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
ctx.sframeChan.query('Q_GET_FULL_HISTORY', null, cb);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
|
|
|
|
funcs.feedback = function () {};
|
|
|
|
funcs.feedback = function () {};
|
|
|
@ -199,10 +219,10 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'history':
|
|
|
|
case 'history':
|
|
|
|
if (!AppConfig.enableHistory) {
|
|
|
|
/*if (!AppConfig.enableHistory) {
|
|
|
|
button = $('<span>');
|
|
|
|
button = $('<span>');
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
button = $('<button>', {
|
|
|
|
button = $('<button>', {
|
|
|
|
title: Messages.historyButton,
|
|
|
|
title: Messages.historyButton,
|
|
|
|
'class': "fa fa-history history",
|
|
|
|
'class': "fa fa-history history",
|
|
|
@ -211,7 +231,7 @@ define([
|
|
|
|
button
|
|
|
|
button
|
|
|
|
.click(prepareFeedback(type))
|
|
|
|
.click(prepareFeedback(type))
|
|
|
|
.on('click', function () {
|
|
|
|
.on('click', function () {
|
|
|
|
common.getHistory(data.histConfig);
|
|
|
|
funcs.getHistory(data.histConfig);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|