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.

141 lines
5.2 KiB

5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../jscript_asm.php'); ?>
  2. // Global Variables
  3. var CDates = new Array();
  4. var HTTPO_CCalendar = null;
  5. var SelectedCDay='';
  6. var CurrentCDate = Math.round((new Date())/1000);
  7. // Calendar Functions
  8. function CCalendar_QURL(RQT){
  9. switch(RQT){
  10. default:{// Get Dates
  11. RetVal="/lib/connector/json/get_messages_dates.php?STY=5&UID="+UserID+"&SID="+SessionID+"&DID="+CDevID+"&CDATE="+CurrentCDate;
  12. break;
  13. };
  14. };
  15. //alert(RetVal);
  16. return RetVal;
  17. };
  18. function StartCCalendarSession( httpRequestType ){
  19. var QURL='';
  20. if (HTTPO_CCalendar == null ){
  21. HTTPO_CCalendar = getHTTPObject();
  22. };
  23. if (HTTPO_CCalendar != null) {
  24. QURL=CCalendar_QURL( httpRequestType );
  25. HTTPO_CCalendar.open("GET", QURL , true);
  26. HTTPO_CCalendar.send('');
  27. HTTPO_CCalendar.onreadystatechange = HGDT_CCalendar;
  28. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Histo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  29. width: '100%',
  30. hidden: true,
  31. progress: true,
  32. closable: false
  33. });
  34. } else {
  35. Ext.Msg.alert('Status', 'Error Creating AJAX Connection.<br>Code: CCXL00231');
  36. };
  37. };
  38. function HGDT_CCalendar(){
  39. switch( HTTPO_CCalendar.readyState ){
  40. case 0: window.status = 'C:Communication is Uninitialized';
  41. break;
  42. case 1: window.status = 'C:Loading Data';
  43. break;
  44. case 2: window.status = 'C:Data is Loaded';
  45. break;
  46. case 3: window.status = 'C:Communication is Interactive';
  47. break;
  48. case 4: window.status = 'C:Data Load Complete';
  49. break;
  50. };
  51. if( HTTPO_CCalendar.readyState == 4 ){
  52. var T_Arr;
  53. //alert(HTTPO_CCalendar.responseText);
  54. T_Arr = JSON_parse( HTTPO_CCalendar.responseText,'' );
  55. httpRequestType=T_Arr.type/1;
  56. //alert(httpRequestType);
  57. //CDates=new Array();
  58. for (index=0;index<31;index++){
  59. if ( index<T_Arr.data.length ) {
  60. CDates[index]=T_Arr.data[index];
  61. } else CDates[index]= 0;
  62. };
  63. T_Arr=null;
  64. Ext.MessageBox.hide();
  65. BuildCCalendar();
  66. GetHistoryMesseges();
  67. };
  68. };
  69. function ShiftCBAK(){
  70. CurrentCDate=CurrentCDate-24*3600*GetMonthLength(CurrentCDate);
  71. BuildCCalendar();
  72. StartCCalendarSession(5);
  73. };
  74. function ShiftCFWD(){
  75. CurrentCDate=CurrentCDate+24*3600*GetMonthLength(CurrentCDate);
  76. BuildCCalendar();
  77. StartCCalendarSession();
  78. };
  79. function selectCDate( m, d){
  80. SY = GetYear(CurrentCDate);
  81. SM=m;
  82. SD=d;
  83. a=''+m+d;
  84. if (SelectedCDay!=''){
  85. try{
  86. document.getElementById('ds'+SelectedCDay).setAttribute("class", 'CalendarDE');
  87. document.getElementById('ds'+SelectedCDay).setAttribute("className", 'CalendarDE');
  88. } catch(e){};
  89. };
  90. document.getElementById('ds'+a).setAttribute("class", 'CalendarDS');
  91. document.getElementById('ds'+a).setAttribute("className", 'CalendarDS');
  92. SelectedCDay=a;
  93. GetHistoryMesseges();
  94. };
  95. function CheckCDate(D){
  96. for(j_index=0;j_index<CDates.length;j_index++){
  97. if (CDates[j_index]==D)return true;
  98. };
  99. return false;
  100. };
  101. function BuildCCalendar(){
  102. Msh=GetMonthShift(CurrentCDate);
  103. Mnm=GetMonthName(CurrentCDate);
  104. Mln=GetMonthLength(CurrentCDate);
  105. Mid=GetMonthNum(CurrentCDate);
  106. Mye=GetYear(CurrentCDate);
  107. //alert('Building Cllendar');
  108. 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>';
  109. 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>';
  110. InDTA+='<tr>';
  111. for(index=0;index<Msh;index++){
  112. InDTA+='<td style="padding: 1px"><a href="#" title="No Data" class="CalendarDD">&nbsp;</a></td>';
  113. };
  114. for(;index<(Mln+Msh);index++){
  115. if (CheckCDate(index-Msh+1)){
  116. 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>';
  117. } else {
  118. InDTA+='<td style="padding: 1px"><a href="#" title="No Data For That Day" class="CalendarDD">'+(index-Msh+1).toString()+'</a></td>';
  119. }
  120. if ((index+1)%7==0){
  121. InDTA+='</tr><tr>';
  122. };
  123. };
  124. for(;(index)%7!=0;index++){
  125. InDTA+='<td style="padding: 1px"><a href="#" title="No Data" class="CalendarDD">&nbsp;</a></td>';
  126. };
  127. InDTA+='</tr></table>';
  128. tab=document.getElementById('chat_calendar_TD');
  129. tab.innerHTML=InDTA;
  130. };