diff --git a/~dev_rating/media/js/rating.js b/~dev_rating/media/js/rating.js index 9bf8372df2d11979fb10baa6d1405a4ef19dba3b..baa89799bae22b98a6d4cca92e07781a16ebd549 100644 --- a/~dev_rating/media/js/rating.js +++ b/~dev_rating/media/js/rating.js @@ -115,34 +115,40 @@ $(function() { if (rateResult > 100) { jThis.children("input").val(oldRate); EventInspector_ShowMsg("Сумма баллов не может привышать 100", "error"); + jThis.children("input").removeAttr("disabled"); } else { if (newRate <= g_submoduleMaxRate) { - $.post( - URLdir + "handler/rating/setRate", - { - "student": g_studentID, - "submodule": g_submoduleID, - "rate": newRate - }, - function(data){ - data = $.parseJSON(data); - if(data.success === true) { - jThis.siblings(".RateResult").text(rateResult); - EventInspector_ShowMsg("Балл добавлен/изменен", "success"); - } - else EventInspector_ShowMsg("Не удалось добавить/изменить балл", "error"); - jThis.children("input").removeAttr("disabled"); + $.ajax({ + type: "POST", + url: URLdir + "handler/rating/setRate", + data: "student="+g_studentID+"&submodule="+g_submoduleID+"&rate="+newRate, + statusCode: { + 403: function() { + EventInspector_ShowMsg("Сессия истекла", "error"); + jThis.children("input").val(oldRate); + jThis.children("input").removeAttr("disabled"); + }, + 200: function(data) { + data = $.parseJSON(data); + if(data.success === true) { + jThis.siblings(".RateResult").text(rateResult); + EventInspector_ShowMsg("Балл добавлен/изменен", "success"); + } + else EventInspector_ShowMsg("Не удалось добавить/изменить балл", "error"); + jThis.children("input").removeAttr("disabled"); + } } - ); + }); } else { if (oldRate <= g_submoduleMaxRate) jThis.children("input").val(oldRate); else jThis.children("input").val("0"); + EventInspector_ShowMsg("Текущий балл превышает максимальный для данного модуля", "error"); jThis.children("input").removeAttr("disabled"); } diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/modules/account/classes/Kohana/User.php index d3ffb106315483fcf8cec7155a9a75b3ce89dc8f..33e327aa6dbed9301980072ba54885aa66e4344c 100644 --- a/~dev_rating/modules/account/classes/Kohana/User.php +++ b/~dev_rating/modules/account/classes/Kohana/User.php @@ -8,7 +8,7 @@ class Kohana_User implements ArrayAccess { protected $_model; protected $_userInfo; - const SESSION_LIFETIME = 900; //seconds + const SESSION_LIFETIME = 60; //seconds /** * Вовзращает экземпляр класса (singleton-паттерн)