forked from bbdoc/PoracleWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Button to Set Location to current Position
- Loading branch information
Showing
8 changed files
with
113 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,6 @@ class="mr-2 d-none d-lg-inline text-gray-600 small"><?php echo $_SESSION['userna | |
|
||
<!-- Begin Page Content --> | ||
<div class="container-fluid col-lg-8 col-md-12"> | ||
|
||
<!-- Profile Settings Modal --> | ||
<?php include "./modal/profile_settings_modal.php"; ?> | ||
|
||
|
@@ -246,7 +245,7 @@ class="mr-2 d-none d-lg-inline text-gray-600 small"><?php echo $_SESSION['userna | |
if ($enabled==0) { | ||
?> | ||
<div class="alert alert-danger alert-dismissible fade show" role="alert"> | ||
<?php echo i8ln("Your alarms are currently disabled !"); ?> | ||
<?php echo i8ln("Your alarms are currently disabled!"); ?> | ||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
|
@@ -288,14 +287,19 @@ class="mr-2 d-none d-lg-inline text-gray-600 small"><?php echo $_SESSION['userna | |
data-target="#areasModal"> | ||
<i class="fas fa-edit"></i> | ||
</button> | ||
<?php } ?> | ||
<?php } ?> | ||
<?php if ($disable_location <> "True") { ?> | ||
<h6 class="m-0 font-weight-bold text-dark"><?php echo i8ln("LOCATION"); ?></h6> | ||
<!-- Button trigger modal --> | ||
<!-- Button trigger modal --> | ||
<div align="right"> | ||
<button type="button" class="btn btn-success btn-circle btn-md" onclick="getLocation()"> | ||
<i class="fas fa-map-marker-alt"></i> | ||
</button> | ||
<button type="button" class="btn btn-success btn-circle btn-md" data-toggle="modal" | ||
data-target="#locationModal"> | ||
<i class="fas fa-edit"></i> | ||
</button> | ||
</button> | ||
</div> | ||
<?php } ?> | ||
|
||
</div> | ||
|
@@ -345,6 +349,30 @@ class="mr-2 d-none d-lg-inline text-gray-600 small"><?php echo $_SESSION['userna | |
<div class="col mr-2"> | ||
<div class="row"> | ||
|
||
<div id="position_error_div" style="display:none;" class="col-xl-12 col-lg-4 col-md-6 col-sm-12 text-center"> | ||
<div id="PERMISSION_DENIED" style="display:none;" class="alert alert-danger" role="alert"> | ||
<b><?php echo i8ln("Could not set Location"); ?></b>.<br> | ||
<?php echo i8ln("User denied the request for Geolocation"); ?>. | ||
</div> | ||
<div id="POSITION_UNAVAILABLE" style="display:none;" class="alert alert-danger" role="alert"> | ||
<b><?php echo i8ln("Could not set Location"); ?></b>.<br> | ||
<?php echo i8ln("Location information is unavailable"); ?>. | ||
</div> | ||
<div id="TIMEOUT" style="display:none;" class="alert alert-danger" role="alert"> | ||
<b><?php echo i8ln("Could not set Location"); ?></b>.<br> | ||
<?php echo i8ln("The request to get user location timed out"); ?>. | ||
</div> | ||
<div id="UNKNOWN_ERROR" style="display:none;" class="alert alert-danger" role="alert"> | ||
<b><?php echo i8ln("Could not set Location"); ?></b>.<br> | ||
<?php echo i8ln("An unknown error occurred"); ?>. | ||
</div> | ||
<div id="NOT_SUPPORTED" style="display:none;" class="alert alert-danger" role="alert"> | ||
<b><?php echo i8ln("Could not set Location"); ?></b>.<br> | ||
<?php echo i8ln("Geolocation is not supported by this browser"); ?>. | ||
</div> | ||
</div> | ||
|
||
|
||
<?php | ||
if ($latitude == "0.0000000000" && $longitude == "0.0000000000") { | ||
?> | ||
|
@@ -1589,6 +1617,7 @@ class="btn btn-danger"><?php echo i8ln("DELETE"); ?></a> | |
|
||
<!-- Custom scripts for all pages--> | ||
<script src="js/scripts.js"></script> | ||
<script type="text/javascript" src="js/get_position.js?v=<?=time();?>"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/[email protected]/js/bootstrap4-toggle.min.js"></script> | ||
|
||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
var error_div = document.getElementById("position_error_div"); | ||
|
||
function getLocation() { | ||
if (navigator.geolocation) { | ||
navigator.geolocation.getCurrentPosition(setPosition, showError); | ||
} else { | ||
error_div.style.display = "block" | ||
document.getElementById("NOT_SUPPORTED").style.display = "block" | ||
} | ||
} | ||
|
||
function setPosition(position) { | ||
window.location = './set_location.php?lat=' + position.coords.latitude + '&lon=' + position.coords.longitude; | ||
} | ||
|
||
function showError(error) { | ||
switch(error.code) { | ||
case error.PERMISSION_DENIED: | ||
error_div.style.display = "block" | ||
document.getElementById("PERMISSION_DENIED").style.display = "block" | ||
break; | ||
case error.POSITION_UNAVAILABLE: | ||
error_div.style.display = "block" | ||
document.getElementById("POSITION_UNAVAILABLE").style.display = "block" | ||
break; | ||
case error.TIMEOUT: | ||
error_div.style.display = "block" | ||
document.getElementById("TIMEOUT").style.display = "block" | ||
break; | ||
case error.UNKNOWN_ERROR: | ||
error_div.style.display = "block" | ||
document.getElementById("UNKNOWN_ERROR").style.display = "block" | ||
break; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters