Mercurial > hg > LGToc
diff check_sections_details.php @ 5:26ed9d1d6957
New: get user name from LGService by sessionId
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 21 Apr 2015 14:53:09 +0200 |
parents | 373c8ecad8b4 |
children | 4d59439c8b46 |
line wrap: on
line diff
--- a/check_sections_details.php Tue Mar 24 11:32:31 2015 +0100 +++ b/check_sections_details.php Tue Apr 21 14:53:09 2015 +0200 @@ -94,27 +94,39 @@ echo $str; } +if (isset($_GET['sessionId'])) { + // check if get session info from LGService, to get username as editor + $session_id = $_GET['sessionId']; + $lg_url = "http://localgazetteers-dev/LGServices/rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService + $output = file_get_contents($lg_url); + $user_info = json_decode($output, true); + $current_editor = $user_info['userName']; + +} else { + // test locally +} + ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - <link href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet"/> - <link href="css/check_sections.css" type="text/css" rel="stylesheet"/> - <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> - <script src="js/check_sections_details.js" type="text/javascript"></script> - <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js" type="text/javascript"></script> - <!--<script src="js/check_sections.js" charset="utf-8"></script>!--> - </head> - <body> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <link href="https://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" type="text/css" rel="stylesheet"/> + <link href="css/check_sections.css" type="text/css" rel="stylesheet"/> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script> + <script src="js/check_sections_details.js" type="text/javascript"></script> + <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js" type="text/javascript"></script> + <!--<script src="js/check_sections.js" charset="utf-8"></script>!--> + </head> + <body> <div id="loading">...</div> <div id="container"> - <?php + <?php $version=0; $editor=""; $date=""; - if(isset($_GET['book_id']) && isset($_GET['count']) && is_numeric($_GET['count'])){ + if(isset($_GET['book_id']) && isset($_GET['count']) && is_numeric($_GET['count'])){ $bookId=$_GET['book_id']; $count=$_GET['count']; $bookInfo=getBookInfo($bookId); @@ -126,41 +138,46 @@ printBookInfo($bookInfo); //echo "version: ".$version."<br>last editor: ".$editor; $missingPageArray=checkMissingPage($bookInfo,$info); - ?> + ?> - <table> - <thead>Show editing records: - <button id="show_all">Show all</button> - <button id="close">Close</button> - </thead> - <tbody> - <tr> - <td id="editor_th"></td> - <td id="date_th"></td> - </tr> - <tr> - <td><div id="editor"></div></td> - <td><div id="date"></div></td> - </tr> - </tbody> - </table> + <table> + <thead>Show editing records: + <button id="show_all">Show all</button> + <button id="close">Close</button> + </thead> + <tbody> + <tr> + <td id="editor_th"></td> + <td id="date_th"></td> + </tr> + <tr> + <td><div id="editor"></div></td> + <td><div id="date"></div></td> + </tr> + </tbody> + </table> - - - <div id="searchResults"> - <?php + <div id="searchResults"> + <?php $sectionArray=getSectionArray($bookId,$count,$info); printSectionArray($sectionArray,$missingPageArray); - }else{ + }else{ echo "Cannot process the data due to incomplete input."; } - ?> - </div> + ?> + </div> </div> <div id="panel"></div> <script>var version=<?php echo $version;?>;</script> <script type="text/javascript"> + function setCurrentEditor() { + // current_editor is gotten from LGService + var current_editor = JSON.parse('<?php echo json_encode($current_editor) ?>'); + if (current_editor != "") { + $("#saveBook .editor").val(current_editor); + } + } document.getElementById("show_all").onclick = function(){showAll()}; @@ -197,10 +214,13 @@ document.getElementById("editor").innerHTML = ""; document.getElementById("date").innerHTML = ""; } - </script> + + + + </script> - </body> + </body> </html>