diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-03-25 16:06:52 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-03-25 16:06:52 -0300 |
commit | 51b2f811ae6f123921fee2d73df5ddb23ba2e098 (patch) | |
tree | 298524544d2d2251ed93a01853af07d4bb7dbcd8 /usr | |
parent | b121ffad228d5aa914d3048d88c8c8d2be4238f0 (diff) | |
download | pfsense-51b2f811ae6f123921fee2d73df5ddb23ba2e098.zip pfsense-51b2f811ae6f123921fee2d73df5ddb23ba2e098.tar.gz |
Fix days and weeks selection on schedules, reported at https://forum.pfsense.org/index.php?topic=74101.0
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/www/firewall_schedule_edit.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr/local/www/firewall_schedule_edit.php b/usr/local/www/firewall_schedule_edit.php index b02dbd1..656f7cf 100644 --- a/usr/local/www/firewall_schedule_edit.php +++ b/usr/local/www/firewall_schedule_edit.php @@ -215,7 +215,15 @@ var month_array = ['January','February','March','April','May','June','July','Aug var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun']; var schCounter = 0; - +function rgb2hex(rgb) { + var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); + if (parts == null) + return; + function hex(x) { + return ("0" + parseInt(x).toString(16)).slice(-2); + } + return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase(); +} function repeatExistingDays(){ var tempstr, tempstrdaypos, week, daypos, dayposdone = ""; @@ -234,7 +242,7 @@ function repeatExistingDays(){ tempstr = 'w' + week + 'p' + daypos; daycell = eval('document.getElementById(tempstr)'); if (daydone == "-1"){ - if (daycell.style.backgroundColor == "#F08080") // lightcoral + if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral daytogglerepeating(week,daypos,true); else daytogglerepeating(week,daypos,false); @@ -274,7 +282,7 @@ function daytogglerepeating(year,week,daypos,bExists){ } } } - + function daytoggle(id) { var runrepeat, tempstr = ""; var bFoundValid = false; @@ -309,12 +317,12 @@ function daytoggle(id) { var daycell = document.getElementById(idmod); if (daycell != null){ - if (daycell.style.backgroundColor == "#FF0000"){ // red + if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){ // red daycell.style.backgroundColor = "#FFFFFF"; // white str = id + ","; daysSelected = daysSelected.replace(str, ""); } - else if (daycell.style.backgroundColor == "#F08080") // lightcoral + else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral { daytogglerepeating(year,week,daypos,true); } |