Functions | Variables

/home/ivan/src/sit/branches/3.x/calendar/week_planner.js.php File Reference

Go to the source code of this file.

Functions

 trimString (sInString)
 editEventWindow (e, inputDiv)
 setElementActive (e, inputDiv)
 setElement_txt (id, text)
 setElement_color (id, color)
 setElementInactive (inputDiv)
 parseItemsFromServer (ajaxIndex)
 updateAppointmentProperties (id)
 getYPositionFromTime (hour, minute)
 getItemsFromServer ()
 getCurrentTimeDiv (inputObj)
 getCurrentAppointmentContentDiv (inputDiv)
 getAppointmentDate (inputObj)
 getTimeAsArray (inputObj)
 getTime (inputObj)
 initNewAppointment (e, inputObj)
 timerNewAppointment ()
 initResizeAppointment (e)
 timerResizeAppointment ()
 initMoveAppointment (e, inputObj)
 timerMoveAppointment ()
 getMinute (topPos)
 schedulerMouseMove (e)
 repositionFooter (inputDiv)
 transferTextAreaContent (e, inputObj, discardContentUpdate)
 saveAnItemToServer_complete (index, oldId)
 clearAppointments ()
 saveAnItemToServer (inputId)
 ffEndEdit (e)
 initToggleView (e)
 timerToggleView ()
 copyOptions (elselect)
 toggleAppointmentView (e, inputObj)
 keyboardEventTextarea (e)
 createNewAppointmentDiv (leftPos, topPos, width, contentHTML, height, readonly)
 schedulerMouseUp ()
 autoResizeAppointment ()
 deleteEventFromView (index)
 schedulerKeyboardEvent (e)
 getTopPos (inputObj)
 getLeftPos (inputObj)
 cancelSelectionEvent (e)
 initWeekScheduler ()
 displayPreviousWeek ()
 refreshAppointments ()
 displayNextWeek ()
 updateHeaderDates ()
 initialise ()
 getSelectedActivity ()
 showhideActivityRows (start, show)
 addActivity (id, name, optionvalue, editvalue)
 repositionFieldset ()
 toggleMode ()
 appendOption (el, text, value)
 activityChange (level, type)
 submitTimesheet ()
 retrievePreviousActivities ()
 retrievePreviousActivitiesCallback (newid)

Variables

 $permission = 27
 $headerdisplayed = 1
 $user = clean_int($_REQUEST['user'])
but start later
but start example
 weekScheduler_container = false
 weekScheduler_appointments = false
 newAppointmentCounter = -1
 moveAppointmentCounter = -1
 resizeAppointmentCounter = -1
 resizeAppointmentInitHeight = false
 el_x
 el_y
 mouse_x
 mouse_y
 elWidth
 currentAppointmentDiv = false
 currentAppointmentContentDiv = false
 currentTimeDiv = false
 appointmentsOffsetTop = false
 appointmentsOffsetLeft = false
 currentZIndex = 20000
 dayPositionArray = new Array()
 dayDateArray = new Array()
 weekSchedule_ajaxObjects = new Array()
 dateStartOfWeek = false
 newAppointmentWidth = false
 startIdOfNewItems = 500000000
 contentEditInProgress = false
 toggleViewCounter = -1
 objectToToggle = false
 currentEditableTextArea = false
 appointmentProperties = new Array()
 opera = navigator.userAgent.toLowerCase().indexOf('opera')>=0?true:false
 activeEventObj
 activityEntries = new Array()
 activityCount = 0
window onload = initWeekScheduler

Function Documentation

activityChange ( level  ,
type   
)

Definition at line 1241 of file week_planner.js.php.

References appendOption(), showhideActivityRows(), and type.

{
    showhideActivityRows(level + 1, 0)
    if (type == 'select')
    {
        for (var i = (level/1 + 1); i < 4; i ++)
        {
            while ($('addactivityselect' + i).length > 0)
            {
                $('addactivityselect' + i).remove(0);
            }
            appendOption($('addactivityselect' + i), '', '');
        }
        //alert($('addactivityselect' + level).options[$('addactivityselect' + level).selectedIndex].value);
        $('newactivity' + level).value = $('addactivityselect' + level).options[$('addactivityselect' + level).selectedIndex].value;
        if ($('addactivityselect' + level).value != '')
        {
            activityTypes[$('addactivityselect0').value](level);
        }
    }
    else
    {
        // TODO edit boxes
    }
}

addActivity ( id  ,
name  ,
optionvalue  ,
editvalue   
)

Definition at line 1138 of file week_planner.js.php.

References getSelectedActivity(), id, name, repositionFieldset(), and showhideActivityRows().

Referenced by retrievePreviousActivitiesCallback().

{
    activitycount ++;
    if (name == 0) name = getSelectedActivity();
    if (id == 0) id = $('newactivityalias').value;
    var newtr = document.createElement('tr');
    var newtd1 = document.createElement('td');
    var newtd2 = document.createElement('td');
    var newtd3 = document.createElement('td');
    var newli = document.createElement('li');
    var newselect = document.createElement('select');
    var newoption1 = document.createElement('option');
    var newoption2 = document.createElement('option');
    var newoption3 = document.createElement('option');
    var newedit = document.createElement('input');

    newli.id = name;
    newli.innerHTML = id;
    new dojo.dnd.HtmlDragSource(newli, 'p');
    activityEntries[activitycount] = newli;

    newtd1.appendChild(newli);

    newoption1.value = '-1';
    if (optionvalue == '-1') newoption1.selected = true;
    newoption1.innerHTML = 'Behind schedule';
    newoption2.value = '0';
    if (optionvalue == '0') newoption2.selected = true;
    newoption2.innerHTML = 'On schedule';
    newoption3.value = '1';
    if (optionvalue == '1') newoption3.selected = true;
    newoption3.innerHTML = 'Ahead of schedule';

    newselect.id = 'activityschedule' + activitycount;
    newselect.appendChild(newoption1);
    newselect.appendChild(newoption2);
    newselect.appendChild(newoption3);

    newtd2.appendChild(newselect);

    newedit.type='text';
    newedit.id='activityedit' + activitycount;
    newedit.width=255;
    newedit.style.width = '400px';

    newtd3.appendChild(newedit);

    newtr.appendChild(newtd1);
    newtr.appendChild(newtd2);
    newtr.appendChild(newtd3);

    var activitytable = $('activitytable');
    var activitytbody = activitytable.getElementsByTagName('tbody')[0];
    activitytbody.appendChild(newtr);
    showhideActivityRows(1, 0);
    $('addactivityselect0').selectedIndex=0;
    repositionFieldset();
}

appendOption ( el  ,
text  ,
value   
)

Definition at line 1226 of file week_planner.js.php.

Referenced by activityChange(), and copyOptions().

{
    var newoption = document.createElement('option');
    newoption.text = text;
    newoption.value = value;
    try
    {
        el.add(newoption, null);
    }
    catch(e)
    {
        el.add(newoption);
    }
}

autoResizeAppointment (  ) 

Definition at line 896 of file week_planner.js.php.

