--- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -25,7 +25,7 @@ } function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) { - global $labsPath; + global $labsPath,$serviceAlertsEnabled; echo ' <!DOCTYPE html> <html lang="en"> @@ -34,17 +34,18 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <title>' . $pageTitle . '</title> <meta name="google-site-verification" content="-53T5Qn4TB_de1NyfR_ZZkEVdUNcNFSaYKSFkWKx-sY" /> - <link rel="stylesheet" href="' . $labsPath . 'css/jquery-ui-1.8.12.custom.css" /> - <script src="' . $labsPath . 'js/LAB.min.js"></script> '; +<link rel="dns-prefetch" href="//code.jquery.com"> +<link rel="dns-prefetch" href="//ajax.googleapis.com"> + <link rel="stylesheet" href="' . $labsPath . 'css/jquery-ui-1.8.12.custom.css" />'; if (isDebugServer()) { - $jqmcss = $labsPath . 'css/jquery.mobile-1.0b1.css'; - $jqjs = $labsPath . 'js/jquery-1.6.1.min.js'; - $jqmjs = $labsPath . 'js/jquery.mobile-1.0b1.js'; + $jqmcss = $labsPath . 'css/jquery.mobile-1.0b2.css'; + $jqjs = $labsPath . 'js/jquery-1.6.2.min.js'; + $jqmjs = $labsPath . 'js/jquery.mobile-1.0b2.js'; } else { - $jqmcss = "http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css"; - $jqjs = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"; - $jqmjs = "http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"; + $jqmcss = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css"; + $jqjs = "//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"; + $jqmjs = "//code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"; } echo '<link rel="stylesheet" href="' . $jqmcss . '" /> <script src="'.$jqjs.'"></script> @@ -53,16 +54,12 @@ }); </script> <script src="'.$jqmjs.'"></script> - - <script> - $LAB.setOptions({AlwaysPreserveOrder:true}) - .script("' . $jqjs . '").wait() - -.script("' . $labsPath . 'js/jquery.ui.core.min.js") -.script("' . $labsPath . 'js/jquery.ui.position.min.js") -.script("' . $labsPath . 'js/jquery.ui.widget.min.js").wait() - .script("' . $labsPath . 'js/jquery.ui.autocomplete.min.js") - .wait(function() { + +<script src="' . $labsPath . 'js/jquery.ui.core.min.js"></script> +<script src="' . $labsPath . 'js/jquery.ui.position.min.js"></script> +<script src="' . $labsPath . 'js/jquery.ui.widget.min.js"></script> + <script src="' . $labsPath . 'js/jquery.ui.autocomplete.min.js"></script> + <script> $(function() { $( "#geolocate" ).autocomplete({ source: "lib/autocomplete.php", @@ -77,7 +74,6 @@ minLength: 2 }); }); -}); </script>'; echo '<style type="text/css">'; if (strstr($_SERVER['HTTP_USER_AGENT'], 'Android')) echo '.ui-shadow,.ui-btn-up-a,.ui-btn-hover-a,.ui-btn-down-a,.ui-body-b,.ui-btn-up-b,.ui-btn-hover-b, @@ -160,6 +156,13 @@ echo '<div id="servicewarning">Buses are running on an altered timetable today due to industrial action/public holiday. See <a href="http://www.action.act.gov.au">http://www.action.act.gov.au</a> for details.</div>'; } } + if ($GTFSREnabled) { + $serviceAlerts = getServiceAlertsAsArray("agency","0"); + foreach ($serviceAlerts['entity'] as $entity) { + echo "<div id='servicewarning'>".date("F j, g:i a",strtotime($entity['alert']['active_period'][0]['start']))." to ". date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end']))."{$entity['alert']['header_text']['translation'][0]['text']}<br>Warning: {$entity['alert']['description_text']['translation'][0]['text']} + <br><a href='{$entity['alert']['url']['translation'][0]['text']}'>Source</a> </div>"; + } + } } } function include_footer() @@ -181,13 +184,12 @@ } echo "\n</div></div></body></html>"; } -function timePlaceSettings($geolocate = false) +function placeSettings() { global $service_periods; $geoerror = false; - if ($geolocate == true) { $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; - } + echo '<div id="error">'; if ($geoerror) { echo 'Sorry, but your location could not currently be detected. @@ -196,27 +198,13 @@ } echo '</div>'; echo '<div id="settings" data-role="collapsible" data-collapsed="' . !$geoerror . '"> - <h3>Change Time/Place (' . (isset($_SESSION['time']) ? $_SESSION['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...</h3> + <h3>Change Location...</h3> <form action="' . basename($_SERVER['PHP_SELF']) . "?" . $_SERVER['QUERY_STRING'] . '" method="post"> <div class="ui-body"> <div data-role="fieldcontain"> <label for="geolocate"> Current Location: </label> <input type="text" id="geolocate" name="geolocate" value="' . (isset($_SESSION['lat']) && isset($_SESSION['lon']) ? $_SESSION['lat'] . "," . $_SESSION['lon'] : "Enter co-ordinates or address here") . '"/> <a href="#" style="display:none" name="here" id="here">Here?</a> </div> - <div data-role="fieldcontain"> - <label for="time"> Time: </label> - <input type="time" name="time" id="time" value="' . (isset($_SESSION['time']) ? $_SESSION['time'] : date("H:i")) . '"/> - <a href="#" name="currentTime" id="currentTime" onClick="var d = new Date();' . "$('#time').val(d.getHours() +':'+ (d.getMinutes().toString().length == 1 ? '0'+ d.getMinutes(): d.getMinutes()));" . '">Current Time?</a> - </div> - <div data-role="fieldcontain"> - <label for="service_period"> Service Period: </label> - <select name="service_period" id="service_period">'; - foreach ($service_periods as $service_period) { - echo "<option value=\"$service_period\"" . (service_period() === $service_period ? " SELECTED" : "") . '>' . ucwords($service_period) . '</option>'; - } - echo '</select> - <a href="#" style="display:none" name="currentPeriod" id="currentPeriod">Current Period?</a> - </div> <input type="submit" value="Update"/> </div></form>