Added "Attachment size limit" setting (Admin panel) (#114)

This commit is contained in:
RainLoop Team 2014-06-24 01:32:09 +04:00
parent 40a0f8b821
commit 0b5e4f534d
14 changed files with 387 additions and 224 deletions

View file

@ -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();

View file

@ -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;
};
/**