Mercurial > hg > LGToc
comparison check_sections_details.php @ 14:6ea0f9030f72
add timer reminder
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 24 Jun 2015 16:50:32 +0200 |
parents | 3d206aa0c77d |
children | 2e6bf16b0be3 |
comparison
equal
deleted
inserted
replaced
13:3d206aa0c77d | 14:6ea0f9030f72 |
---|---|
200 var current_editor = <?php echo json_encode($current_editor) ?>; | 200 var current_editor = <?php echo json_encode($current_editor) ?>; |
201 if (current_editor != "") { | 201 if (current_editor != "") { |
202 $("#saveBook .editor").val(current_editor); | 202 $("#saveBook .editor").val(current_editor); |
203 } else { | 203 } else { |
204 alert("Error!! You have to login from LGService!"); | 204 alert("Error!! You have to login from LGService!"); |
205 $("#loading").show(); | |
205 } | 206 } |
206 } | 207 } |
207 | 208 |
208 document.getElementById("show_all").onclick = function(){showAll()}; | 209 document.getElementById("show_all").onclick = function(){showAll()}; |
209 | 210 |
250 function delayedAlert() { | 251 function delayedAlert() { |
251 timeoutID = window.setTimeout(slowAlert, 3600*1000); // 1 hr | 252 timeoutID = window.setTimeout(slowAlert, 3600*1000); // 1 hr |
252 } | 253 } |
253 function slowAlert() { | 254 function slowAlert() { |
254 if (confirm("Reminder: It's been 1 hour. Remember saving your work to prevent data lost. \n\nKeep working? \n(Press Cancel will turn off this reminder.)")) { | 255 if (confirm("Reminder: It's been 1 hour. Remember saving your work to prevent data lost. \n\nKeep working? \n(Press Cancel will turn off this reminder.)")) { |
255 timeoutID = window.setTimeout(slowAlert, 60*60*1000); | |
256 // renew session? | |
257 | 256 |
258 var lg_url = "<?php echo $lgserver_url?>" + "rest/utils/getUser?sessionId=" + session_id; | 257 var lg_url = "<?php echo $lgserver_url?>" + "rest/utils/getUser?sessionId=" + session_id; |
259 console.log(lg_url); | |
260 | 258 |
261 $.post(lg_url, function(data) { | 259 $.post(lg_url, function(data) { |
262 console.log("renew session."); | 260 console.log("renew session."); |
261 | |
262 }).done(function(data){ | |
263 console.log(data); | |
264 console.log("login as: " + data['userName']); | |
265 | |
266 if (data['userName'] == "") { | |
267 alert("Error!! You have to login from LGService!"); | |
268 $("#loading").show(); | |
269 } else { | |
270 timeoutID = window.setTimeout(slowAlert, 3600*1000); | |
271 } | |
272 | |
273 }).fail(function(){ | |
274 console.log("fail to renew session."); | |
263 }); | 275 }); |
264 } | 276 } |
265 } | 277 } |
266 | 278 |
267 | 279 |