Advertisement
Guest User

Untitled

a guest
Apr 10th, 2018
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.59 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. Copyright (c) 2012-2016 Adobe Systems Incorporated. All rights reserved.
  4.  
  5. Licensed to the Apache Software Foundation (ASF) under one
  6. or more contributor license agreements. See the NOTICE file
  7. distributed with this work for additional information
  8. regarding copyright ownership. The ASF licenses this file
  9. to you under the Apache License, Version 2.0 (the
  10. "License"); you may not use this file except in compliance
  11. with the License. You may obtain a copy of the License at
  12.  
  13. http://www.apache.org/licenses/LICENSE-2.0
  14.  
  15. Unless required by applicable law or agreed to in writing,
  16. software distributed under the License is distributed on an
  17. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18. KIND, either express or implied. See the License for the
  19. specific language governing permissions and limitations
  20. under the License.
  21. -->
  22. <html>
  23.  
  24. <head>
  25. <meta charset="utf-8" />
  26. <meta name="format-detection" content="telephone=no" />
  27. <meta name="msapplication-tap-highlight" content="no" />
  28. <meta name="viewport" content="user-scalable=no, initial-scale=1,
  29. maximum-scale=1, minimum-scale=1, width=device-width" />
  30. <!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
  31. <meta http-equiv="Content-Security-Policy" content="default-src *;
  32. img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
  33. style-src 'self' 'unsafe-inline' *">
  34.  
  35. <!-- Good default declaration:
  36. * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
  37. * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
  38. * Disables use of eval() and inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
  39. * Enable inline JS: add 'unsafe-inline' to default-src
  40. * Enable eval(): add 'unsafe-eval' to default-src
  41. * Create your own at http://cspisawesome.com
  42. -->
  43. <!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: 'unsafe-inline' https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src *" /> -->
  44.  
  45. <link rel="stylesheet" type="text/css" href="css/index.css" />
  46. <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
  47. <title>Hello World</title>
  48. </head>
  49.  
  50. <body>
  51. <div data-role="page" id="index">
  52. <style>
  53. #mapPlaceholder {
  54. height: 300px;
  55. width: 300px;
  56. margin-left: auto;
  57. margin-right: auto;
  58. }
  59. </style>
  60. <div data-role="content">
  61. <form id="frmlogin">
  62. <div align="center"><h1>Incident Management System</h1></div>
  63. <div align="center">
  64. <img src="img/imsicon.png" alt="startup image" align="center" /></div>
  65. <h3>Sign In</h3>
  66. <label for="employeeno">Employee No</label>
  67. <input type="text" name="username" id="username" value="123">
  68. <label for="password">Password</label>
  69. <input type="password" name="password" id="password" value="password">
  70. <a data-role="button" id="navigateButton">L O G I N</a>
  71. </form>
  72. <div id="mapPlaceholder">map loading</div><br>
  73. <a data-role="button" id="camerabtn">Camera</a>
  74. <img id = "myImage"></img>
  75. </div>
  76. <div data-role="footer">
  77. <div id="resultLog" align="center"></div>
  78. </div>
  79. </div>
  80. <script type="text/javascript" src="cordova.js"></script>
  81. <script type="text/javascript" src="js/index.js"></script>
  82. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  83. <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
  84. <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBg9sFOjOE94E-t6vMhm90Htf9F0Zu1atI" type="text/javascript"></script>
  85.  
  86. </body>
  87.  
  88. </html>
  89.  
  90.  
  91. var host="http://localhost/";
  92. window.onload = function()
  93. {
  94. document.addEventListener("deviceready", init, false);
  95. }
  96. function init()
  97. {
  98. loadmap();
  99. var myButton = document.getElementById("navigateButton");
  100. myButton.addEventListener("click", clicked, false);
  101.  
  102. var camerabtn = document.getElementById("camerabtn");
  103. camerabtn.addEventListener("click", opencamera, false);
  104. }
  105. function clicked()
  106. {
  107. $.ajax({
  108. type: "POST",
  109. url: host+"p1/loginprocess.php",
  110. //data: ({username: un,password:pwd }),
  111. data:$("#frmlogin").serialize(),
  112. cache: false,
  113. dataType: "text",
  114. success: onSuccess
  115. });
  116. }
  117. function onSuccess(data)
  118. {
  119. alert(data);
  120. if(data=="ok")
  121. {
  122. $("#resultLog").html("Validated !");
  123. }
  124. else
  125. {
  126. $("#resultLog").html("Validation Failed, Contact Admin");
  127. }
  128.  
  129. }
  130. function loadmap()
  131. {
  132. var defaultLatLng = new google.maps.LatLng(34.0983425, -118.3267434); // Default to Hollywood, CA when no geolocation support
  133. if ( navigator.geolocation ) {
  134. function success(pos) {
  135. // Location found, show map with these coordinates
  136. drawMap(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
  137. latitude=pos.coords.latitude;
  138. longitude=pos.cords.longitude;
  139.  
  140. }
  141. function fail(error) {
  142. drawMap(defaultLatLng); // Failed to find location, show default map
  143. }
  144. // Find the users current position. Cache the location for 5 minutes, timeout after 6 seconds
  145. navigator.geolocation.getCurrentPosition(success, fail, {maximumAge: 500000, enableHighAccuracy:true, timeout: 4000});
  146. } else {
  147. drawMap(defaultLatLng); // No geolocation support, show default map
  148. }
  149. function drawMap(latlng) {
  150. var myOptions = {
  151. zoom: 20,
  152. center: latlng,
  153. mapTypeId: google.maps.MapTypeId.ROADMAP
  154. };
  155. var map = new google.maps.Map(document.getElementById("mapPlaceholder"), myOptions);
  156. // Add an overlay to the map of current lat/lng
  157. var marker = new google.maps.Marker({
  158. position: latlng,
  159. map: map,
  160. title: "Greetings!"
  161. });
  162. }
  163. }
  164. function opencamera()
  165. {
  166. navigator.camera.getPicture(onSuccess, onFail, {
  167. quality: 50,
  168. destinationType: Camera.DestinationType.DATA_URL
  169. });
  170.  
  171. function onSuccess(imageData) {
  172. var image = document.getElementById('myImage');
  173. image.src = "data:image/jpeg;base64," + imageData;
  174. }
  175.  
  176. function onFail(message) {
  177. alert('Failed because: ' + message);
  178. }
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement