forked from 0x2620/pandora
add license infrastructure
This commit is contained in:
parent
2dc081b8aa
commit
baaae8ac5c
3 changed files with 49 additions and 1 deletions
27
static/js/licenseDialog.js
Normal file
27
static/js/licenseDialog.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
pandora.ui.licenseDialog = function() {
|
||||||
|
|
||||||
|
var that = pandora.ui.iconDialog({
|
||||||
|
buttons: [
|
||||||
|
Ox.Button({
|
||||||
|
id: 'close',
|
||||||
|
title: Ox._('Close')
|
||||||
|
})
|
||||||
|
.bindEvent({
|
||||||
|
click: function() {
|
||||||
|
that.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
],
|
||||||
|
content: Ox._(
|
||||||
|
'This installation of <b>pan.do/ra</b> is unlicensed. '
|
||||||
|
+ 'Please contact your vendor for more information on '
|
||||||
|
+ 'how to acquire a license, or renew an expired one.'
|
||||||
|
),
|
||||||
|
keys: {enter: 'close', escape: 'close'},
|
||||||
|
title: Ox._('License')
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
|
@ -433,7 +433,8 @@ appPanel
|
||||||
Ox.Fullscreen.bind('exit', pandora.UI.set);
|
Ox.Fullscreen.bind('exit', pandora.UI.set);
|
||||||
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
|
pandora.site.sectionButtonsWidth = pandora.$ui.sectionButtons.width() + 8;
|
||||||
// allow site scripts to run after pandora is loaded
|
// allow site scripts to run after pandora is loaded
|
||||||
pandora.triggerEvent('loaded')
|
pandora.triggerEvent('loaded');
|
||||||
|
!pandora.isLicensed() && pandora.openLicenseDialog();
|
||||||
loadUserScript && pandora.loadUserScript();
|
loadUserScript && pandora.loadUserScript();
|
||||||
document.removeEventListener && document.removeEventListener('keydown', onKeydown);
|
document.removeEventListener && document.removeEventListener('keydown', onKeydown);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1954,6 +1954,10 @@ pandora.isEmbedURL = function(url) {
|
||||||
return /^#embed(\?.*?)?$/.test(hash);
|
return /^#embed(\?.*?)?$/.test(hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.isLicensed = function() {
|
||||||
|
return pandora.site.license && pandora.site.license < +new Date();
|
||||||
|
};
|
||||||
|
|
||||||
pandora.isPrintURL = function(url) {
|
pandora.isPrintURL = function(url) {
|
||||||
url = url || document.location.href;
|
url = url || document.location.href;
|
||||||
var hash = Ox.parseURL(url).hash;
|
var hash = Ox.parseURL(url).hash;
|
||||||
|
@ -2015,6 +2019,22 @@ pandora.logEvent = function(data, event, element) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.openLicenseDialog = function() {
|
||||||
|
if (!pandora.hasDialogOrScreen()) {
|
||||||
|
pandora.ui.licenseDialog().open().bindEvent({
|
||||||
|
close: function() {
|
||||||
|
setTimeout(function() {
|
||||||
|
!pandora.isLicensed() && pandora.openLicenseDialog();
|
||||||
|
}, 900000); // 15 minutes
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setTimeout(function() {
|
||||||
|
!pandora.isLicensed() && pandora.openLicenseDialog();
|
||||||
|
}, 60000); // 1 minute
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pandora.openLink = function(url) {
|
pandora.openLink = function(url) {
|
||||||
if (Ox.startsWith(url, 'mailto:')) {
|
if (Ox.startsWith(url, 'mailto:')) {
|
||||||
window.open(url);
|
window.open(url);
|
||||||
|
|
Loading…
Reference in a new issue