Checked in patches for bug 242982

This commit is contained in:
mostafah%oeone.com 2004-05-10 15:30:45 +00:00
Родитель 68438dbe11
Коммит 5bc46caa79
7 изменённых файлов: 81 добавлений и 113 удалений

Просмотреть файл

@ -906,3 +906,45 @@ CalendarView.prototype.setAllDayDrawProperties = function calView_setAllDayDrawP
}
}
}
/** PROTECTED
Common function to remove elements with attribute from DOM tree.
Works around diffences in getElementsByAttribute list between
Moz1.8+, and Moz1.7- (Moz1.8+ list contents is 'live', and changes
as elements are removed from dom, while in Moz1.7- list is not 'live').
**/
CalendarView.prototype.removeElementsByAttribute =
function calView_removeElementsByAttribute(attributeName, attributeValue)
{
var liveList = document.getElementsByAttribute(attributeName, attributeValue);
// Delete in reverse order. Moz1.8+ getElementsByAttribute list is
// 'live', so when an element is deleted the indexes of later elements
// change, but in Moz1.7- list is 'dead'. Reversed order works with both.
for (var i = liveList.length - 1; i >= 0; i--) {
var element = liveList.item(i);
if (element.parentNode != null)
element.parentNode.removeChild(element);
}
}
/** PROTECTED
Common function to clear a marker attribute from elements in DOM tree.
Works around diffences in getElementsByAttribute list between
Moz1.8+, and Moz1.7- (Moz1.8+ list contents is 'live', and changes
as attributes are removed from dom, while in Moz1.7- it is not 'live').
**/
CalendarView.prototype.removeAttributeFromElements =
function calView_removeAttributeFromElements(attributeName, attributeValue)
{
var liveList = document.getElementsByAttribute(attributeName, attributeValue);
// Delete in reverse order. Moz1.8+ getElementsByAttribute list is
// 'live', so when an attribute is deleted the indexes of later elements
// change, but in Moz1.7- list is 'dead'. Reversed order works with both.
for (var i = liveList.length - 1; i >= 0; i--) {
liveList.item(i).removeAttribute(attributeName);
}
}

Просмотреть файл

