rem: var thisMorning = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0 );  if(treeItem.getElementsByTagName( "treerow" )[0]) treeItem.removeChild( treeItem.getElementsByTagName( "treerow" )[0] );  var textProperties = ""; if( calendarToDo.start.getTime() <= thisMorning.getTime() ) {  textProperties = textProperties + " started"; }  var completed = calendarToDo.completed.getTime();  if( completed > 0 ) { /* for setting some css */ var completedDate = new Date( calendarToDo.completed.getTime() ); var FormattedCompletedDate = formatUnifinderEventDate( completedDate );  treeCellCompleteddate.setAttribute( "label", FormattedCompletedDate ); textProperties = textProperties + " completed"; treeItem.setAttribute( "checked", "true" ); } else treeCellCompleteddate.setAttribute( "label", "" );   treeCellTitle.setAttribute( "label", calendarToDo.title );  var startDate     = new Date( calendarToDo.start.getTime() ); var dueDate = new Date( calendarToDo.due.getTime() );  var tonightMidnight = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 00 );  var yesterdayMidnight = new Date( now.getFullYear(), now.getMonth(), ( now.getDate() - 1 ), 23, 59, 00 );  if( tonightMidnight.getTime() > dueDate.getTime() ) { /* for setting some css */ textProperties += " overdue"; } else if ( dueDate.getFullYear() == now.getFullYear() && dueDate.getMonth() == now.getMonth() && dueDate.getDate() == now.getDate() ) { textProperties += " duetoday"; } else { textProperties += " inprogress"; } if(calendarToDo.priority > 0 && calendarToDo.priority < 5) textProperties = textProperties + " highpriority"; if(calendarToDo.priority > 5 && calendarToDo.priority < 10) textProperties = textProperties + " lowpriority";   var FormattedStartDate = formatUnifinderEventDate( startDate ); var FormattedDueDate = formatUnifinderEventDate( dueDate );  treeCellStartdate.setAttribute( "label", FormattedStartDate ); treeCellDuedate.setAttribute( "label", FormattedDueDate ); treeCellPercentcomplete.setAttribute( "label", calendarToDo.percent + "%" ); treeCellCategories.setAttribute( "label", calendarToDo.categories );  treeItem.setAttribute( "taskitem", "true" );  treeRow.setAttribute("properties", textProperties); treeCellCompleted.setAttribute("properties", textProperties); treeCellPriority.setAttribute("properties", textProperties); treeCellTitle.setAttribute("properties", textProperties); treeCellStartdate.setAttribute("properties", textProperties); treeCellDuedate.setAttribute("properties", textProperties); treeCellCompleteddate.setAttribute("properties", textProperties); treeCellPercentcomplete.setAttribute("properties", textProperties); treeCellCategories.setAttribute("properties", textProperties);  treeRow.appendChild( treeCellCompleted ); treeRow.appendChild( treeCellPriority ); treeRow.appendChild( treeCellTitle ); treeRow.appendChild( treeCellStartdate ); treeRow.appendChild( treeCellDuedate ); treeRow.appendChild( treeCellCompleteddate ); treeRow.appendChild( treeCellPercentcomplete ); treeRow.appendChild( treeCellCategories ); treeItem.appendChild( treeRow ); 
add:  treeCellTitle.setAttribute( "label", calendarToDo.title );  var startDate     = new Date( calendarToDo.start.getTime() ); var dueDate = new Date( calendarToDo.due.getTime() );  var tonightMidnight = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 00 );  var yesterdayMidnight = new Date( now.getFullYear(), now.getMonth(), ( now.getDate() - 1 ), 23, 59, 00 );  if( tonightMidnight.getTime() > dueDate.getTime() ) { /* for setting some css */ textProperties += " overdue"; } else if ( dueDate.getFullYear() == now.getFullYear() && dueDate.getMonth() == now.getMonth() && dueDate.getDate() == now.getDate() ) { textProperties += " duetoday"; } else { textProperties += " inprogress"; } if(calendarToDo.priority > 0 && calendarToDo.priority < 5) textProperties = textProperties + " highpriority"; if(calendarToDo.priority > 5 && calendarToDo.priority < 10) textProperties = textProperties + " lowpriority";   var FormattedStartDate = formatUnifinderEventDate( startDate ); var FormattedDueDate = formatUnifinderEventDate( dueDate );  treeCellStartdate.setAttribute( "label", FormattedStartDate ); treeCellDuedate.setAttribute( "label", FormattedDueDate ); treeCellPercentcomplete.setAttribute( "label", calendarToDo.percent + "%" ); treeCellCategories.setAttribute( "label", calendarToDo.categories );  treeItem.setAttribute( "taskitem", "true" );  treeRow.setAttribute("properties", textProperties); treeCellCompleted.setAttribute("properties", textProperties); treeCellPriority.setAttribute("properties", textProperties); treeCellTitle.setAttribute("properties", textProperties); treeCellStartdate.setAttribute("properties", textProperties); treeCellDuedate.setAttribute("properties", textProperties); treeCellCompleteddate.setAttribute("properties", textProperties); treeCellPercentcomplete.setAttribute("properties", textProperties); treeCellCategories.setAttribute("properties", textProperties);  treeRow.appendChild( treeCellCompleted ); treeRow.appendChild( treeCellPriority ); treeRow.appendChild( treeCellTitle ); treeRow.appendChild( treeCellStartdate ); treeRow.appendChild( treeCellDuedate ); treeRow.appendChild( treeCellCompleteddate ); treeRow.appendChild( treeCellPercentcomplete ); treeRow.appendChild( treeCellCategories ); treeItem.appendChild( treeRow ); 
context: function setUnifinderToDoTreeItem( treeItem, calendarToDo )   {      treeItem.toDo = calendarToDo;      treeItem.setAttribute( "toDoID", calendarToDo.id );      var treeRow = document.createElement( "treerow" );      var treeCellCompleted = document.createElement( "treecell" );      var treeCellPriority  = document.createElement( "treecell" );      var treeCellTitle     = document.createElement( "treecell" );      var treeCellStartdate = document.createElement( "treecell" );      var treeCellDuedate   = document.createElement( "treecell" );      var treeCellPercentcomplete = document.createElement( "treecell" );      var treeCellCompleteddate = document.createElement( "treecell" );      var treeCellCategories = document.createElement( "treecell" );      var now = new Date();            var thisMorning = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0 );      if(treeItem.getElementsByTagName( "treerow" )[0])        treeItem.removeChild( treeItem.getElementsByTagName( "treerow" )[0] );      var textProperties = "";      if( calendarToDo.start.getTime() <= thisMorning.getTime() )      {         //this task should be started         textProperties = textProperties + " started";      }      var completed = calendarToDo.completed.getTime();      if( completed > 0 )      {         /* for setting some css */         var completedDate = new Date( calendarToDo.completed.getTime() );         var FormattedCompletedDate = formatUnifinderEventDate( completedDate );         treeCellCompleteddate.setAttribute( "label", FormattedCompletedDate );         textProperties = textProperties + " completed";         treeItem.setAttribute( "checked", "true" );      }      else         treeCellCompleteddate.setAttribute( "label", "" );               treeCellTitle.setAttribute( "label", calendarToDo.title );      var startDate     = new Date( calendarToDo.start.getTime() );      var dueDate = new Date( calendarToDo.due.getTime() );      var tonightMidnight = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 00 );      var yesterdayMidnight = new Date( now.getFullYear(), now.getMonth(), ( now.getDate() - 1 ), 23, 59, 00 );      if( tonightMidnight.getTime() > dueDate.getTime() )      {         /* for setting some css */         textProperties += " overdue";      } else if ( dueDate.getFullYear() == now.getFullYear() &&                  dueDate.getMonth() == now.getMonth() &&                  dueDate.getDate() == now.getDate() )      {         textProperties += " duetoday";      }      else      {         textProperties += " inprogress";      }      if(calendarToDo.priority > 0 && calendarToDo.priority < 5)         textProperties = textProperties + " highpriority";      if(calendarToDo.priority > 5 && calendarToDo.priority < 10)         textProperties = textProperties + " lowpriority";      var FormattedStartDate = formatUnifinderEventDate( startDate );      var FormattedDueDate = formatUnifinderEventDate( dueDate );      treeCellStartdate.setAttribute( "label", FormattedStartDate );      treeCellDuedate.setAttribute( "label", FormattedDueDate );      treeCellPercentcomplete.setAttribute( "label", calendarToDo.percent + "%" );      treeCellCategories.setAttribute( "label", calendarToDo.categories );      treeItem.setAttribute( "taskitem", "true" );            treeRow.setAttribute("properties", textProperties);      treeCellCompleted.setAttribute("properties", textProperties);      treeCellPriority.setAttribute("properties", textProperties);      treeCellTitle.setAttribute("properties", textProperties);      treeCellStartdate.setAttribute("properties", textProperties);      treeCellDuedate.setAttribute("properties", textProperties);      treeCellCompleteddate.setAttribute("properties", textProperties);      treeCellPercentcomplete.setAttribute("properties", textProperties);      treeCellCategories.setAttribute("properties", textProperties);            treeRow.appendChild( treeCellCompleted );      treeRow.appendChild( treeCellPriority );      treeRow.appendChild( treeCellTitle );      treeRow.appendChild( treeCellStartdate );      treeRow.appendChild( treeCellDuedate );      treeRow.appendChild( treeCellCompleteddate );      treeRow.appendChild( treeCellPercentcomplete );      treeRow.appendChild( treeCellCategories );      treeItem.appendChild( treeRow );}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/d17e41996863006957f43648b6d55e5d9f2c5d6c/unifinderToDo.js/clean/calendar/resources/content/unifinderToDo.js