mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Added "Attachment size limit" setting (Admin panel) (#114)
This commit is contained in:
parent
40a0f8b821
commit
0b5e4f534d
14 changed files with 387 additions and 224 deletions
|
|
@ -722,6 +722,30 @@ ko.extenders.trimmer = function (oTarget)
|
|||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.posInterer = function (oTarget, iDefault)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
var iNew = Utils.pInt(sNewValue.toString(), iDefault);
|
||||
if (0 >= iNew)
|
||||
{
|
||||
iNew = iDefault;
|
||||
}
|
||||
|
||||
if (iNew === oTarget() && '' + iNew !== '' + sNewValue)
|
||||
{
|
||||
oTarget(iNew + 1);
|
||||
}
|
||||
|
||||
oTarget(iNew);
|
||||
}
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.reversible = function (oTarget)
|
||||
{
|
||||
var mValue = oTarget();
|
||||
|
|
|
|||
|
|
@ -46,11 +46,13 @@ Utils.isPosNumeric = function (mValue, bIncludeZero)
|
|||
|
||||
/**
|
||||
* @param {*} iValue
|
||||
* @param {number=} iDefault = 0
|
||||
* @return {number}
|
||||
*/
|
||||
Utils.pInt = function (iValue)
|
||||
Utils.pInt = function (iValue, iDefault)
|
||||
{
|
||||
return Utils.isNormal(iValue) && '' !== iValue ? window.parseInt(iValue, 10) : 0;
|
||||
var iResult = Utils.isNormal(iValue) && '' !== iValue ? window.parseInt(iValue, 10) : (iDefault || 0);
|
||||
return window.isNaN(iResult) ? (iDefault || 0) : iResult;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue