|  | @@ -474,7 +474,7 @@ function ResourceCalDAVList()
 | 
	
		
			
			| 474 | 474 |  				newElement.find('input[type=checkbox]').attr('onclick','resourceChBoxClick(this, \'#\'+$(this).parent().parent().attr(\'id\'), \''+resHeader+'\', false);if(isCalDAVLoaded && $(this).parent().parent().attr(\'id\')== \'ResourceCalDAV'+todoString+'List\'){$(this).prop(\'checked\')?enableResourceTodo($(this).parent()):disableResourceTodo($(this).parent());}');
 | 
	
		
			
			| 475 | 475 |  
 | 
	
		
			
			| 476 | 476 |  			newElement.css('display', 'none');
 | 
	
		
			
			| 477 |  | -			newElement=newElement.parent().html();
 | 
	
		
			
			|  | 477 | +      newElement=newElement.parent().html();
 | 
	
		
			
			| 478 | 478 |  			$('#ResourceCalDAV'+todoString+'List').children().eq(insertIndex).after(newElement);
 | 
	
		
			
			| 479 | 479 |  		}
 | 
	
		
			
			| 480 | 480 |  
 | 
	
	
		
			
			|  | @@ -488,7 +488,40 @@ function ResourceCalDAVList()
 | 
	
		
			
			| 488 | 488 |  		if(globalCalDAVInitLoad)
 | 
	
		
			
			| 489 | 489 |  			newElement.addClass('r_operate');
 | 
	
		
			
			| 490 | 490 |  
 | 
	
		
			
			| 491 |  | -		newElement.html("<div class='resourceCalDAVColor' style='background:"+inputResource.ecolor+"'></div><input type='text' class='colorPicker'/><input type='checkbox' name="+inputResource.uid+" />"+$('<div/>').text(inputResource.displayvalue).html());
 | 
	
		
			
			|  | 491 | +    var uniqueIdForLabel = inputResource.displayvalue.replace('.', '') // remove the point so jquery doesn't consider it as 2 differents classes when used in a selector
 | 
	
		
			
			|  | 492 | +		newElement.html("\
 | 
	
		
			
			|  | 493 | +      <div class='resourceCalDAVColor' style='background:"+inputResource.ecolor+"'></div>\
 | 
	
		
			
			|  | 494 | +      <input type='text' class='colorPicker'/>\
 | 
	
		
			
			|  | 495 | +      <input type='checkbox' name="+inputResource.uid+" />\
 | 
	
		
			
			|  | 496 | +      <div class='"+uniqueIdForLabel+"' style='display:inline-block'>"+inputResource.displayvalue+"</div>");
 | 
	
		
			
			|  | 497 | +
 | 
	
		
			
			|  | 498 | +    // +$('<div/>').text(inputResource.displayvalue).html()); // legacy code
 | 
	
		
			
			|  | 499 | +    $.ajax({
 | 
	
		
			
			|  | 500 | +      url: '/api/calendars/',
 | 
	
		
			
			|  | 501 | +      method: 'GET',
 | 
	
		
			
			|  | 502 | +      contentType: 'application/json'
 | 
	
		
			
			|  | 503 | +    }).done(function (data) {
 | 
	
		
			
			|  | 504 | +      var currentICS = parseInt(inputResource.displayvalue.replace('.ics', ''))
 | 
	
		
			
			|  | 505 | +
 | 
	
		
			
			|  | 506 | +      var regExpUser = new RegExp('\/cal\/user\/')
 | 
	
		
			
			|  | 507 | +      var regExpWorkspace = new RegExp('\/cal\/workspace\/')
 | 
	
		
			
			|  | 508 | +
 | 
	
		
			
			|  | 509 | +      var user_or_workspace
 | 
	
		
			
			|  | 510 | +
 | 
	
		
			
			|  | 511 | +      if (regExpUser.test(inputResource.uid))
 | 
	
		
			
			|  | 512 | +        user_or_workspace = 'user'
 | 
	
		
			
			|  | 513 | +      else if (regExpWorkspace.test(inputResource.uid))
 | 
	
		
			
			|  | 514 | +        user_or_workspace = 'workspace'
 | 
	
		
			
			|  | 515 | +      else
 | 
	
		
			
			|  | 516 | +        user_or_workspace = 'fail'
 | 
	
		
			
			|  | 517 | +
 | 
	
		
			
			|  | 518 | +      // console.log('user_or_workspace : ', user_or_workspace, 'for : ', inputResource.uid)
 | 
	
		
			
			|  | 519 | +      // data.value_list.forEach((item) => item.id === currentICS && item.type === user_or_workspace && $('.'+uniqueIdForLabel).html(item.label)) // ES 6 approach
 | 
	
		
			
			|  | 520 | +      data.value_list.forEach(function (item) {
 | 
	
		
			
			|  | 521 | +        if (item.id === currentICS && item.type === user_or_workspace) $('.'+uniqueIdForLabel).html(item.label)
 | 
	
		
			
			|  | 522 | +      })
 | 
	
		
			
			|  | 523 | +    })
 | 
	
		
			
			|  | 524 | +
 | 
	
		
			
			| 492 | 525 |  		newElement.attr('title', $('<div/>').text(inputResource.displayvalue).html());
 | 
	
		
			
			| 493 | 526 |  		if(todoString=='')
 | 
	
		
			
			| 494 | 527 |  			newElement.find('input[type=checkbox]').attr({'data-id':inputResource.uid, 'onclick':'var evt = arguments[0];evt.stopPropagation();collectionChBoxClick(this, \'#\'+$(this).parent().parent().attr(\'id\'), \''+resHeader+'\', \''+resItem+'\', null, false);if(isCalDAVLoaded && $(this).parent().parent().attr(\'id\')== \'ResourceCalDAV'+todoString+'List\'){$(this).prop(\'checked\')?enableCalendar(\''+inputResource.uid+'\'):disableCalendar(\''+inputResource.uid+'\');}'});
 |