Project

General

Profile

« Previous | Next » 

Revision 51b2f811

Added by Renato Botelho over 11 years ago

Fix days and weeks selection on schedules, reported at https://forum.pfsense.org/index.php?topic=74101.0

View differences:

usr/local/www/firewall_schedule_edit.php
215 215
var day_array = ['Mon','Tues','Wed','Thur','Fri','Sat','Sun'];
216 216
var schCounter = 0;
217 217

  
218

  
218
function rgb2hex(rgb) {
219
	var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
220
	if (parts == null)
221
		return;
222
	function hex(x) {
223
		return ("0" + parseInt(x).toString(16)).slice(-2);
224
	}
225
	return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase();
226
}
219 227

  
220 228
function repeatExistingDays(){
221 229
	var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
......
234 242
		tempstr = 'w' + week + 'p' + daypos;
235 243
		daycell = eval('document.getElementById(tempstr)');
236 244
		if (daydone == "-1"){
237
			if (daycell.style.backgroundColor == "#F08080")  // lightcoral
245
			if (rgb2hex(daycell.style.backgroundColor) == "#F08080")  // lightcoral
238 246
				daytogglerepeating(week,daypos,true);
239 247
			else
240 248
				daytogglerepeating(week,daypos,false);
......
274 282
		}			
275 283
	}	
276 284
}
277
	
285

  
278 286
function daytoggle(id) {
279 287
	var runrepeat, tempstr = "";
280 288
	var bFoundValid = false;
......
309 317
		var daycell = document.getElementById(idmod);		
310 318
	
311 319
		if (daycell != null){
312
			if (daycell.style.backgroundColor == "#FF0000"){  // red
320
			if (rgb2hex(daycell.style.backgroundColor) == "#FF0000"){  // red
313 321
				daycell.style.backgroundColor = "#FFFFFF";  // white
314 322
				str = id + ",";
315 323
				daysSelected = daysSelected.replace(str, "");
316 324
			}
317
			else if (daycell.style.backgroundColor == "#F08080")  // lightcoral
325
			else if (rgb2hex(daycell.style.backgroundColor) == "#F08080")  // lightcoral
318 326
			{
319 327
				daytogglerepeating(year,week,daypos,true);
320 328
			}

Also available in: Unified diff