Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

111 lines
4.4 KiB

//<?php require_once('../../jscript_asm.php'); ?>
// Global Variables
var Dates = new Array();
var HTTPO_Calendar = null;
var SelectedDay='';
var CurrentDate=(new Date())/1000;
// Calendar Functions
function Calendar_QURL(RQT){
RetVal="feed.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentDate;
return RetVal;
};
function StartCalendarSession( httpRequestType ){
var QURL='';
if (HTTPO_Calendar == null ){
HTTPO_Calendar = getHTTPObject();
};
if (HTTPO_Calendar != null) {
QURL=Calendar_QURL( httpRequestType );
HTTPO_Calendar.open("GET", QURL , true);
HTTPO_Calendar.send('');
HTTPO_Calendar.onreadystatechange = HGDT_Calendar;
Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Histo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
width: '100%',
hidden: true,
progress: true,
closable: false
});
} else {
Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CCXL00231');
};
};
function HGDT_Calendar(){
switch( HTTPO_Calendar.readyState ){
case 0: window.status = 'C:Communication is Uninitialized';
break;
case 1: window.status = 'C:Loading Data';
break;
case 2: window.status = 'C:Data is Loaded';
break;
case 3: window.status = 'C:Communication is Interactive';
break;
case 4: window.status = 'C:Data Load Complete';
break;
};
if( HTTPO_Calendar.readyState == 4 ){
var T_Arr;
//alert(HTTPO_Calendar.responseText);
T_Arr = JSON_parse( HTTPO_Calendar.responseText,'' );
httpRequestType=T_Arr.type/1;
//alert(httpRequestType);
Dates=new Array();
for (index=0;index<T_Arr.data.length;index++){
Dates[index]=T_Arr.data[index];
};
T_Arr=null;
BuildCalendar();
Ext.MessageBox.hide();
};
};
function selectDate( m, d ){
SY = GetYear(CurrentDate);
SMO = m;
SD = d;
a = ''+m+d;
if (SelectedDay!=''){
try{
document.getElementById('ds'+SelectedDay).setAttribute("class", 'CalendarDE');
document.getElementById('ds'+SelectedDay).setAttribute("className", 'CalendarDE');
} catch(e){};
};
document.getElementById('ds'+a).setAttribute("class", 'CalendarDS');
document.getElementById('ds'+a).setAttribute("className", 'CalendarDS');
SelectedDay=a;
};
function BuildCalendar(){
Msh=GetMonthShift(CurrentDate);
Mnm=GetMonthName(CurrentDate);
Mln=GetMonthLength(CurrentDate);
Mid=GetMonthNum(CurrentDate);
Mye=GetYear(CurrentDate);
//alert('Building Cllendar');
InDTA='<table cellpadding="2" cellspacing="0"><tr height="19px"><td valign="middle"><a href="#" onclick="ShiftBAK();"><img src="/style/img/calendar/l_cal_b.gif"></a></td><td colspan="5" class="CalendarMN" align="center">'+Mnm+' '+Mye+'</td><td><a href="#" onclick="ShiftFWD();"><img border=0 src="/style/img/calendar/r_cal_b.gif"></a></td></tr>';
InDTA+='<tr><td class="CalendarWT" align="center">Su</td><td class="CalendarWT" align="center">Mo</td><td class="CalendarWT" align="center">Tu</td><td class="CalendarWT" align="center">We</td><td class="CalendarWT" align="center">Th</td><td class="CalendarWT" align="center">Fr</td><td class="CalendarWT" align="center">Sa</td></tr>';
InDTA+='<tr>';
for(index=0;index<Msh;index++){
InDTA+='<td style="padding: 1px"><a href="#" title="No Data" class="CalendarDD">&nbsp;</a></td>';
};
for(;index<(Mln+Msh);index++){
if (CheckDate(index-Msh+1)){
InDTA+='<td style="padding: 1px"><a id="ds'+Mid.toString()+(index-Msh+1).toString()+'" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" href="#" title="'+(index-Msh+1).toString()+'" class="CalendarDE">'+(index-Msh+1).toString()+'</a></td>';
} else {
InDTA+='<td style="padding: 1px"><a href="#" title="No Data For That Day" class="CalendarDD">'+(index-Msh+1).toString()+'</a></td>';
}
if ((index+1)%7==0){
InDTA+='</tr><tr>';
};
};
for(;(index)%7!=0;index++){
InDTA+='<td style="padding: 1px"><a href="#" title="No Data" class="CalendarDD">&nbsp;</a></td>';
};
InDTA+='</tr></table>';
tab=document.getElementById('calendar_TD');
tab.innerHTML=InDTA;
};