@ -119,18 +119,12 @@ DayView.prototype.refreshEvents = function dayview_refreshEvents( ) {
var allDayBox = document.getElementById( "all-day-content-box" );
var allDayLabel = document.getElementById( "all-day-content-title" );
var dayViewContent = document.getElementById( "day-view-content-box" );
var eventBoxList = document.getElementsByAttribute( "eventbox", "dayview" );
var eventBox;
//remove all the all day row -boxes from the all day content box.
while( allDayBox.hasChildNodes() )
allDayBox.removeChild( allDayBox.firstChild );
// remove eventboxes
while (eventBoxList.item(0)) {
eventBox = eventBoxList[0];
eventBox.parentNode.removeChild( eventBox );
}
this.removeElementsByAttribute("eventBox", "dayview");
// set view limits for the day
var limits = this.getViewLimits(dayEventList,this.calendarWindow.getSelectedDate());
@ -582,12 +576,7 @@ DayView.prototype.selectBoxForEvent = function dayview_selectBoxForEvent( calend
DayView.prototype.clearSelectedEvent = function dayview_clearSelectedEvent( )
{
debug("clearSelectedEvent");
var ArrayOfBoxes = document.getElementsByAttribute( "eventselected", "true" );
for( i = 0; i < ArrayOfBoxes.length; i++ )
{
ArrayOfBoxes[i].removeAttribute( "eventselected" );
}
this.removeAttributeFromElements("eventselected", "true");
}

Просмотреть файл

@ -79,13 +79,16 @@ var calendarViewDNDObserver = {
onDragStart: function (aEvent, aXferData, aDragAction){
//Clear any dragged over events left from last drag selection.
var allDraggedElements = document.getElementsByAttribute( "draggedover", "true" );
for( var i = 0; i < allDraggedElements.length; i++ )
var liveList = document.getElementsByAttribute( "draggedover", "true" );
// Delete in reverse order. Moz1.8+ getElementsByAttribute list is
// 'live', so when attribute is deleted the indexes of later elements
// change, but Moz1.7- is not. Reversed order works with both.
for (var i = liveList.length - 1; i >= 0; i--)
{
allDraggedElements[i].removeAttribute( "draggedover" );
liveList.item(i).removeAttribute( "draggedover" );
}
// select clicked object, Mozilla doens't do this.
// select clicked object, Mozilla doesn't do this.
calendarViewClick( aEvent );
// aEvent.currentTarget;
@ -380,10 +383,13 @@ var calendarViewDNDObserver = {
}
// cleanup
var allDraggedElements = document.getElementsByAttribute( "draggedover", "true" );
for( var i = 0; i < allDraggedElements.length; i++ )
var liveList = document.getElementsByAttribute( "draggedover", "true" );
// Delete in reverse order. Moz1.8+ getElementsByAttribute list is
// 'live', so when attribute is deleted the indexes of later elements
// change, but Moz1.7- is not. Reversed order works with both.
for (var i = liveList.length - 1; i >= 0; i--)
{
allDraggedElements[i].removeAttribute( "draggedover" );
liveList.item(i).removeAttribute( "draggedover" );
}
},

Просмотреть файл

@ -226,15 +226,7 @@ MonthView.prototype.refreshEvents = function monthView_refreshEvents( )
var monthEventList = gEventSource.getEventsDisplayForRange( this.firstDateOfView,this.lastDateOfView );
// remove old event boxes
var eventBoxList = document.getElementsByAttribute( "eventbox", "monthview" );
var eventBox = null;
while ( eventBoxList.item(0) )
{
eventBox = eventBoxList[ 0 ];
eventBox.parentNode.removeChild( eventBox );
}
this.removeElementsByAttribute("eventbox", "monthview");
// clear calendarEvent counts. This controls how many events are shown full, and then the rest are shown as dots.
@ -635,12 +627,7 @@ MonthView.prototype.hiliteSelectedDate = function monthView_hiliteSelectedDate(
MonthView.prototype.clearSelectedDate = function monthView_clearSelectedDate( )
{
var SelectedBoxes = document.getElementsByAttribute( "monthselected", "true" );
while( SelectedBoxes.item(0) )
{
SelectedBoxes[0].removeAttribute( "monthselected" );
}
this.removeAttributeFromElements("monthselected","true");
}
/** PUBLIC
@ -650,12 +637,7 @@ MonthView.prototype.clearSelectedDate = function monthView_clearSelectedDate( )
MonthView.prototype.clearSelectedBoxes = function monthView_clearSelectedBoxes( )
{
var SelectedBoxes = document.getElementsByAttribute( "eventselected", "true" );
while( SelectedBoxes.item(0) )
{
SelectedBoxes[0].removeAttribute( "eventselected" );
}
this.removeAttributeFromElements("eventselected","true");
}
/** PRIVATE
@ -666,12 +648,7 @@ MonthView.prototype.clearSelectedBoxes = function monthView_clearSelectedBoxes(
MonthView.prototype.hiliteTodaysDate = function monthView_hiliteTodaysDate( )
{
// Clear the old selection if there was one
var TodayBoxes = document.getElementsByAttribute( "today", "true" );
while( TodayBoxes.item(0) )
{
TodayBoxes[0].removeAttribute( "today" );
}
this.removeAttributeFromElements("today","true");
//highlight today.
var Today = new Date( );
@ -870,12 +847,7 @@ MonthView.prototype.doubleClickDay = function monthView_doubleClickDay( event )
MonthView.prototype.clearSelectedEvent = function monthView_clearSelectedEvent( )
{
debug("clearSelectedEvent");
var ArrayOfBoxes = document.getElementsByAttribute( "eventselected", "true" );
while( ArrayOfBoxes.item(0) )
{
ArrayOfBoxes[0].removeAttribute( "eventselected" );
}
this.removeAttributeFromElements("eventselected","true");
}

Просмотреть файл

@ -230,27 +230,13 @@ MultiweekView.prototype.refreshEvents = function multiweekView_refreshEvents( )
var viewEventList = gEventSource.getEventsDisplayForRange( this.firstDateOfView,this.lastDateOfView );
// remove old event boxes
var eventBoxList = document.getElementsByAttribute( "eventbox", "multiweekview" );
var eventBox = null;
while( eventBoxList.item(0) )
{
eventBox = eventBoxList[ 0 ];
eventBox.parentNode.removeChild( eventBox );
}
this.removeElementsByAttribute("eventbox", "multiweekview");
//getAllToDo's
var viewToDoList = gEventSource.getToDosForRange( this.firstDateOfView,this.lastDateOfView );
// remove old todo boxes
var toDoBoxList = document.getElementsByAttribute( "todobox", "multiweekview" );
while( toDoBoxList.item(0) )
{
eventBox = toDoBoxList[ 0 ];
eventBox.parentNode.removeChild( eventBox );
}
this.removeElementsByAttribute("todobox","multiweekview");
// clear calendarEvent counts. This controls how many events are shown full, and then the rest are shown as dots.
// count them by adding a property numEvents to the dayItem, which is zeroed here
@ -761,12 +747,7 @@ MultiweekView.prototype.hiliteSelectedDate = function multiweekView_hiliteSelect
MultiweekView.prototype.clearSelectedDate = function multiweekView_clearSelectedDate( )
{
var SelectedBoxes = document.getElementsByAttribute( "multiweekselected", "true" );
while( SelectedBoxes.item(0) )
{
SelectedBoxes[0].removeAttribute( "multiweekselected" );
}
this.removeAttributeFromElements("multiweekselected", "true");
}
@ -778,12 +759,7 @@ MultiweekView.prototype.clearSelectedDate = function multiweekView_clearSelected
MultiweekView.prototype.hiliteTodaysDate = function multiweekView_hiliteTodaysDate( )
{
// Clear the old selection if there was one
var TodayBoxes = document.getElementsByAttribute( "today", "true" );
while( TodayBoxes.item(0) )
{
TodayBoxes[0].removeAttribute( "today" );
}
this.removeAttributeFromElements("today", "true");
//highlight today.
var Today = new Date( );
@ -929,12 +905,7 @@ MultiweekView.prototype.clearSelectedEvent = function multiweekView_clearSelecte
{
debug("clearSelectedEvent");
var ArrayOfBoxes = document.getElementsByAttribute( "eventselected", "true" );
while( ArrayOfBoxes.item(0) )
{
ArrayOfBoxes[0].removeAttribute( "eventselected" );
}
this.removeAttributeFromElements("eventselected", "true");
}

Просмотреть файл

@ -573,10 +573,14 @@ function changeContextMenuForToDo( event )
if( toDoItem )
{
var ArrayOfElements = document.getElementById( "taskitem-context-menu" ).getElementsByAttribute( "checked", "true" );
for( var i = 0; i < ArrayOfElements.length; i++ )
ArrayOfElements[i].removeAttribute( "checked" );
var liveList = document.getElementById( "taskitem-context-menu" ).getElementsByAttribute( "checked", "true" );
// Delete in reverse order. Moz1.8+ getElementsByAttribute list is
// 'live', so when attribute is deleted the indexes of later elements
// change, but Moz1.7- is not. Reversed order works with both.
for (var i = liveList.length - 1; i >= 0; i-- )
{
liveList.item(i).removeAttribute( "checked" );
}
if( document.getElementById( "percent-"+toDoItem.percent+"-menuitem" ) )
{

Просмотреть файл

@ -113,11 +113,7 @@ WeekView.prototype.refreshEvents = function( )
{
this.kungFooDeathGripOnEventBoxes = new Array();
var eventBoxList = document.getElementsByAttribute( "eventbox", "weekview" );
while( eventBoxList.item(0) ) {
var eventBox = eventBoxList[ 0 ];
eventBox.parentNode.removeChild( eventBox );
}
this.removeElementsByAttribute("eventbox","weekview");
for( var dayIndex = 1; dayIndex <= 7; ++dayIndex ) {
var headerDateItem = document.getElementById( "week-header-date-" + dayIndex );
@ -487,11 +483,8 @@ WeekView.prototype.refreshDisplay = function( )
arrayOfBoxes[i].setAttribute( "weekend", "true" );
}
} else {
/* its not a weekend */
arrayOfBoxes = document.getElementsByAttribute( "day", dayIndex );
for( i = 0; i < arrayOfBoxes.length; i++ ) {
arrayOfBoxes[i].removeAttribute( "weekend" );
}
/* it's not a weekend */
this.removeAttributeFromElements("day", dayIndex);
}
// advance to next day
@ -593,10 +586,7 @@ WeekView.prototype.hiliteSelectedDate = function multiweekView_hiliteSelectedDat
WeekView.prototype.hiliteTodaysDate = function( )
{
//clear out the old today boxes.
var OldTodayArray = document.getElementsByAttribute( "today", "true" );
while ( OldTodayArray.item(0) ) {
OldTodayArray[0].removeAttribute( "today" );
}
this.removeAttributeFromElements("today","true");
// get the events for the day and loop through them
var FirstDay = new Date( gHeaderDateItemArray[1].getAttribute( "date" ) );
@ -631,10 +621,7 @@ WeekView.prototype.hiliteTodaysDate = function( )
WeekView.prototype.clearSelectedEvent = function( )
{
//Event = gCalendarWindow.getSelectedEvent();
var ArrayOfBoxes = document.getElementsByAttribute( "eventselected", "true" );
while( ArrayOfBoxes.item(0) ) {
ArrayOfBoxes[0].removeAttribute( "eventselected" );
}
this.removeAttributeFromElements("eventselected", "true");
}
/** PUBLIC
@ -658,8 +645,5 @@ WeekView.prototype.getNewEventDate = function( )
*/
WeekView.prototype.clearSelectedDate = function( )
{
var SelectedBoxes = document.getElementsByAttribute( "weekselected", "true" );
while( SelectedBoxes.item(0) ) {
SelectedBoxes[0].removeAttribute( "weekselected" );
}
this.removeAttributeFromElements("weekselected","true");
}