References getMinute(), getTime(), getTopPos(), and height.

Referenced by parseItemsFromServer(), and schedulerMouseUp().

{
    var tmpPos = getTopPos(currentAppointmentDiv) - appointmentsOffsetTop + currentAppointmentDiv.offsetHeight;
    var startPos = tmpPos;

    var minute = getMinute(tmpPos);

    var rest = (minute % snapToMinutes);
    var height = currentAppointmentDiv.style.height.replace('px','')/1;

    if (rest>(snapToMinutes/2)){
        tmpPos = tmpPos + snapToMinutes - (minute % snapToMinutes);
    }else{
        tmpPos = tmpPos - (minute % snapToMinutes);
    }

    var minute = getMinute(tmpPos);
    if ((minute % snapToMinutes)!=0){
        tmpPos = tmpPos - (minute % snapToMinutes);
    }
    var minute = getMinute(tmpPos);
    if ((minute % snapToMinutes)!=0){
        tmpPos = tmpPos - (minute % snapToMinutes);
    }

    currentAppointmentDiv.style.height = (height + tmpPos - startPos) + 'px';
    currentTimeDiv.innerHTML = '<span>' + getTime(currentAppointmentDiv) + '</span>';

}

cancelSelectionEvent (  ) 

Definition at line 975 of file week_planner.js.php.

References event.

{
    if (document.all)e = event;

    if (e.target) source = e.target;
        else if (e.srcElement) source = e.srcElement;
        if (source.nodeType == 3) // defeat Safari bug
            source = source.parentNode;
    if (source.tagName.toLowerCase()=='input' || source.tagName.toLowerCase()=='select')return true;

    return false;

}

clearAppointments (  ) 

Definition at line 600 of file week_planner.js.php.

Referenced by displayNextWeek(), displayPreviousWeek(), and refreshAppointments().

{
    for (var prop in appointmentProperties)
    {
        if (appointmentProperties[prop]['id'])
        {
            if ($(appointmentProperties[prop]['id']))
            {
                var obj = $(appointmentProperties[prop]['id']);
                obj.parentNode.removeChild(obj);
            }
            appointmentProperties[prop]['id'] = false;
        }
    }
    appointmentProperties = new Array();
}

copyOptions ( elselect   ) 

Definition at line 683 of file week_planner.js.php.

References appendOption().

Referenced by createNewAppointmentDiv(), and toggleAppointmentView().

{
    while (elselect.length > 0)
    {
        elselect.remove(0);
    }
    appendOption(elselect, '', '');

    for (var i = 1; i <= activitycount; i ++)
    {
        appendOption(elselect, activityEntries[i].innerHTML, activityEntries[i].id);
    }
}

createNewAppointmentDiv ( leftPos  ,
topPos  ,
width  ,
contentHTML  ,
height  ,
readonly   
)

Definition at line 759 of file week_planner.js.php.

References copyOptions(), height, span, textarea, and width.

Referenced by parseItemsFromServer(), and timerNewAppointment().

{
    var div = document.createElement('DIV');
    div.onclick = setElementActive;
    if (!readonly) div.ondblclick = initToggleView;
    div.className='weekScheduler_anAppointment';
    div.style.left = leftPos + 'px';
    div.style.top = topPos + 'px';
    div.style.width = width + 'px';
    if (!readonly) div.onmousedown = initToggleView;
    if (height)div.style.height = height + 'px';
    var timeDiv = document.createElement('DIV');
    timeDiv.className='weekScheduler_appointment_time';
    timeDiv.innerHTML = '<span></span>';
    div.appendChild(timeDiv);
    var header = document.createElement('DIV');
    header.className= 'weekScheduler_appointment_header';
    header.innerHTML = '<span></span>';
    if (!readonly) header.onmousedown = initMoveAppointment;
    header.style.cursor = 'move';
    div.appendChild(header);
    var span = document.createElement('DIV');
    var innerSpan = document.createElement('SPAN');
    innerSpan.innerHTML = '<span style="float:right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;</span>' + contentHTML;
    span.appendChild(innerSpan);
    span.className = 'weekScheduler_appointment_txt';
    div.appendChild(span);
    var textarea = document.createElement('SELECT');
    copyOptions(textarea);
    textarea.className='weekScheduler_appointment_textarea';
    textarea.style.height='16px';
    textarea.style.display='none';
    textarea.onblur = transferTextAreaContent;
    textarea.onchange = transferTextAreaContent;
    textarea.onkeyup = keyboardEventTextarea;
    div.appendChild(textarea);
    var colorCodeDiv = document.createElement('DIV');
    colorCodeDiv.className='weekScheduler_appointment_colorCodes';
    div.appendChild(colorCodeDiv);
    var footerDiv = document.createElement('DIV');
    footerDiv.className='weekScheduler_appointment_footer';
    footerDiv.style.cursor = 'n-resize';
    footerDiv.innerHTML = '<span></span>';
    if (!readonly) footerDiv.onmousedown = initResizeAppointment;
    div.appendChild(footerDiv);
    weekScheduler_appointments.appendChild(div);
    return div;
}

deleteEventFromView ( index   ) 

Definition at line 926 of file week_planner.js.php.

References index.

Referenced by schedulerKeyboardEvent().

{
    if (weekSchedule_ajaxObjects[index].response=='OK'){
        activeEventObj.parentNode.removeChild(activeEventObj);
        activeEventObj = false;
    }else{
        // Error handling - event not deleted

        alert('Could not confirm that event has been deleted. Make sure that the script is configured correctly');
    }
}

displayNextWeek (  ) 

Definition at line 1062 of file week_planner.js.php.

References clearAppointments(), getItemsFromServer(), and updateHeaderDates().

{
    var tmpTime = dateStartOfWeek.getTime();
    tmpTime = tmpTime + (1000*60*60*24*7);
    dateStartOfWeek.setTime(tmpTime);
    updateHeaderDates();
    clearAppointments();
    getItemsFromServer();
}

displayPreviousWeek (  ) 

Definition at line 1043 of file week_planner.js.php.

References clearAppointments(), getItemsFromServer(), and updateHeaderDates().

{
    var tmpTime = dateStartOfWeek.getTime();
    tmpTime = tmpTime - (1000*60*60*24*7);
    dateStartOfWeek.setTime(tmpTime);

    updateHeaderDates();
    clearAppointments();
    getItemsFromServer();
}

editEventWindow ( ,
inputDiv   
)

Definition at line 131 of file week_planner.js.php.

Referenced by saveAnItemToServer_complete().

{
    if (!inputDiv)inputDiv = this;
    if (!popupWindowUrl)return;
    if (inputDiv.id.indexOf('new_')>=0)return;



    var editEvent = window.open(popupWindowUrl + '?id=' + inputDiv.id,'editEvent','width=500,height=500,status=no');
    editEvent.focus();
}

ffEndEdit (  ) 

Definition at line 644 of file week_planner.js.php.

