2002-06-27 21:59:51 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is OEone Calendar Code, released October 31st, 2001.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* OEone Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): Garth Smedley <garths@oeone.com>
|
|
|
|
* Mike Potter <mikep@oeone.com>
|
|
|
|
* Chris Charabaruk <coldacid@meldstar.com>
|
|
|
|
* Colin Phillips <colinp@oeone.com>
|
2002-07-30 23:19:50 +04:00
|
|
|
* ArentJan Banck <ajbanck@planet.nl>
|
2002-06-27 21:59:51 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------
|
|
|
|
* U N I F I N D E R
|
|
|
|
*
|
|
|
|
* This is a hacked in interface to the unifinder. We will need to
|
|
|
|
* improve this to make it usable in general.
|
|
|
|
*/
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
const ToDoUnifinderTreeName = "unifinder-todo-tree";
|
2002-06-27 21:59:51 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Observer for the calendar event data source. This keeps the unifinder
|
|
|
|
* display up to date when the calendar event data is changed
|
|
|
|
*/
|
|
|
|
|
|
|
|
var unifinderToDoDataSourceObserver =
|
|
|
|
{
|
|
|
|
onLoad : function()
|
|
|
|
{
|
2002-08-27 16:34:47 +04:00
|
|
|
toDoUnifinderRefresh();
|
2002-06-27 21:59:51 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
onStartBatch : function()
|
|
|
|
{
|
|
|
|
},
|
|
|
|
|
|
|
|
onEndBatch : function()
|
|
|
|
{
|
2002-08-27 16:34:47 +04:00
|
|
|
toDoUnifinderRefresh();
|
2002-06-27 21:59:51 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
onAddItem : function( calendarToDo )
|
|
|
|
{
|
2002-08-27 16:34:47 +04:00
|
|
|
toDoUnifinderRefresh();
|
2002-06-27 21:59:51 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
onModifyItem : function( calendarToDo, originalToDo )
|
|
|
|
{
|
2002-07-30 23:19:50 +04:00
|
|
|
toDoUnifinderItemUpdate( calendarToDo );
|
2002-06-27 21:59:51 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
onDeleteItem : function( calendarToDo )
|
|
|
|
{
|
2002-08-27 16:34:47 +04:00
|
|
|
toDoUnifinderRefresh();
|
2002-06-27 21:59:51 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
onAlarm : function( calendarToDo )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the calendar is loaded
|
|
|
|
*/
|
|
|
|
|
|
|
|
function prepareCalendarToDoUnifinder( )
|
|
|
|
{
|
|
|
|
// set up our calendar event observer
|
|
|
|
gICalLib.addTodoObserver( unifinderToDoDataSourceObserver );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the calendar is unloaded
|
|
|
|
*/
|
|
|
|
|
|
|
|
function finishCalendarToDoUnifinder( )
|
|
|
|
{
|
|
|
|
gICalLib.removeTodoObserver( unifinderToDoDataSourceObserver );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by event observers to update the display
|
|
|
|
*/
|
|
|
|
|
2002-08-27 16:34:47 +04:00
|
|
|
function toDoUnifinderRefresh()
|
2002-06-27 21:59:51 +04:00
|
|
|
{
|
2002-07-24 17:19:34 +04:00
|
|
|
var Checked = document.getElementById( "only-completed-checkbox" ).checked;
|
|
|
|
|
|
|
|
if( Checked === true )
|
|
|
|
{
|
|
|
|
var now = new Date();
|
|
|
|
|
|
|
|
gICalLib.filter.completed.setTime( now );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gICalLib.resetFilter()
|
|
|
|
}
|
|
|
|
|
2002-06-27 21:59:51 +04:00
|
|
|
var eventTable = gEventSource.getAllToDos();
|
|
|
|
|
|
|
|
refreshToDoTree( eventTable );
|
|
|
|
}
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
function unifinderToDoHasFocus()
|
|
|
|
{
|
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
|
|
|
return( tree.treeBoxObject.focused );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getToDoFromEvent( event )
|
|
|
|
{
|
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
|
|
|
var row = new Object();
|
|
|
|
|
|
|
|
tree.treeBoxObject.getCellAt( event.clientX, event.clientY, row, {}, {} );
|
|
|
|
|
|
|
|
if( row.value != -1 && row.value < tree.view.rowCount )
|
|
|
|
{
|
|
|
|
var treeitem = tree.treeBoxObject.view.getItemAtIndex( row.value );
|
|
|
|
var todoId = treeitem.getAttribute("toDoID");
|
|
|
|
return gICalLib.fetchTodo( todoId );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getSelectedToDo()
|
|
|
|
{
|
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
|
|
|
// .toDo object sometimes isn't available?
|
|
|
|
var todoId = tree.contentView.getItemAtIndex(tree.currentIndex).getAttribute("toDoID");
|
|
|
|
return gICalLib.fetchTodo( todoId );
|
|
|
|
}
|
|
|
|
|
2002-06-27 21:59:51 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is attached to the onclik attribute of the events shown in the unifinder
|
|
|
|
*/
|
|
|
|
|
|
|
|
function unifinderClickToDo( event )
|
|
|
|
{
|
2002-08-02 18:54:26 +04:00
|
|
|
// only change checkbox on left mouse-button click
|
|
|
|
if( event.button != 0)
|
|
|
|
return;
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
|
|
|
var ThisToDo = getToDoFromEvent( event );
|
|
|
|
var row = new Object();
|
|
|
|
var childElt = { };
|
|
|
|
var colID = { };
|
|
|
|
tree.treeBoxObject.getCellAt( event.clientX, event.clientY, row, colID, childElt );
|
|
|
|
|
|
|
|
if( colID.value == "unifinder-todo-tree-col-completed" && childElt.value == "image" )
|
|
|
|
{
|
|
|
|
var treeitem = tree.treeBoxObject.view.getItemAtIndex( row.value );
|
|
|
|
var isChecked = treeitem.getAttribute( "checked" );
|
|
|
|
if( isChecked )
|
|
|
|
treeitem.removeAttribute( "checked" )
|
|
|
|
else
|
|
|
|
treeitem.setAttribute(" checked", true );
|
|
|
|
checkboxClick( ThisToDo, !isChecked )
|
2002-07-30 23:19:50 +04:00
|
|
|
}
|
2002-06-27 21:59:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is attached to the onclik attribute of the to do list shown in the unifinder
|
|
|
|
*/
|
|
|
|
|
|
|
|
function unifinderDoubleClickToDo( event )
|
|
|
|
{
|
2002-08-02 18:54:26 +04:00
|
|
|
//open the edit todo dialog box
|
2002-07-31 19:02:35 +04:00
|
|
|
var ThisToDo = getToDoFromEvent( event );
|
|
|
|
if( ThisToDo )
|
2002-08-02 18:54:26 +04:00
|
|
|
editToDo( ThisToDo );
|
|
|
|
}
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-08-02 18:54:26 +04:00
|
|
|
/**
|
|
|
|
* Set the context menu on mousedown to change it before it is opened
|
|
|
|
*/
|
|
|
|
|
|
|
|
function unifinderMouseDownToDo( event )
|
|
|
|
{
|
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
|
|
|
var treechildren = tree.getElementsByTagName( "treechildren" )[0];
|
|
|
|
|
|
|
|
var ThisToDo = getToDoFromEvent( event );
|
|
|
|
if( ThisToDo )
|
|
|
|
{
|
|
|
|
if(event.button == 2)
|
|
|
|
treechildren.setAttribute("context", "taskitem-context-menu")
|
|
|
|
|
|
|
|
// TODO HACK notifiers should be rewritten to integrate events and todos
|
|
|
|
document.getElementById( "delete_command" ).removeAttribute( "disabled" );
|
|
|
|
document.getElementById( "delete_command_no_confirm" ).removeAttribute( "disabled" );
|
2002-08-16 00:14:46 +04:00
|
|
|
document.getElementById( "print_command" ).setAttribute( "disabled", "true" );
|
2002-08-02 18:54:26 +04:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
if(event.button == 2)
|
|
|
|
treechildren.setAttribute("context", "context-menu");
|
|
|
|
tree.treeBoxObject.selection.clearSelection();
|
|
|
|
|
|
|
|
// TODO HACK notifiers should be rewritten to integrate events and todos
|
|
|
|
document.getElementById( "delete_command" ).setAttribute( "disabled", "true" );
|
|
|
|
document.getElementById( "delete_command_no_confirm" ).setAttribute( "disabled", "true" );
|
2002-08-16 00:14:46 +04:00
|
|
|
// printing tasks not supported
|
|
|
|
document.getElementById( "print_command" ).setAttribute( "disabled", "true" );
|
2002-08-02 18:54:26 +04:00
|
|
|
}
|
2002-06-27 21:59:51 +04:00
|
|
|
}
|
|
|
|
|
2002-07-30 23:19:50 +04:00
|
|
|
/**
|
2002-07-31 19:02:35 +04:00
|
|
|
* Delete the current selected item with focus from the ToDo unifinder list
|
2002-07-30 23:19:50 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
function unifinderDeleteToDoCommand( DoNotConfirm )
|
|
|
|
{
|
2002-07-31 19:02:35 +04:00
|
|
|
// TODO Implement Confirm
|
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
2002-08-02 18:54:26 +04:00
|
|
|
if (tree.treeBoxObject.selection.count > 0)
|
|
|
|
{
|
|
|
|
var treeitem = tree.treeBoxObject.view.getItemAtIndex( tree.currentIndex );
|
|
|
|
if(treeitem)
|
|
|
|
{
|
|
|
|
var todoId = treeitem.getAttribute("toDoID");
|
|
|
|
gICalLib.deleteTodo( todoId );
|
|
|
|
}
|
|
|
|
}
|
2002-07-30 23:19:50 +04:00
|
|
|
}
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
function checkboxClick( ThisToDo, completed )
|
2002-06-27 21:59:51 +04:00
|
|
|
{
|
2002-07-30 23:19:50 +04:00
|
|
|
// var ThisToDo = event.currentTarget.parentNode.parentNode.toDo;
|
2002-07-31 19:02:35 +04:00
|
|
|
if( completed )
|
2002-06-27 21:59:51 +04:00
|
|
|
{
|
|
|
|
var completedTime = new Date();
|
|
|
|
|
|
|
|
ThisToDo.completed.setTime( completedTime );
|
2002-07-25 18:26:22 +04:00
|
|
|
|
|
|
|
ThisToDo.status = ThisToDo.ICAL_STATUS_COMPLETED;
|
|
|
|
|
2002-06-27 21:59:51 +04:00
|
|
|
}
|
|
|
|
else
|
2002-07-25 18:26:22 +04:00
|
|
|
{
|
2002-06-27 21:59:51 +04:00
|
|
|
ThisToDo.completed.clear();
|
|
|
|
|
2002-07-25 18:26:22 +04:00
|
|
|
if( ThisToDo.percent == 0 )
|
|
|
|
ThisToDo.status = ThisToDo.ICAL_STATUS_NEEDSACTION;
|
|
|
|
else
|
|
|
|
ThisToDo.status = ThisToDo.ICAL_STATUS_INPROCESS;
|
|
|
|
}
|
2002-06-27 21:59:51 +04:00
|
|
|
gICalLib.modifyTodo( ThisToDo );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2002-07-30 23:19:50 +04:00
|
|
|
* Attach the calendarToDo event to the treeitem
|
2002-06-27 21:59:51 +04:00
|
|
|
*/
|
|
|
|
|
2002-07-30 23:19:50 +04:00
|
|
|
function setUnifinderToDoTreeItem( treeItem, calendarToDo )
|
2002-06-27 21:59:51 +04:00
|
|
|
{
|
|
|
|
treeItem.toDo = calendarToDo;
|
2002-07-31 19:02:35 +04:00
|
|
|
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" );
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-07-05 22:41:18 +04:00
|
|
|
var now = new Date();
|
|
|
|
|
|
|
|
var thisMorning = new Date( now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0 );
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
if(treeItem.getElementsByTagName( "treerow" )[0])
|
|
|
|
treeItem.removeChild( treeItem.getElementsByTagName( "treerow" )[0] );
|
2002-07-30 23:19:50 +04:00
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
var textProperties = "";
|
2002-07-05 22:41:18 +04:00
|
|
|
if( calendarToDo.start.getTime() <= thisMorning.getTime() )
|
|
|
|
{
|
|
|
|
//this task should be started
|
2002-07-31 19:02:35 +04:00
|
|
|
textProperties = textProperties + " started";
|
2002-07-05 22:41:18 +04:00
|
|
|
}
|
|
|
|
|
2002-06-27 21:59:51 +04:00
|
|
|
var completed = calendarToDo.completed.getTime();
|
|
|
|
|
|
|
|
if( completed > 0 )
|
2002-07-02 17:52:07 +04:00
|
|
|
{
|
|
|
|
/* for setting some css */
|
2002-08-02 18:54:26 +04:00
|
|
|
var completedDate = new Date( calendarToDo.completed.getTime() );
|
|
|
|
var FormattedCompletedDate = formatUnifinderEventDate( completedDate );
|
|
|
|
|
|
|
|
treeCellCompleteddate.setAttribute( "label", FormattedCompletedDate );
|
2002-07-31 19:02:35 +04:00
|
|
|
textProperties = textProperties + " completed";
|
|
|
|
treeItem.setAttribute( "checked", "true" );
|
2002-07-02 17:52:07 +04:00
|
|
|
}
|
2002-08-02 18:54:26 +04:00
|
|
|
else
|
|
|
|
treeCellCompleteddate.setAttribute( "label", "" );
|
|
|
|
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
treeCellTitle.setAttribute( "label", calendarToDo.title );
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
var startDate = new Date( calendarToDo.start.getTime() );
|
2002-06-27 21:59:51 +04:00
|
|
|
var dueDate = new Date( calendarToDo.due.getTime() );
|
2002-07-02 17:52:07 +04:00
|
|
|
|
2002-08-26 22:47:22 +04:00
|
|
|
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 );
|
2002-07-05 22:41:18 +04:00
|
|
|
|
2002-08-16 17:34:44 +04:00
|
|
|
if( tonightMidnight.getTime() > dueDate.getTime() )
|
2002-07-02 17:52:07 +04:00
|
|
|
{
|
|
|
|
/* for setting some css */
|
2002-08-26 22:47:22 +04:00
|
|
|
textProperties += " overdue";
|
|
|
|
} else if ( dueDate.getFullYear() == now.getFullYear() &&
|
|
|
|
dueDate.getMonth() == now.getMonth() &&
|
|
|
|
dueDate.getDate() == now.getDate() )
|
|
|
|
{
|
|
|
|
textProperties += " duetoday";
|
|
|
|
}
|
|
|
|
else
|
2002-07-31 19:02:35 +04:00
|
|
|
{
|
2002-08-26 22:47:22 +04:00
|
|
|
textProperties += " inprogress";
|
2002-07-02 17:52:07 +04:00
|
|
|
}
|
2002-07-31 19:02:35 +04:00
|
|
|
if(calendarToDo.priority > 0 && calendarToDo.priority < 5)
|
|
|
|
textProperties = textProperties + " highpriority";
|
|
|
|
if(calendarToDo.priority > 5 && calendarToDo.priority < 10)
|
|
|
|
textProperties = textProperties + " lowpriority";
|
2002-07-02 17:52:07 +04:00
|
|
|
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
var FormattedStartDate = formatUnifinderEventDate( startDate );
|
|
|
|
var FormattedDueDate = formatUnifinderEventDate( dueDate );
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
treeCellStartdate.setAttribute( "label", FormattedStartDate );
|
|
|
|
treeCellDuedate.setAttribute( "label", FormattedDueDate );
|
2002-08-02 18:54:26 +04:00
|
|
|
treeCellPercentcomplete.setAttribute( "label", calendarToDo.percent + "%" );
|
2002-07-31 19:02:35 +04:00
|
|
|
treeCellCategories.setAttribute( "label", calendarToDo.categories );
|
2002-06-27 21:59:51 +04:00
|
|
|
|
|
|
|
treeItem.setAttribute( "taskitem", "true" );
|
2002-07-31 19:02:35 +04:00
|
|
|
|
|
|
|
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 );
|
2002-07-30 23:19:50 +04:00
|
|
|
}
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
|
2002-07-30 23:19:50 +04:00
|
|
|
/**
|
|
|
|
* Redraw the categories unifinder tree
|
|
|
|
*/
|
|
|
|
|
|
|
|
function refreshToDoTree( eventArray )
|
|
|
|
{
|
|
|
|
// get the old tree children item and remove it
|
|
|
|
|
2002-08-02 18:54:26 +04:00
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
2002-07-30 23:19:50 +04:00
|
|
|
|
|
|
|
var elementsToRemove = document.getElementsByAttribute( "taskitem", "true" );
|
|
|
|
|
|
|
|
|
|
|
|
for( var i = 0; i < elementsToRemove.length; i++ )
|
|
|
|
{
|
|
|
|
elementsToRemove[i].parentNode.removeChild( elementsToRemove[i] );
|
|
|
|
}
|
|
|
|
|
|
|
|
// add: tree item, row, cell, box and text items for every event
|
|
|
|
for( var index = 0; index < eventArray.length; ++index )
|
|
|
|
{
|
|
|
|
var calendarToDo = eventArray[ index ];
|
|
|
|
|
|
|
|
// make the items
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
var treeItem = document.createElement( "treeitem" );
|
2002-07-30 23:19:50 +04:00
|
|
|
|
|
|
|
setUnifinderToDoTreeItem( treeItem, calendarToDo );
|
2002-06-27 21:59:51 +04:00
|
|
|
|
2002-08-02 18:54:26 +04:00
|
|
|
tree.getElementsByTagName( "treechildren" )[0]. appendChild( treeItem );
|
2002-06-27 21:59:51 +04:00
|
|
|
}
|
2002-07-30 23:19:50 +04:00
|
|
|
}
|
|
|
|
|
2002-07-31 19:02:35 +04:00
|
|
|
|
2002-07-30 23:19:50 +04:00
|
|
|
/**
|
|
|
|
* Redraw a single item of the ToDo unifinder tree
|
|
|
|
*/
|
|
|
|
|
|
|
|
function toDoUnifinderItemUpdate( calendarToDo )
|
|
|
|
{
|
2002-08-02 18:54:26 +04:00
|
|
|
var tree = document.getElementById( ToDoUnifinderTreeName );
|
2002-07-30 23:19:50 +04:00
|
|
|
|
|
|
|
var elementsToRemove = document.getElementsByAttribute( "taskitem", "true" );
|
|
|
|
|
|
|
|
for( var i = 0; i < elementsToRemove.length; i++ )
|
|
|
|
{
|
2002-07-31 19:02:35 +04:00
|
|
|
if(elementsToRemove[i].getAttribute("toDoID") == calendarToDo.id)
|
2002-07-30 23:19:50 +04:00
|
|
|
{
|
|
|
|
setUnifinderToDoTreeItem( elementsToRemove[i], calendarToDo );
|
|
|
|
}
|
|
|
|
}
|
2002-06-27 21:59:51 +04:00
|
|
|
}
|
2002-08-22 18:33:32 +04:00
|
|
|
|
|
|
|
|
2002-08-26 19:20:53 +04:00
|
|
|
function contextChangePriority( Priority, event )
|
2002-08-22 18:33:32 +04:00
|
|
|
{
|
|
|
|
if (tree.treeBoxObject.selection.count > 0)
|
|
|
|
{
|
|
|
|
var treeitem = tree.treeBoxObject.view.getItemAtIndex( tree.currentIndex );
|
|
|
|
if(treeitem)
|
|
|
|
{
|
|
|
|
var todoId = treeitem.getAttribute("toDoID");
|
2002-08-26 19:20:53 +04:00
|
|
|
var ToDoItem = gICalLib.fetchToDo( todoId );
|
|
|
|
ToDoItem.priority = Priority;
|
2002-08-22 18:33:32 +04:00
|
|
|
gICalLib.modifyTodo( ToDoItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-26 19:20:53 +04:00
|
|
|
function contextChangePriority( Priority, event )
|
2002-08-22 18:33:32 +04:00
|
|
|
{
|
|
|
|
if (tree.treeBoxObject.selection.count > 0)
|
|
|
|
{
|
|
|
|
var treeitem = tree.treeBoxObject.view.getItemAtIndex( tree.currentIndex );
|
|
|
|
if(treeitem)
|
|
|
|
{
|
|
|
|
var todoId = treeitem.getAttribute("toDoID");
|
2002-08-26 19:20:53 +04:00
|
|
|
var ToDoItem = gICalLib.fetchToDo( todoId );
|
2002-08-22 18:33:32 +04:00
|
|
|
ToDoItem.priority = Priority;
|
|
|
|
gICalLib.modifyTodo( ToDoItem );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|