comparison check_sections_details.php @ 6:4d59439c8b46

New: get user name from LGService by sessionId
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Tue, 21 Apr 2015 15:00:19 +0200
parents 26ed9d1d6957
children 3abf39f0eb46
comparison
equal deleted inserted replaced
5:26ed9d1d6957 6:4d59439c8b46
98 // check if get session info from LGService, to get username as editor 98 // check if get session info from LGService, to get username as editor
99 $session_id = $_GET['sessionId']; 99 $session_id = $_GET['sessionId'];
100 $lg_url = "http://localgazetteers-dev/LGServices/rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService 100 $lg_url = "http://localgazetteers-dev/LGServices/rest/utils/getUser?sessionId=".$session_id; // url to get username from LGService
101 $output = file_get_contents($lg_url); 101 $output = file_get_contents($lg_url);
102 $user_info = json_decode($output, true); 102 $user_info = json_decode($output, true);
103 $current_editor = $user_info['userName']; 103 $current_editor = (string)$user_info['userName'];
104 104
105 } else { 105 } else {
106 // test locally 106 // test locally
107 } 107 }
108 108
171 <script>var version=<?php echo $version;?>;</script> 171 <script>var version=<?php echo $version;?>;</script>
172 172
173 <script type="text/javascript"> 173 <script type="text/javascript">
174 function setCurrentEditor() { 174 function setCurrentEditor() {
175 // current_editor is gotten from LGService 175 // current_editor is gotten from LGService
176 var current_editor = JSON.parse('<?php echo json_encode($current_editor) ?>'); 176 var current_editor = <?php echo json_encode($current_editor) ?>;
177 if (current_editor != "") { 177 if (current_editor != "") {
178 $("#saveBook .editor").val(current_editor); 178 $("#saveBook .editor").val(current_editor);
179 } 179 }
180 } 180 }
181 181