Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- Copyright (c) 2012-2016 Adobe Systems Incorporated. All rights reserved.
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
- <html>
- <head>
- <meta charset="utf-8" />
- <meta name="format-detection" content="telephone=no" />
- <meta name="msapplication-tap-highlight" content="no" />
- <meta name="viewport" content="user-scalable=no, initial-scale=1,
- maximum-scale=1, minimum-scale=1, width=device-width" />
- <!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
- <meta http-equiv="Content-Security-Policy" content="default-src *;
- img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *;
- style-src 'self' 'unsafe-inline' *">
- <!-- Good default declaration:
- * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
- * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
- * Disables use of eval() and inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
- * Enable inline JS: add 'unsafe-inline' to default-src
- * Enable eval(): add 'unsafe-eval' to default-src
- * Create your own at http://cspisawesome.com
- -->
- <!-- <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 *" /> -->
- <link rel="stylesheet" type="text/css" href="css/index.css" />
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
- <title>Hello World</title>
- </head>
- <body>
- <div data-role="page" id="index">
- <style>
- #mapPlaceholder {
- height: 300px;
- width: 300px;
- margin-left: auto;
- margin-right: auto;
- }
- </style>
- <div data-role="content">
- <form id="frmlogin">
- <div align="center"><h1>Incident Management System</h1></div>
- <div align="center">
- <img src="img/imsicon.png" alt="startup image" align="center" /></div>
- <h3>Sign In</h3>
- <label for="employeeno">Employee No</label>
- <input type="text" name="username" id="username" value="123">
- <label for="password">Password</label>
- <input type="password" name="password" id="password" value="password">
- <a data-role="button" id="navigateButton">L O G I N</a>
- </form>
- <div id="mapPlaceholder">map loading</div><br>
- <a data-role="button" id="camerabtn">Camera</a>
- <img id = "myImage"></img>
- </div>
- <div data-role="footer">
- <div id="resultLog" align="center"></div>
- </div>
- </div>
- <script type="text/javascript" src="cordova.js"></script>
- <script type="text/javascript" src="js/index.js"></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
- <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBg9sFOjOE94E-t6vMhm90Htf9F0Zu1atI" type="text/javascript"></script>
- </body>
- </html>
- var host="http://localhost/";
- window.onload = function()
- {
- document.addEventListener("deviceready", init, false);
- }
- function init()
- {
- loadmap();
- var myButton = document.getElementById("navigateButton");
- myButton.addEventListener("click", clicked, false);
- var camerabtn = document.getElementById("camerabtn");
- camerabtn.addEventListener("click", opencamera, false);
- }
- function clicked()
- {
- $.ajax({
- type: "POST",
- url: host+"p1/loginprocess.php",
- //data: ({username: un,password:pwd }),
- data:$("#frmlogin").serialize(),
- cache: false,
- dataType: "text",
- success: onSuccess
- });
- }
- function onSuccess(data)
- {
- alert(data);
- if(data=="ok")
- {
- $("#resultLog").html("Validated !");
- }
- else
- {
- $("#resultLog").html("Validation Failed, Contact Admin");
- }
- }
- function loadmap()
- {
- var defaultLatLng = new google.maps.LatLng(34.0983425, -118.3267434); // Default to Hollywood, CA when no geolocation support
- if ( navigator.geolocation ) {
- function success(pos) {
- // Location found, show map with these coordinates
- drawMap(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
- latitude=pos.coords.latitude;
- longitude=pos.cords.longitude;
- }
- function fail(error) {
- drawMap(defaultLatLng); // Failed to find location, show default map
- }
- // Find the users current position. Cache the location for 5 minutes, timeout after 6 seconds
- navigator.geolocation.getCurrentPosition(success, fail, {maximumAge: 500000, enableHighAccuracy:true, timeout: 4000});
- } else {
- drawMap(defaultLatLng); // No geolocation support, show default map
- }
- function drawMap(latlng) {
- var myOptions = {
- zoom: 20,
- center: latlng,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- var map = new google.maps.Map(document.getElementById("mapPlaceholder"), myOptions);
- // Add an overlay to the map of current lat/lng
- var marker = new google.maps.Marker({
- position: latlng,
- map: map,
- title: "Greetings!"
- });
- }
- }
- function opencamera()
- {
- navigator.camera.getPicture(onSuccess, onFail, {
- quality: 50,
- destinationType: Camera.DestinationType.DATA_URL
- });
- function onSuccess(imageData) {
- var image = document.getElementById('myImage');
- image.src = "data:image/jpeg;base64," + imageData;
- }
- function onFail(message) {
- alert('Failed because: ' + message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement