2013-11-16 06:21:12 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string=} sPosition = ''
|
|
|
|
* @param {string=} sTemplate = ''
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
function KnoinAbstractViewModel(sPosition, sTemplate)
|
|
|
|
{
|
2014-03-13 06:29:33 +08:00
|
|
|
this.bDisabeCloseOnEsc = false;
|
2013-11-16 06:21:12 +08:00
|
|
|
this.sPosition = Utils.pString(sPosition);
|
|
|
|
this.sTemplate = Utils.pString(sTemplate);
|
|
|
|
|
|
|
|
this.viewModelName = '';
|
|
|
|
this.viewModelVisibility = ko.observable(false);
|
|
|
|
if ('Popups' === this.sPosition)
|
|
|
|
{
|
|
|
|
this.modalVisibility = ko.observable(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.viewModelDom = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
KnoinAbstractViewModel.prototype.sPosition = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
KnoinAbstractViewModel.prototype.sTemplate = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
KnoinAbstractViewModel.prototype.viewModelName = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {?}
|
|
|
|
*/
|
|
|
|
KnoinAbstractViewModel.prototype.viewModelDom = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
KnoinAbstractViewModel.prototype.viewModelTemplate = function ()
|
|
|
|
{
|
|
|
|
return this.sTemplate;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
KnoinAbstractViewModel.prototype.viewModelPosition = function ()
|
|
|
|
{
|
|
|
|
return this.sPosition;
|
|
|
|
};
|
|
|
|
|
|
|
|
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
|
|
|
|
{
|
|
|
|
};
|
2014-03-13 06:29:33 +08:00
|
|
|
|
|
|
|
KnoinAbstractViewModel.prototype.registerPopupEscapeKey = function ()
|
|
|
|
{
|
2014-04-08 05:03:58 +08:00
|
|
|
key('esc', _.bind(function () {
|
|
|
|
if (this.modalVisibility && this.modalVisibility())
|
2014-03-13 06:29:33 +08:00
|
|
|
{
|
2014-04-08 05:03:58 +08:00
|
|
|
Utils.delegateRun(this, 'cancelCommand');
|
2014-03-13 06:29:33 +08:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-08 05:03:58 +08:00
|
|
|
}, this));
|
2014-03-13 06:29:33 +08:00
|
|
|
};
|