Web Interface For Lite Argus Control modules
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.
 
 
 
 

142 lines
5.2 KiB

//<?php require_once('../../jscript_asm.php'); ?>
// Global Variables
var CDates = new Array();
var HTTPO_CCalendar = null;
var SelectedCDay='';
var CurrentCDate = Math.round((new Date())/1000);
// Calendar Functions
function CCalendar_QURL(RQT){
switch(RQT){
default:{// Get Dates
RetVal="/lib/connector/json/get_messages_dates.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentCDate;
break;
};
};
//alert(RetVal);
return RetVal;
};
function StartCCalendarSession( httpRequestType ){
var QURL='';
if (HTTPO_CCalendar == null ){
HTTPO_CCalendar = getHTTPObject();
};
if (HTTPO_CCalendar != null) {
QURL=CCalendar_QURL( httpRequestType );
HTTPO_CCalendar.open("GET", QURL , true);
HTTPO_CCalendar.send('');
HTTPO_CCalendar.onreadystatechange = HGDT_CCalendar;
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_CCalendar(){
switch( HTTPO_CCalendar.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_CCalendar.readyState == 4 ){
var T_Arr;
//alert(HTTPO_CCalendar.responseText);
T_Arr = JSON_parse( HTTPO_CCalendar.responseText,'' );
httpRequestType=T_Arr.type/1;
//alert(httpRequestType);
//CDates=new Array();
for (index=0;index<31;index++){
if ( index<T_Arr.data.length ) {
CDates[index]=T_Arr.data[index];
} else CDates[index]= 0;
};
T_Arr=null;
Ext.MessageBox.hide();
BuildCCalendar();
GetHistoryMesseges();
};
};
function ShiftCBAK(){
CurrentCDate=CurrentCDate-24*3600*GetMonthLength(CurrentCDate);
BuildCCalendar();
StartCCalendarSession(5);
};
function ShiftCFWD(){
CurrentCDate=CurrentCDate+24*3600*GetMonthLength(CurrentCDate);
BuildCCalendar();
StartCCalendarSession();
};
function selectCDate( m, d){
SY = GetYear(CurrentCDate);
SM=m;
SD=d;
a=''+m+d;
if (SelectedCDay!=''){
try{
document.getElementById('ds'+SelectedCDay).setAttribute("class", 'CalendarDE');
document.getElementById('ds'+SelectedCDay).setAttribute("className", 'CalendarDE');
} catch(e){};
};
document.getElementById('ds'+a).setAttribute("class", 'CalendarDS');
document.getElementById('ds'+a).setAttribute("className", 'CalendarDS');
SelectedCDay=a;
GetHistoryMesseges();
};
function CheckCDate(D){
for(j_index=0;j_index<CDates.length;j_index++){
if (CDates[j_index]==D)return true;
};
return false;
};
function BuildCCalendar(){
Msh=GetMonthShift(CurrentCDate);
Mnm=GetMonthName(CurrentCDate);
Mln=GetMonthLength(CurrentCDate);
Mid=GetMonthNum(CurrentCDate);
Mye=GetYear(CurrentCDate);
//alert('Building Cllendar');
InDTA='<table cellpadding="2" cellspacing="0"><tr height="19px"><td valign="middle"><a href="#" onclick="ShiftCBAK();"><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="ShiftCFWD();"><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 (CheckCDate(index-Msh+1)){
InDTA+='<td style="padding: 1px"><a id="ds'+Mid.toString()+(index-Msh+1).toString()+'" onclick="selectCDate('+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('chat_calendar_TD');
tab.innerHTML=InDTA;
};