This script has been substantially rewritten. Therefore the old thread has been closed. The contents of the new 'wxusradars-hanis.txt' readme file is as follows:
This project derives from my GRLevel3 HAniS scripts, and follows the same outlines. It was made possible because of Tom Whittaker's excellent javascript 'HAniS' HTML5 Animation Script which he has so kindly shared with all.
-- CAUTION --
Please read this entire document and carefully follow the instructions before you install this package on your website.
-- FILE LIST ---
Version 20120812 Files Included:
i) wxusradars-hanis.php
ii) inc-wxusradars-hanis.php.
iii) wxusradar-hanis-iframe.php
iv) wxusradars-hanis.txt (this file)
v) phptest.php
vi) /HAniS/hanis_min.js
vii) radar-status-getradar.php
The /HAniS directory should be copied to your site's root, if it isn't already present. If it is already present on your site you may safely delete 'hanis.js' from there. Only '/HAniS/hanis_min.js' is required to run this HAniS-dependent script.
-- SETTINGS --
You should edit the Settings in 'wxusradars-hanis.php'. If you want to hide the Auto Refresh capabilities of the script, set '$autoRefresn = false'. When 'autoRefresh = false' the manual 'Refresh' button must be used to refresh the radar display.
The 'autoRefreshOff' Setting determines the default AutoRefresh Setting, 'ON' or 'OFF'. Turning the default AutoRefresh 'OFF' by Setting '$autoRefreshOff = true;' prevents casual users from loading the page and forgetting it while AutoRefresh is 'ON'.
Settings now include:
/************************* Settings *****************************/
$radar = 'N0R'; // Default radar type is set here
$radarLoc = 'oax'; // IMPORTAMT!!! Default radar location is set here
$imageWidth = 600; // Width of radar images
$iframeWidth = 617; // Default IFrame Width -- adjust as needed
$iframeHeight = 620; // Default IFrame Height -- adjust as needed
$autoRefresh = true; // Use Autorefresh? true or false -- Determines whether AutoRefresh even appears
$autoRefreshTime = 8; // Number of minutes between autorefreshes. IMPORTANT: use 2, 3, 4, 5, 6, 8, 10, 15, 20, or 30 ONLY!!!
$autoRefreshOff = true; // Begin with Autorefresh Off? true or false -- 'OFF' or 'ON"
$bgndColor = 'silver'; // Set HAniS Background Color Here
$btnColor = 'mediumblue'; // Set Button Color here
$btnTextColor = 'white'; // Set Button Text Color here
/*********************** End Settings ***************************/
These are the defaults for 'wxusradars-hanis.php'.
Change '$radarLoc' to your preferred WFO, and edit anything else to your liking. You shouldn't need to touch '$imageWidth', '$iframeWidth, or '$iframeHeight'.
When changing any of the '$bgndColor', '$btnColor', or '$btnTextColor' variables only HTML Color Names are passed to 'wxusradar-hanis-iframe.php'. Therefore hex colors, e.g. #0000CC, will show up on the first row of buttons, but not the second. Another option would be to use RGB colors. The legal color names are listed at http://www.w3schools.com/html/html_colornames.asp
The '$autoRefreshTime' allows users to increase the frequency of AutoRefreshes when their radar of interest is updating more frequently because of local weather activity. The longest interval between NWS Ridge Radar updates is 10 minutes, but longer intervals may be selected when the weather is uneventful. The NWS states that a 4 minute Ridge Radar update is the minimum, but I have observed updates just a minute apart on the Legend.
-- INSTALLATION --
After reviewing and changing the Settings, upload all five scripts to your site along with the /HAniS directory, and add 'wxusradars-hanis.php' to your site's menu. If your site has 'wxusradars-select-hanis.php', you may delete it. The functionality of this file has been added to 'inc-wxusradars-hanis.php'. As another benefit of this change, editing of 'selected="selected"' is no longer required.
The main file, 'wxusradars-hanis.php', now includes a Stand-Alone option with '$standalone = false' as the default for Saratoga template use. When '$standalone = true' the script runs outside the Saratoga template. You could save a script thus modified as 'wxusradars-hanis-SA.php' or some such.
All of the selectors use the same button color options as HAniS and are the same color as the radar control buttons. The AutoRefresh and Refresh Interval selectors are found inline with the other selectors above the radar location and type. This was necessary because during a (auto)refresh the entire 'inc-wxradars-hanis.php' must be reloaded so the correct variable parameters are active in order to avoid browser caching of directories.
-- LIMITATIONS --
The included 'phptest.php' will, when run, list all of the important Settings of your webhost's PHP, including PHP version and most importantly whether 'allow_url_fopen' is 'on'. If it is 'off', the script will fail because it will be unable to get the directory file listings from 'http://radar.weather.gov/ridge' due to strict javascript cross-domain limitations. If 'allow_url_fopen' is 'off', the static map, county, highway, river, and city overlays will show up and be selectable, but no dynamic radar, warnings, or legend layers will appear. You will just see a static map.
If you encounter this condition, you or your webhost's administrators will need to edit your site's 'php.ini' to read 'allow_url_fopen = on'. While running your site with 'allow_url_fopen' 'on' represents a slightly greater security risk, unless your site's users enter their sensitive information such as credit card or social security numbers, this risk should be minimal. This script contains no user input, so risks from it should be nil. You should evaluate the remainder of scripts on your web site to determine if they present a significant risk with 'allow_url_fopen' 'on'.
An alternative approach to turning 'allow_url_fopen' 'on' would be to forego AutoRefresh by Setting 'autoRefresh = false;' thus turning off the display of any AutoRefresh options. Then where another site has 'allow_url_fopen' 'on' you would need to point your <iframe> at that site's 'wxusradar-hanis-iframe.php' in 'inc-wxusradars-hanis.php' by changing 'src="./wxusradar-hanis-iframe.php' to, for example, 'src="http://www.gwwilkins/wxusradar-hanis-iframe.php'. Refreshing the radar display could then be done manually by clicking the 'Refresh' button.
AutoRefreshOff will be turned 'OFF' any time a different radar site, radar type, or refresh interval is selected necessitating the user turn it back on. If it were to remain 'ON' subsequent AutoRefreshes would become unreliable.
-- CACHE --
The 'radar-status-getradar.php' is a modification of Ken True's 'radar-status.php' script for a single radar site. The modified 'radar-status-getradar.php' adds multi-site capabilities to the 'radar-status.php' script. One side-effect of the multi-site script is that your site's cache directory, as determined by the 'radar-status-getradar.php' $cacheFileDir = './cache/';' entry, will now contain a status file for each radar site loaded by 'wxusradars-hanis.php'. Periodic housecleaning of your cache directory of these files is optional, especially if your site has limited disk space.
-- ENHANCEMENT --
Prior versions did not display the most recent radar image of the selected site. Version 20150812 now displays the most recent radar image.
Please post any problems, questions, or suggestions to this thread.
Edit 14 August 2015: An enhanced version with identical functionality but greater flexibility is
posted below.
Edit 18 August 2015: Please see
this post regarding the restoration of Ajax-Gizmo functionality.
Edit 20 August 2015: Version 3 of this script is
now available. It adds HAniS 2.5's ability to smooth images at the pixel level, which shows up at extreme Zoom levels in this script. Version 3 also adds a selector for the number of images to display, removes the 'Refresh' button when auto-refresh is enabled, and defaults to 'AutoRefresh' 'ON'. Ajax-Gizmo functionality has been restored thanks to Ken True. Plesae see the included 'wxusradars-hanis3.txt' file for additional information.
Edit 25 August 2015: Version 3c2 of this script incorporated a small change in 'wxusradar-iframe-hanis3.php' to use the Button Color on the toggle buttons. Tom Whittaker added this to Hanis 2.6 released today. If changing versions upload all of the scripts after preserving customizations in 'wxusradars-hanis3.php'. Be sure to update '/HAniS/hanis_min.js' to the latest version.
Edit 26 August 2015: Version 3c3 corrects typos that prevented proper navigation between radar types.
Edit 5 March 2016: See below for later version.
Edit 22 February 2017: The latest version, V5 (20170222) is attached to
this thread.