changeset 13:3d206aa0c77d

add timer reminder
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 24 Jun 2015 16:20:03 +0200
parents 7e04cbe8b2a0
children 6ea0f9030f72
files check_sections_details.php config/config.php index.php
diffstat 3 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/check_sections_details.php	Wed Jun 24 11:11:31 2015 +0200
+++ b/check_sections_details.php	Wed Jun 24 16:20:03 2015 +0200
@@ -104,18 +104,17 @@
     $output = file_get_contents($lg_url);
     $user_info = json_decode($output, true);
 	$current_editor = (string)$user_info['userName'];
-	
-	if ($current_editor == null || strcmp($user_info['status'], "error") == 0) {
+
+	if ($current_editor == null || $current_editor == "" || strcmp($current_editor, "") === 0 || strcmp($user_info['status'], "ok") !== 0) {
 		// redirect to LGServices homepage
+		//header("Location: http://localgazetteers.mpiwg-berlin.mpg.de/LGServices");
 		header("Location: "+$lgserver_url+"LGServices");
-		//header('Location: http://localgazetteers/LGServices');
 	}
 
 } else {
 	// test locally
 	// redirect to LGServices homepage
 	header("Location: "+$lgserver_url+"LGServices");
-	//header('Location: http://localgazetteers/LGServices');
 }
 
 
@@ -190,8 +189,9 @@
         	</div>
 		</div>
 		<div id="panel"></div>
-		<script>var version = <?php echo $version;?>;
-				var session_id = "<?php echo $_GET['sessionId']; ?>";
+		<script>
+			var version = <?php echo $version;?>;
+			var session_id = "<?php echo $_GET['sessionId']; ?>";
 		</script>
 
 		<script type="text/javascript">
@@ -201,7 +201,7 @@
 		    if (current_editor != "") {
 				$("#saveBook .editor").val(current_editor);
 		    } else {
-		    	console.log("You have to login from LGService!");
+		    	alert("Error!! You have to login from LGService!");
 		    }
 		}
 
@@ -243,29 +243,27 @@
 		}
 	
 
-		/*
+		
 		// --- timeout reminder ---
 		var timeoutID;
 		delayedAlert();
 		function delayedAlert() {
-		 	timeoutID = window.setTimeout(slowAlert, 4000);
+		 	timeoutID = window.setTimeout(slowAlert, 3600*1000);	// 1 hr
 		}
 		function slowAlert() {
-		 	if (confirm("Reminder: It's been 30 mins. Don't forget to save your work. \n\nKeep working? \n(Press Cancel will turn off this reminder.)")) {
-		 		timeoutID = window.setTimeout(slowAlert, 4000);
+		 	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.)")) {
+		 		timeoutID = window.setTimeout(slowAlert, 60*60*1000);
 		 		// renew session?
 		 		
 				var lg_url = "<?php echo $lgserver_url?>" + "rest/utils/getUser?sessionId=" + session_id;
 				console.log(lg_url);
 
 		 		$.post(lg_url, function(data) {
-
-					///console.log(data);
-
+		 			console.log("renew session.");
 		 		});
 		 	}
 		}
-		*/
+		
 
 
 
--- a/config/config.php	Wed Jun 24 11:11:31 2015 +0200
+++ b/config/config.php	Wed Jun 24 16:20:03 2015 +0200
@@ -18,7 +18,6 @@
 	$mysql_user = "root";
 	$mysql_password = "root";
 	$server_host = "http://localhost:1080/localgazetteers-dev/";
-	//$lgserver_url = "http://localgazetteers-dev/LGServer/";
 	$lgserver_url = "http://localhost:8080/LGServices/";
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.php	Wed Jun 24 16:20:03 2015 +0200
@@ -0,0 +1,3 @@
+<?php
+	header("Location: http://localgazetteers.mpiwg-berlin.mpg.de");
+?>
\ No newline at end of file