{
    if (!currentEditableTextArea)return;
    if (e.target) source = e.target;
        else if (e.srcElement) source = e.srcElement;
        if (source.nodeType == 3) // defeat Safari bug
            source = source.parentNode;
    if (source.tagName.toLowerCase()!='select')currentEditableTextArea.blur();
}

getAppointmentDate ( inputObj   ) 

Definition at line 312 of file week_planner.js.php.

References getLeftPos().

Referenced by updateAppointmentProperties().

{
    var leftPos = getLeftPos(inputObj);

    var d = new Date();
    var tmpTime = dateStartOfWeek.getTime();
    tmpTime = tmpTime + (1000*60*60*24 * Math.floor((leftPos-appointmentsOffsetLeft) / (dayPositionArray[1] - dayPositionArray[0])));
    d.setTime(tmpTime);
    return d;


}

getCurrentAppointmentContentDiv ( inputDiv   ) 

Definition at line 304 of file week_planner.js.php.

Referenced by initMoveAppointment(), initResizeAppointment(), parseItemsFromServer(), and timerNewAppointment().

{
    var divs = inputDiv.getElementsByTagName('DIV');
    for (var no = 0;no < divs.length; no++){
        if (divs[no].className=='weekScheduler_appointment_txt')return divs[no];
    }
}

getCurrentTimeDiv ( inputObj   ) 

Definition at line 294 of file week_planner.js.php.

Referenced by parseItemsFromServer(), timerMoveAppointment(), timerNewAppointment(), and timerResizeAppointment().

{
    var subDivs = inputObj.getElementsByTagName('DIV');
    for (var no=0; no < subDivs.length; no++){
        if (subDivs[no].className=='weekScheduler_appointment_time'){
            return subDivs[no];
        }
    }
}

getItemsFromServer (  ) 

Definition at line 282 of file week_planner.js.php.

References parseItemsFromServer(), and sack().

Referenced by displayNextWeek(), displayPreviousWeek(), initWeekScheduler(), and refreshAppointments().

{
    if (dateStartOfWeek != false)
    {
        var ajaxIndex = weekSchedule_ajaxObjects.length;
        weekSchedule_ajaxObjects[ajaxIndex] = new sack();
        weekSchedule_ajaxObjects[ajaxIndex].requestFile = externalSourceFile_items  + '?year=' + dateStartOfWeek.getFullYear() + '&month=' + (dateStartOfWeek.getMonth()/1+1) + '&day=' + dateStartOfWeek.getDate() + '&user=' + user;  // Specifying which file to get
        weekSchedule_ajaxObjects[ajaxIndex].onCompletion = function(){ parseItemsFromServer(ajaxIndex); };  // Specify function that will be executed after file has been found
        weekSchedule_ajaxObjects[ajaxIndex].runAJAX();      // Execute AJAX function
    }
}

getLeftPos ( inputObj   ) 

Definition at line 965 of file week_planner.js.php.

Referenced by getAppointmentDate(), initMoveAppointment(), initNewAppointment(), initResizeAppointment(), and initWeekScheduler().

