public void UpdateTestTime(int timeLeft)
{
CLBWTTestContainer wtc = Session[CLBWTConstants.SESSION_VAR_TESTCONTAINER] as CLBWTTestContainer;
if (wtc != null)
{
wtc.TimeLeft = timeLeft;
log.Debug("timeleft=" + wtc.TimeLeft);
}
}
asp:ScriptManager ID="siteScriptManager" runat="server" EnablePartialRendering="true">
/asp:ScriptManager>
span id="timerLabel" class="timer_label">/span>
div id="expiredDialog" title="<%= GetGlobalResourceObject("CommonTerms", "Message")%>">
div class="buttons_cntr_right">
/div>
/div>
script type="text/javascript">
$(document).ready(function() {
$("#").countdown({ until: +<%=timeLeft%>, compact: true, format: 'MS', onTick: updateTestTime, onExpiry: expiredHandler,
layout: '{mnn}{sep}{snn}'});
// Dialog
$('#expiredDialog').dialog({
autoOpen: false,
modal: true,
close: function(event, ui) {
location.href = "/Secure/Testing.aspx";
}
});
});
function updateTestTime(periods) {
//last 60 seconds
if (periods[4] == 0 && periods[5] == 0 && periods[6] <= 59 )
{
$('#timerLabel').addClass("timer_label_last60");
}
//every 5 seconds call to server to update server time
if (periods[6] % 5 == 0) {
var timeLeftInSeconds = (periods[5] * 60) + periods[6];
CLBOA.Web.TestEngine.Services.WSTestEngine.UpdateTestTime(timeLeftInSeconds);
}
}
function expiredHandler() {
$('#expiredDialog').dialog('open');
}
/script>
没有评论:
发表评论