{
var returnValue = inputObj.offsetLeft;
while((inputObj = inputObj.offsetParent) != null){
    if (inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
}
return returnValue;
}

getMinute ( topPos   ) 

Definition at line 487 of file week_planner.js.php.

References time.

Referenced by autoResizeAppointment(), schedulerMouseUp(), and timerNewAppointment().

{
    var time = (topPos) / (itemRowHeight+1);
    var hour = Math.floor(time);
    var minute = Math.floor((time - hour) *60);
    return minute;
}

getSelectedActivity (  ) 

Definition at line 1115 of file week_planner.js.php.

References data.

Referenced by addActivity().

{
    var data = '';
    for (var i = 0; i < 4; i ++)
    {
        data = data + $('newactivity' + i).value + '|';
    }
    return data;
}

getTime ( inputObj   ) 

Definition at line 339 of file week_planner.js.php.

References getTopPos().

Referenced by autoResizeAppointment(), countUp(), parseItemsFromServer(), sack(), schedulerMouseMove(), and schedulerMouseUp().

{
    var startTime = (getTopPos(inputObj) - appointmentsOffsetTop) / (itemRowHeight+1) + weekplannerStartHour;

    if (startTime>23) startTime = startTime - 24;
    var startHour = Math.floor(startTime);
    var hourPrefix = '';
    if (startHour< 10) hourPrefix = "0";
    var startMinute = Math.floor((startTime - startHour) *60);
    var startMinutePrefix = '';
    if (startMinute < 10) startMinutePrefix="0";

    var endTime = (getTopPos(inputObj) + inputObj.offsetHeight - appointmentsOffsetTop) / (itemRowHeight+1) + weekplannerStartHour;
    if (endTime > 23) endTime = endTime - 24;
    var endHour = Math.floor(endTime);

    var endHourPrefix = '';
    if (endHour < 10) endHourPrefix = "0";
    var endMinute = Math.floor((endTime - endHour) * 60);
    var endMinutePrefix = '';
    if (endMinute < 10) endMinutePrefix = "0";


    return hourPrefix + startHour + ':' + startMinutePrefix + "" + startMinute + '-' + endHourPrefix + endHour + ':' + endMinutePrefix + "" +  endMinute;

}

getTimeAsArray ( inputObj   ) 

Definition at line 325 of file week_planner.js.php.

References getTopPos().

Referenced by updateAppointmentProperties().

{
    var startTime = (getTopPos(inputObj) - appointmentsOffsetTop) / (itemRowHeight+1) + weekplannerStartHour;
    if (startTime>23)startTime = startTime - 24;
    var startHour = Math.floor(startTime);
    var startMinute = Math.floor((startTime - startHour) *60);
    var endTime = (getTopPos(inputObj) + inputObj.offsetHeight - appointmentsOffsetTop) / (itemRowHeight+1) + weekplannerStartHour;
    if (endTime>23)endTime = endTime - 24;
    var endHour = Math.floor(endTime);
    var endMinute = Math.floor((endTime - endHour) *60);
    return Array(startHour,startMinute,endHour,endMinute);
}

getTopPos ( inputObj   ) 

Definition at line 956 of file week_planner.js.php.

Referenced by autoResizeAppointment(), getTime(), getTimeAsArray(), initMoveAppointment(), initNewAppointment(), initResizeAppointment(), initWeekScheduler(), repositionFieldset(), and schedulerMouseUp().

{
var returnValue = inputObj.offsetTop;
while((inputObj = inputObj.offsetParent) != null){
    if (inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
}
return returnValue;
}

getYPositionFromTime ( hour  ,
minute   
)

Definition at line 278 of file week_planner.js.php.

Referenced by parseItemsFromServer().

                                          {
    return Math.floor((hour - weekplannerStartHour) * (itemRowHeight+1) + (minute/60 * (itemRowHeight+1)));
}

initialise (  ) 

Definition at line 1098 of file week_planner.js.php.

                      {
    var ds = $('dropsources');
    var s = ds.getElementsByTagName('li');
    for (var x = 0; x < s.length; x++)
    {
        new dojo.dnd.HtmlDragSource(s[x], 'p');
    }

    var tg;
    var t = new Array();
    for (x = 1; x <= 7; x++)
    {
        tg = $('drop' + x);
        t[x] = new salford.dnd.DestDropTarget(tg, ['p']);
    }
}

initMoveAppointment ( ,
inputObj   
)

Definition at line 453 of file week_planner.js.php.

References event, getCurrentAppointmentContentDiv(), getLeftPos(), getTopPos(), and timerMoveAppointment().

{
    if (document.all)e = event;
    if (!inputObj)inputObj = this.parentNode;
    currentAppointmentDiv = inputObj;
    currentAppointmentContentDiv = getCurrentAppointmentContentDiv(currentAppointmentDiv);
    currentZIndex = currentZIndex + 1;
    currentAppointmentDiv.style.zIndex = currentZIndex;
    moveAppointmentCounter = 0;
    el_x = getLeftPos(inputObj);
    el_y = getTopPos(inputObj);
    elWidth = inputObj.offsetWidth;
    mouse_x = e.clientX;
    mouse_y = e.clientY;
    timerMoveAppointment();
    return false;
}

initNewAppointment ( ,
inputObj   
)

Definition at line 366 of file week_planner.js.php.

References event, getLeftPos(), getTopPos(), and timerNewAppointment().

{
    if (document.all)e = event;
    if (!inputObj)inputObj = this;
    newAppointmentCounter = 0;
    el_x = getLeftPos(inputObj);
    el_y = getTopPos(inputObj);
    elWidth = inputObj.offsetWidth;

    mouse_x = e.clientX;
    mouse_y = e.clientY;
    timerNewAppointment();

    return false;
}

initResizeAppointment (  ) 
initToggleView (  ) 

Definition at line 654 of file week_planner.js.php.

References event, and timerToggleView().

{
    if (document.all) e = event;
    if (e.target) source = e.target;
    else if (e.srcElement) source = e.srcElement;
    if (source.nodeType == 3) source = source.parentNode;

    if (source.className && source.className != 'weekScheduler_appointment_txt' && source.className != 'weekScheduler_anAppointment') return;

    toggleViewCounter = 0;
    objectToToggle = this;
    timerToggleView();
}

initWeekScheduler (  ) 

Definition at line 988 of file week_planner.js.php.

References getItemsFromServer(), getLeftPos(), getTopPos(), time, and updateHeaderDates().

{
    weekScheduler_container = $('weekScheduler_container');
    if (!document.all)weekScheduler_container.onclick = ffEndEdit;
    weekScheduler_appointments = $('weekScheduler_appointments');
    var subDivs = weekScheduler_appointments.getElementsByTagName('DIV');
    for (var no = 0; no < subDivs.length; no ++){
        if (subDivs[no].className=='weekScheduler_appointmentHour')
        {
            subDivs[no].onmousedown = initNewAppointment;

            if (!newAppointmentWidth)newAppointmentWidth = subDivs[no].offsetWidth;
        }
        if (subDivs[no].className=='weekScheduler_appointments_day'){
            dayPositionArray[dayPositionArray.length] = getLeftPos(subDivs[no]);
        }

    }
    if (initTopHour > weekplannerStartHour) $('weekScheduler_content').scrollTop = ((initTopHour - weekplannerStartHour)*(itemRowHeight+1));

    //  initTopHour
    appointmentsOffsetTop = getTopPos(weekScheduler_appointments);
    // appointmentsOffsetLeft = 2 - appointmentMarginSize;
    appointmentsOffsetLeft = 17 - appointmentMarginSize; // not sure why this has changed?

    document.documentElement.onmousemove = schedulerMouseMove;
    document.documentElement.onselectstart = cancelSelectionEvent;
    document.documentElement.onmouseup = schedulerMouseUp;
    document.documentElement.onkeydown = schedulerKeyboardEvent;

    var tmpDate = new Date();
    var dateItems = initDateToShow.split(/\-/g);
    tmpDate.setFullYear(dateItems[0]);
    tmpDate.setDate(dateItems[2]/1);
    tmpDate.setMonth(dateItems[1]/1-1);
    tmpDate.setHours(1);
    tmpDate.setMinutes(0);
    tmpDate.setSeconds(0);

    var day = tmpDate.getDay();
    if (day==0)day=7;
    if (day>1){
        var time = tmpDate.getTime();
        time = time - (1000*60*60*24) * (day-1);
        tmpDate.setTime(time);
    }
    dateStartOfWeek = new Date(tmpDate);

    updateHeaderDates();

    if (externalSourceFile_items){
        getItemsFromServer();
    }
}

keyboardEventTextarea (  ) 

Definition at line 751 of file week_planner.js.php.

References event, and transferTextAreaContent().

{
    if (document.all)e = event;
    if (e.keyCode==27){ // Escape key
        transferTextAreaContent(false,this,true);
    }
}

parseItemsFromServer ( ajaxIndex   ) 

Definition at line 183 of file week_planner.js.php.

References autoResizeAppointment(), createNewAppointmentDiv(), getCurrentAppointmentContentDiv(), getCurrentTimeDiv(), getTime(), getYPositionFromTime(), items, n, and trimString().

Referenced by getItemsFromServer().

{
    var itemsToBeCreated = new Array();
    var items = weekSchedule_ajaxObjects[ajaxIndex].response.split(/<item>/g);
    weekSchedule_ajaxObjects[ajaxIndex] = false;
    for (var no = 1; no < items.length; no++){
        var lines = items[no].split(/\n/g);
        itemsToBeCreated[no] = new Array();
        for (var no2 = 0; no2 < lines.length; no2 ++){
            var key = lines[no2].replace(/<([^>]+)>.*/g,'$1');
            if (key)key = trimString(key);
            var pattern = new RegExp("<\/?" + key + ">","g");
            var value = lines[no2].replace(pattern,'');
            value = trimString(value);
            if (key=='eventStartDate' || key=='eventEndDate'){
                var d = new Date(value);
                value = d;
            }

            itemsToBeCreated[no][key] = value;
        }
        if (itemsToBeCreated[no]['id']){
            var dayDiff = itemsToBeCreated[no]['eventStartDate'].getTime() - dateStartOfWeek.getTime();
            dayDiff = Math.floor(dayDiff / (1000*60*60*24));
            el_x = dayPositionArray[dayDiff];
            topPos = getYPositionFromTime(itemsToBeCreated[no]['eventStartDate'].getHours(),itemsToBeCreated[no]['eventStartDate'].getMinutes());

            var elHeight = (itemsToBeCreated[no]['eventEndDate'].getTime() - itemsToBeCreated[no]['eventStartDate'].getTime()) / (60 * 60*1000);
            elHeight = Math.round((elHeight * (itemRowHeight + 1)) - 2);

            var readonly = 0;
            if (itemsToBeCreated[no]['completion'] != 0) readonly = 1;
            currentAppointmentDiv = createNewAppointmentDiv((el_x - appointmentsOffsetLeft),topPos,(newAppointmentWidth-(appointmentMarginSize*2)),itemsToBeCreated[no]['description'],elHeight,readonly);
            currentAppointmentDiv.id = itemsToBeCreated[no]['id'];
            currentZIndex = currentZIndex + 1;
            currentAppointmentDiv.style.zIndex = currentZIndex;
            currentTimeDiv = getCurrentTimeDiv(currentAppointmentDiv);
            currentTimeDiv.style.display='block';

            if (itemsToBeCreated[no]['bgColorCode'] && itemsToBeCreated[no]['bgColorCode'].match(/^#[0-9A-F]{6}$/)){
                currentAppointmentDiv.style.backgroundColor = itemsToBeCreated[no]['bgColorCode'];
            }

            currentAppointmentContentDiv  = getCurrentAppointmentContentDiv(currentAppointmentDiv);
            currentAppointmentContentDiv.style.height = (elHeight-20) + 'px';

            currentTimeDiv.innerHTML = '<span>' + getTime(currentAppointmentDiv) + '</span>';
            autoResizeAppointment();

            currentAppointmentDiv = false;
            currentTimeDiv = false;

            var newIndex = itemsToBeCreated[no]['id'];
            appointmentProperties[newIndex] = new Array();
            appointmentProperties[newIndex]['id'] = itemsToBeCreated[no]['id'];
            appointmentProperties[newIndex]['description'] = itemsToBeCreated[no]['description'];
            appointmentProperties[newIndex]['bgColorCode'] = itemsToBeCreated[no]['bgColorCode'];
            appointmentProperties[newIndex]['eventStartDate'] = itemsToBeCreated[no]['eventStartDate'];
            appointmentProperties[newIndex]['eventEndDate'] = itemsToBeCreated[no]['eventEndDate'];
            appointmentProperties[newIndex]['completion'] = itemsToBeCreated[no]['completion'];
            appointmentProperties[newIndex]['object'] = currentAppointmentDiv;
        }
    }

refreshAppointments (  ) 
repositionFieldset (  ) 

Definition at line 1197 of file week_planner.js.php.

References getTopPos(), and style.

Referenced by addActivity(), and toggleMode().

{
    var newPos = 0;
    el_id = $('leftdiv');
    while( el_id != null )
    {
        newPos += el_id.offsetTop;
        el_id = el_id.offsetParent;
    }
    $('addremove').style.top = (newPos + $('leftdiv').offsetHeight - 7) + 'px';
    $('addremove').style.left = ($('leftdiv').offsetLeft + 400) + 'px';
    $('addremove').style.width = ($('leftdiv').offsetWidth - 400) + 'px';
    appointmentsOffsetTop = getTopPos(weekScheduler_appointments);
}

repositionFooter ( inputDiv   ) 

Definition at line 532 of file week_planner.js.php.

Referenced by schedulerMouseUp(), and transferTextAreaContent().

{
    var subDivs = inputDiv.getElementsByTagName('DIV');
    for (var no = 0; no < subDivs.length; no ++){
        if (subDivs[no].className=='weekScheduler_appointment_footer')
        {
            subDivs[no].style.bottom = '-1px';
        }
    }
}

retrievePreviousActivities (  ) 

Definition at line 1292 of file week_planner.js.php.

References refreshAppointments(), retrievePreviousActivitiesCallback(), and sack().

{
    var ajaxIndex = weekSchedule_ajaxObjects.length;
    weekSchedule_ajaxObjects[ajaxIndex] = new sack();
    weekSchedule_ajaxObjects[ajaxIndex].requestFile = 'calendar/planner_schedule_getprevious.php' + '?user=' + user;
    weekSchedule_ajaxObjects[ajaxIndex].onCompletion = function(){ refreshAppointments(retrievePreviousActivitiesCallback(ajaxIndex)); };
    weekSchedule_ajaxObjects[ajaxIndex].runAJAX();
}

retrievePreviousActivitiesCallback ( newid   ) 

Definition at line 1301 of file week_planner.js.php.

References addActivity(), items, n, and trimString().

Referenced by retrievePreviousActivities().

{
    var items = weekSchedule_ajaxObjects[newid].response.split(/<item>/g);
    weekSchedule_ajaxObjects[newid] = false;
    activities = new Array();
    for (var i = 1; i < items.length; i ++)
    {
        var lines = items[i].split(/\n/g);
        //alert(lines);
        for (var j = 0; j < lines.length; j ++)
        {
            var key = lines[j].replace(/<([^>]+)>.*/g,'$1');
            if (key) key = trimString(key);
            var pattern = new RegExp('<\\/?' + key + '>', 'g');
            var value = lines[j].replace(pattern,'');
            value = trimString(value);
            activities[key] = value;
        }
        if (activities['id'] != '')
            addActivity(activities['name'], activities['id'], activities['optionvalue'], activities['editvalue']);
    }
}

saveAnItemToServer ( inputId   ) 

Definition at line 617 of file week_planner.js.php.

References escape, indexOf, sack(), saveAnItemToServer_complete(), and updateAppointmentProperties().

Referenced by schedulerMouseUp(), transferTextAreaContent(), and updateAppointmentProperties().

{
    if (appointmentProperties[inputId]['completion'] === undefined || appointmentProperties[inputId]['completion'] < 2)
    {
        if (!appointmentProperties[inputId]['description']) appointmentProperties[inputId]['description']='';
        if (!appointmentProperties[inputId]['bgColorCode']) appointmentProperties[inputId]['bgColorCode']='';
        if (!appointmentProperties[inputId]['eventStartDate']) updateAppointmentProperties(inputId);

        var saveString = "?saveAnItem=true&id=" + appointmentProperties[inputId]['id']
        + '&name=' + escape(appointmentProperties[inputId]['name'])
        + '&description=' + escape(appointmentProperties[inputId]['description'])
        + '&eventStartDate=' + appointmentProperties[inputId]['eventStartDate'].toGMTString().replace('UTC','GMT')
        + '&eventEndDate=' + appointmentProperties[inputId]['eventEndDate'].toGMTString().replace('UTC','GMT')
        + '&user=' + user;

        if (appointmentProperties[inputId]['id'].indexOf('new_') >= 0){
            saveString = saveString + '&newItem=1';
        }

        var ajaxIndex = weekSchedule_ajaxObjects.length;
        weekSchedule_ajaxObjects[ajaxIndex] = new sack();
        weekSchedule_ajaxObjects[ajaxIndex].requestFile = externalSourceFile_save  + saveString;
        weekSchedule_ajaxObjects[ajaxIndex].onCompletion = function(){ saveAnItemToServer_complete(ajaxIndex,appointmentProperties[inputId]['id']); };  // Specify function that will be executed after file has been found
        weekSchedule_ajaxObjects[ajaxIndex].runAJAX();
    }
}

saveAnItemToServer_complete ( index  ,
oldId   
)

Definition at line 586 of file week_planner.js.php.

References editEventWindow(), and index.

Referenced by saveAnItemToServer().

{
    if (oldId.indexOf('new_') >= 0)
    {
        appointmentProperties[oldId]['id'] = weekSchedule_ajaxObjects[index].response;
        appointmentProperties[oldId]['object'].id = weekSchedule_ajaxObjects[index].response.replace(/\s/g,'');
        appointmentProperties[weekSchedule_ajaxObjects[index].response] = appointmentProperties[oldId];
        weekSchedule_ajaxObjects[index] = false;
        if (!inlineTextAreaEnabled){
            editEventWindow(false,appointmentProperties[oldId]['object']);
        }
    }
}

schedulerKeyboardEvent (  ) 

Definition at line 939 of file week_planner.js.php.

References deleteEventFromView(), event, and sack().

                                  {
    if (document.all)e = event;
    // TODO: check if the appointment can be cancelled or not (holidays, training, etc. cannot be cancelled from here)
    if (e.keyCode==46 && activeEventObj)
    {
        if (confirm(txt_deleteEvent))
        {
            var ajaxIndex = weekSchedule_ajaxObjects.length;
            weekSchedule_ajaxObjects[ajaxIndex] = new sack();
            weekSchedule_ajaxObjects[ajaxIndex].requestFile = externalSourceFile_delete  + '?eventToDeleteId=' + activeEventObj.id;
            weekSchedule_ajaxObjects[ajaxIndex].onCompletion = function(){ deleteEventFromView(ajaxIndex); };   // Specify function that will be executed after file has been found
            weekSchedule_ajaxObjects[ajaxIndex].runAJAX();      // Execute AJAX function
        }
    }
}

schedulerMouseMove (  ) 

Definition at line 496 of file week_planner.js.php.

References event, and getTime().

{
    if (document.all)e = event;

    if (newAppointmentCounter == 10)
    {
        if (!currentAppointmentDiv) return;
        var tmpHeight = e.clientY - mouse_y;
        currentAppointmentDiv.style.height = Math.max(20,tmpHeight) + 'px';
        currentTimeDiv.innerHTML = '<span>' + getTime(currentAppointmentDiv) + '</span>';
    }

    if (moveAppointmentCounter == 10)
    {
        var topPos = (e.clientY - mouse_y + el_y - appointmentsOffsetTop);
        currentAppointmentDiv.style.top = topPos + 'px';
        var destinationLeftPos = false;
        for (var no = 0;no < dayPositionArray.length; no ++)
        {
            if (e.clientX>dayPositionArray[no])destinationLeftPos = dayPositionArray[no];
        }

        // currentAppointmentDiv.style.left = (destinationLeftPos + appointmentMarginSize -2) + 'px';
        currentAppointmentDiv.style.left = (destinationLeftPos + appointmentMarginSize - 17) + 'px';

        currentTimeDiv.innerHTML = '<span>' + getTime(currentAppointmentDiv) + '</span>';
    }

    if (resizeAppointmentCounter==10){
        currentAppointmentContentDiv.style.height = (Math.max((resizeAppointmentInitHeight + e.clientY - mouse_y),10)-8) + 'px';
        currentAppointmentDiv.style.height = Math.max((resizeAppointmentInitHeight + e.clientY - mouse_y),10) + 'px';
        currentTimeDiv.innerHTML = '<span>' + getTime(currentAppointmentDiv) + '</span>';
    }

}

schedulerMouseUp (  ) 

Definition at line 810 of file week_planner.js.php.

References autoResizeAppointment(), getMinute(), getTime(), getTopPos(), repositionFooter(), saveAnItemToServer(), and updateAppointmentProperties().

{
    if (newAppointmentCounter >= 0)
    {
        if (newAppointmentCounter == 10)
        {
            if (!currentAppointmentDiv) return;
            if (inlineTextAreaEnabled)
            {
                var spans = currentAppointmentDiv.getElementsByTagName('DIV');
                for (var no = 0;no < spans.length; no++)
                {
                    if (spans[no].className == 'weekScheduler_appointment_txt')
                    {
                        spans[no].style.display='none';
                    }

                    if (spans[no].className == 'weekScheduler_appointment_footer')
                    {
                        spans[no].style.display='none';
                    }

                    if (spans[no].className == 'weekScheduler_appointment_time')
                    {
                        spans[no].style.display='none';
                    }
                }
                var ta = currentAppointmentDiv.getElementsByTagName('SELECT')[0];
                ta.style.width = (currentAppointmentDiv.clientWidth - 6) + 'px';
                ta.style.height = (currentAppointmentDiv.offsetHeight-14) + 'px';
                ta.style.display='inline';
                ta.focus();
            }
            else
            {
                saveAnItemToServer(currentAppointmentDiv.id);
            }
        }
    }
    if (snapToMinutes && currentAppointmentDiv && moveAppointmentCounter == 10)
    {
        topPos = getTopPos(currentAppointmentDiv) - appointmentsOffsetTop;

        var minute = getMinute(topPos);
        var rest = (minute % snapToMinutes);
        if (rest>(snapToMinutes/2)){
            topPos = topPos + (snapToMinutes/60*(itemRowHeight+1)) - ((rest/60)*(itemRowHeight+1));
        }else{
            topPos = topPos - ((rest/60)*(itemRowHeight+1));
        }
        var minute = getMinute(topPos);
        var rest = (minute % snapToMinutes);
        if (rest!=0){
            topPos = topPos - ((rest/60)*(itemRowHeight+1));
        }

        var minute = getMinute(topPos);
        var rest = (minute % snapToMinutes);
        if (rest!=0){
            topPos = topPos - ((rest/60)*(itemRowHeight+1));
        }
        currentAppointmentDiv.style.top = topPos + 'px';
        currentTimeDiv.innerHTML = '<span>' + getTime(currentAppointmentDiv) + '</span>';
    }

    if (currentAppointmentDiv && snapToMinutes && (resizeAppointmentCounter==10 || newAppointmentCounter)){
        autoResizeAppointment();
    }


    if (currentAppointmentDiv && !contentEditInProgress){
        repositionFooter(currentAppointmentDiv);
        updateAppointmentProperties(currentAppointmentDiv.id);
    }
    //if (currentTimeDiv)currentTimeDiv.style.display='none';



    currentAppointmentDiv = false;
    currentTimeDiv = false;
    moveAppointmentCounter = -1;
    resizeAppointmentCounter = -1;
    newAppointmentCounter = -1;
    toggleViewCounter = -1;
}

setElement_color ( id  ,
color   
)

Definition at line 167 of file week_planner.js.php.

References color, id, and style.

{
    $(id).style.backgroundColor=color;
    appointmentProperties[id]['bgColorCode'] = color;
}

setElement_txt ( id  ,
text   
)

Definition at line 160 of file week_planner.js.php.

References id, and transferTextAreaContent().

{
    var ta = $(id).getElementsByTagName('SELECT')[0]
    ta.value = text;
    transferTextAreaContent(false,ta);
}

setElementActive ( ,
inputDiv   
)

Definition at line 144 of file week_planner.js.php.

References setElementInactive().

{
    if (!inputDiv)inputDiv = this;
    var subDivs = inputDiv.getElementsByTagName('DIV');
    for (var no=0; no < subDivs.length;no++){
        if (subDivs[no].className=='weekScheduler_appointment_header'){
            subDivs[no].className = 'weekScheduler_appointment_headerActive';
        }
    }

    if (activeEventObj && activeEventObj!=inputDiv){
        setElementInactive(activeEventObj);
    }
    activeEventObj = inputDiv;
}

setElementInactive ( inputDiv   ) 

Definition at line 173 of file week_planner.js.php.

Referenced by setElementActive().

{
    var subDivs = inputDiv.getElementsByTagName('DIV');
    for (var no=0; no < subDivs.length; no++){
        if (subDivs[no].className=='weekScheduler_appointment_headerActive'){
            subDivs[no].className = 'weekScheduler_appointment_header';
        }
    }
}

showhideActivityRows ( start  ,
show   
)

Definition at line 1125 of file week_planner.js.php.

References show.

Referenced by activityChange(), and addActivity().

{
    if (show) display = 'table-row';
    else display = 'none';

    for (var i = start / 1; i < 4; i ++)
    {
    $('addactivitydescription' + i).parentNode.parentNode.style.display = display;
    $('addactivitydescription' + i).innerHTML = '';
    $('newactivity' + i).value = '';
    }
}

submitTimesheet (  ) 

Definition at line 1267 of file week_planner.js.php.

References data, refreshAppointments(), and sack().

{
    var data = '';
    for ( var i = 1; i <= activitycount; i ++ )
    {
        if ($('activityschedule' + i).value == -1)
        {
            if ($('activityedit' + i).value == '')
            {
                alert('You must fill in the comments field for behind schedule entries');
                return false;
            }
        }
        data = data + activityEntries[i].id + '~';
        data = data + $('activityschedule' + i).value + '~';
        data = data + dateStartOfWeek.getTime() + '~';
        data = data + $('activityedit' + i).value + '^';
    }
    var ajaxIndex = weekSchedule_ajaxObjects.length;
    weekSchedule_ajaxObjects[ajaxIndex] = new sack();
    weekSchedule_ajaxObjects[ajaxIndex].requestFile = 'calendar/planner_schedule_submit.php?data=' + data + '&user=' + user;
    weekSchedule_ajaxObjects[ajaxIndex].onCompletion = function(){ refreshAppointments(); };
    weekSchedule_ajaxObjects[ajaxIndex].runAJAX();
}

timerMoveAppointment (  ) 

Definition at line 471 of file week_planner.js.php.

References getCurrentTimeDiv(), and setTimeout.

Referenced by initMoveAppointment().

timerNewAppointment (  ) 

Definition at line 382 of file week_planner.js.php.

References createNewAppointmentDiv(), getCurrentAppointmentContentDiv(), getCurrentTimeDiv(), getMinute(), and setTimeout.

Referenced by initNewAppointment().

{
    if (newAppointmentCounter >= 0 && newAppointmentCounter < 10)
    {
        newAppointmentCounter = newAppointmentCounter + 1;
        setTimeout('timerNewAppointment()', 30);
        return;
    }
    if (newAppointmentCounter == 10)
    {
        if (initMinutes)
        {
            var topPos = mouse_y - appointmentsOffsetTop + document.documentElement.scrollTop + $('weekScheduler_content').scrollTop;
            topPos = topPos - (getMinute(topPos) % initMinutes);
            var rest = (getMinute(topPos) % initMinutes);
            if (rest!=0) topPos = topPos - (getMinute(topPos) % initMinutes);
        }
        else
        {
            var topPos = (el_y - appointmentsOffsetTop);
        }

        currentAppointmentDiv = createNewAppointmentDiv((el_x - appointmentsOffsetLeft),topPos,(elWidth-(appointmentMarginSize*2)),'');
        currentAppointmentDiv.id = 'new_' + startIdOfNewItems;
        appointmentProperties[currentAppointmentDiv.id] = new Array();
        appointmentProperties[currentAppointmentDiv.id]['description'] = '';
        appointmentProperties[currentAppointmentDiv.id]['object'] = currentAppointmentDiv;
        appointmentProperties[currentAppointmentDiv.id]['id'] = currentAppointmentDiv.id;
        startIdOfNewItems++;
        currentAppointmentContentDiv  = getCurrentAppointmentContentDiv(currentAppointmentDiv);
        currentZIndex = currentZIndex + 1;
        currentAppointmentDiv.style.zIndex = currentZIndex;
        currentAppointmentDiv.style.height='20px';
        currentTimeDiv = getCurrentTimeDiv(currentAppointmentDiv);
        currentTimeDiv.style.display='block';
    }
}

timerResizeAppointment (  ) 

Definition at line 437 of file week_planner.js.php.

References getCurrentTimeDiv(), and setTimeout.

Referenced by initResizeAppointment().

timerToggleView (  ) 

Definition at line 668 of file week_planner.js.php.

References setTimeout, and toggleAppointmentView().

Referenced by initToggleView().

toggleAppointmentView ( ,
inputObj   
)

Definition at line 697 of file week_planner.js.php.

References copyOptions(), event, and transferTextAreaContent().

Referenced by timerToggleView().

{
    if (document.all) e = event;

    if (!inlineTextAreaEnabled) return;

    if (!inputObj) inputObj = this;

    if (e)
    {
        if (e.target) source = e.target;
        else if (e.srcElement) source = e.srcElement;

        if (source.nodeType == 3) source = source.parentNode;
        if (source.tagName.toLowerCase() == 'select') return;
        if (contentEditInProgress && source.tagName == 'DIV')
        {
            transferTextAreaContent(false, currentAppointmentDiv.getElementsByTagName('SELECT')[0]);
            return;
        }
        if (source.className && source.className != 'weekScheduler_anAppointment' && source.className != 'weekScheduler_appointment_txt') return;
    }


    currentAppointmentDiv = inputObj;
    var spans = inputObj.getElementsByTagName('DIV');
    var tmpValue = '';
    for (var no=0; no < spans.length; no ++){
        if (spans[no].className=='weekScheduler_appointment_txt')
        {
            spans[no].style.display='none';
            tmpValue = appointmentProperties[inputObj.id]['description'];
        }
        if (spans[no].className=='weekScheduler_appointment_footer')
        {
            spans[no].style.display='none';
        }
        if (spans[no].className=='weekScheduler_appointment_time'){
            spans[no].style.display='none';
        }
    }

    var ta = currentAppointmentDiv.getElementsByTagName('SELECT')[0];
    ta.style.width = (currentAppointmentDiv.clientWidth - 6) + 'px';
//  ta.style.height = (currentAppointmentDiv.offsetHeight-14) + 'px';
    ta.style.top = '400px';
    copyOptions(ta);
    ta.style.display='inline';
    ta.value = tmpValue;
    contentEditInProgress = true;
    currentEditableTextArea = ta;
    ta.focus();
}

toggleMode (  ) 

Definition at line 1212 of file week_planner.js.php.

References repositionFieldset().

{
    repositionFieldset();
    $('addremove').toggle();
    if ($('addtogbutton').value == '<?php echo $strAdd?>' + ' ⇓')
    {
        $('addtogbutton').value = '<?php echo $strAdd?>' + ' ⇑';
    }
    else
    {
        $('addtogbutton').value = '<?php echo $strAdd?>' + ' ⇓';
    }
}

transferTextAreaContent ( ,
inputObj  ,
discardContentUpdate   
)

Definition at line 546 of file week_planner.js.php.

References repositionFooter(), and saveAnItemToServer().

Referenced by keyboardEventTextarea(), setElement_txt(), and toggleAppointmentView().

{
    if (!inputObj) inputObj = this;
    inputObj.style.display='none';
    var spans = inputObj.parentNode.getElementsByTagName('DIV');
    for (var no = 0; no < spans.length; no ++){
        if (spans[no].className == 'weekScheduler_appointment_txt')
        {
            if ( (!discardContentUpdate) )
            {
            //alert('value is ' + inputObj.options[inputObj.selectedIndex].value);
            //alert('text is ' + inputObj.options[inputObj.selectedIndex].text);
                appointmentProperties[inputObj.parentNode.id]['name'] = inputObj.value;
                appointmentProperties[inputObj.parentNode.id]['description'] = inputObj.options[inputObj.selectedIndex].text;
                spans[no].innerHTML = '<span style="float:right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;</span>' + inputObj.options[inputObj.selectedIndex].text;
            }
            spans[no].style.display='block';
        }

        if (spans[no].className=='weekScheduler_appointment_footer')
        {
            spans[no].style.display='block';
        }

        if (spans[no].className=='weekScheduler_appointment_time')
        {
            spans[no].style.display='block';
        }
    }
    contentEditInProgress = false;
    currentEditableTextArea = false;
    repositionFooter(inputObj.parentNode);

    if (instantSave && appointmentProperties[inputObj.parentNode.id]['description'].length > 0)
    {
        saveAnItemToServer(inputObj.parentNode.id);
    }

}

trimString ( sInString   ) 

Definition at line 126 of file week_planner.js.php.

Referenced by parseItemsFromServer(), and retrievePreviousActivitiesCallback().

                               {
sInString = sInString.replace( /^\s+/g, "" );
return sInString.replace( /\s+$/g, "" );
}

updateAppointmentProperties ( id   ) 

Definition at line 250 of file week_planner.js.php.

References getAppointmentDate(), getTimeAsArray(), id, and saveAnItemToServer().

Referenced by saveAnItemToServer(), and schedulerMouseUp().

{
    var obj = $(id);
    var timeArray = getTimeAsArray(obj);
    var startDate = getAppointmentDate(obj);
    var endDate = new Date();
    endDate.setTime(startDate.getTime());

    startDate.setHours(timeArray[0]);
    startDate.setMinutes(timeArray[1]);

    endDate.setHours(timeArray[2]);
    endDate.setMinutes(timeArray[3]);

    /*
    var startDateString = startDate.toGMTString().replace('UTC','GMT');
    var endDateString = endDate.toGMTString().replace('UTC','GMT');
    */
    appointmentProperties[obj.id]['eventStartDate'] = startDate;
    appointmentProperties[obj.id]['eventEndDate'] = endDate;

    if (instantSave && appointmentProperties[obj.id]['description'].length>0){
        saveAnItemToServer(obj.id);
    }


}

updateHeaderDates (  ) 

Definition at line 1072 of file week_planner.js.php.

References time.

Referenced by displayNextWeek(), displayPreviousWeek(), and initWeekScheduler().

{
    var weekScheduler_dayRow = $('weekScheduler_dayRow');
    var subDivs = weekScheduler_dayRow.getElementsByTagName('DIV');
    var tmpDate2 = new Date(dateStartOfWeek);


    for (var no=0;no < subDivs.length;no++){
        var year = tmpDate2.getFullYear(); // + 1900;
        var month = tmpDate2.getMonth()/1 + 1;
        var date = tmpDate2.getDate();
        var tmpHeaderFormat = " " + headerDateFormat;
        tmpHeaderFormat = tmpHeaderFormat.replace('d',date);
        tmpHeaderFormat = tmpHeaderFormat.replace('m',month);
        tmpHeaderFormat = tmpHeaderFormat.replace('y',year);

        subDivs[no].getElementsByTagName('SPAN')[0].innerHTML = tmpHeaderFormat;

        dayDateArray[no] = month + '|' + date;

        var time = tmpDate2.getTime();
        time = time + (1000*60*60*24);
        tmpDate2.setTime(time);
    }
}


Variable Documentation

$headerdisplayed = 1

Definition at line 16 of file week_planner.js.php.

Referenced by html_redirect().

$permission = 27

Definition at line 14 of file week_planner.js.php.

$user = clean_int($_REQUEST['user'])

Definition at line 23 of file week_planner.js.php.

Definition at line 120 of file week_planner.js.php.

Definition at line 124 of file week_planner.js.php.

activityEntries = new Array()

Definition at line 122 of file week_planner.js.php.

appointmentProperties = new Array()

Definition at line 117 of file week_planner.js.php.

Definition at line 99 of file week_planner.js.php.

Definition at line 98 of file week_planner.js.php.

Definition at line 112 of file week_planner.js.php.

Definition at line 95 of file week_planner.js.php.

Definition at line 94 of file week_planner.js.php.

Definition at line 115 of file week_planner.js.php.

currentTimeDiv = false

Definition at line 96 of file week_planner.js.php.

currentZIndex = 20000

Definition at line 101 of file week_planner.js.php.

dateStartOfWeek = false

Definition at line 108 of file week_planner.js.php.

dayDateArray = new Array()

Definition at line 104 of file week_planner.js.php.

dayPositionArray = new Array()

Definition at line 103 of file week_planner.js.php.

Definition at line 88 of file week_planner.js.php.

Definition at line 89 of file week_planner.js.php.

Definition at line 92 of file week_planner.js.php.

but start example

Definition at line 28 of file week_planner.js.php.

but start later

Definition at line 28 of file week_planner.js.php.

Definition at line 90 of file week_planner.js.php.

Definition at line 91 of file week_planner.js.php.

Definition at line 84 of file week_planner.js.php.

Definition at line 83 of file week_planner.js.php.

Definition at line 109 of file week_planner.js.php.

objectToToggle = false

Definition at line 114 of file week_planner.js.php.

window onload = initWeekScheduler

Definition at line 1324 of file week_planner.js.php.

opera = navigator.userAgent.toLowerCase().indexOf('opera')>=0?true:false

Definition at line 118 of file week_planner.js.php.

Definition at line 85 of file week_planner.js.php.

Definition at line 86 of file week_planner.js.php.

startIdOfNewItems = 500000000

Definition at line 111 of file week_planner.js.php.

Definition at line 113 of file week_planner.js.php.

weekSchedule_ajaxObjects = new Array()

Definition at line 106 of file week_planner.js.php.

Definition at line 81 of file week_planner.js.php.

Definition at line 80 of file week_planner.js.php.

For more help developing with SiT! see http://sitracker.org/wiki/DevelopmentHowTo

© 2008-2011 Support Incident Tracker

Tsohost Logo