Changeset 696 for trunk/expressoCalendar
- Timestamp:
- 03/12/09 10:43:22 (15 years ago)
- Location:
- trunk/expressoCalendar
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoCalendar/inc/class.bocalendar.inc.php
r656 r696 18 18 $_SESSION['calendar']['server']['db_type'] 19 19 ); 20 $this -> user_id = $_SESSION['calendar']['user']['account_id']; 20 $this -> user_id = $_SESSION['calendar']['user']['account_id']; 21 $this -> cat_id = 0; 21 22 } 22 23 … … 30 31 function requestDayCal ($dayTime) { 31 32 $day = getdate($dayTime); 32 $query = ("SELECT * FROM phpgw_cal where (owner = '".$this->user_id."') and ((datetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and datetime < ".(mktime(0,0,0,$day['mon'],($day['mday']+1),$day['year'])).") or (edatetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and edatetime < ".(mktime(0,0,0,$day['mon'],$day['mday']+1,$day['year']))."))");33 $query = ("SELECT * FROM phpgw_cal where ".($this->cat_id>0?"(category=".$this->cat_id.") and":"")."(owner = '".$this->user_id."') and ((datetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and datetime < ".(mktime(0,0,0,$day['mon'],($day['mday']+1),$day['year'])).") or (edatetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and edatetime < ".(mktime(0,0,0,$day['mon'],$day['mday']+1,$day['year']))."))"); 33 34 if (!$this->db->query($query)) 34 35 return false; … … 51 52 function requestWeekCal ($dayTime) { 52 53 // Performing SQL query 53 $query = "SELECT cal_id, title, description, datetime, edatetime FROM phpgw_cal where (owner = '".$this->user_id."') and ((datetime > ".$dayTime." and datetime < ".($dayTime+604800).") or (edatetime > ".$dayTime." and edatetime < ".($dayTime+604800)."))";54 $query = "SELECT cal_id, title, description, datetime, edatetime FROM phpgw_cal where ".($this->cat_id>0?"(category=".$this->cat_id.") and":"")." (owner = '".$this->user_id."') and ((datetime > ".$dayTime." and datetime < ".($dayTime+604800).") or (edatetime > ".$dayTime." and edatetime < ".($dayTime+604800)."))"; 54 55 if (!$this->db->query($query)) 55 56 return false; … … 77 78 // Performing SQL query 78 79 $day = getdate($dayTime); 79 $query = "SELECT cal_id, title, description, datetime, edatetime FROM phpgw_cal where (owner = '".$this->user_id."') and ((datetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and datetime < ".mktime(0,0,0,$day['mon']+1,$day['mday'],$day['year']).") or (edatetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and edatetime < ".mktime(0,0,0,$day['month']+1,$day['day'],$day['year'])."))";80 $query = "SELECT cal_id, title, description, datetime, edatetime FROM phpgw_cal where ".($this->cat_id>0?"(category=".$this->cat_id.") and":"")." (owner = '".$this->user_id."') and ((datetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and datetime < ".mktime(0,0,0,$day['mon']+1,$day['mday'],$day['year']).") or (edatetime > ".mktime(0,0,0,$day['mon'],$day['mday'],$day['year'])." and edatetime < ".mktime(0,0,0,$day['month']+1,$day['day'],$day['year'])."))"; 80 81 if (!$this->db->query($query)) 81 82 return false; … … 90 91 function requestYearCal ($dayTime) { 91 92 // Performing SQL query 92 $query = "SELECT cal_id, title, description, datetime, edatetime FROM phpgw_cal where (owner = '".$this->user_id."') and ((datetime > ".$dayTime." and datetime < ".($dayTime+31104000).") or (edatetime > ".$dayTime." and edatetime < ".($dayTime+2592000)."))";93 $query = "SELECT cal_id, title, description, datetime, edatetime FROM phpgw_cal where ".($this->cat_id>0?"(category=".$this->cat_id.") and":"")." (owner = '".$this->user_id."') and ((datetime > ".$dayTime." and datetime < ".($dayTime+31104000).") or (edatetime > ".$dayTime." and edatetime < ".($dayTime+2592000)."))"; 93 94 if (!$this->db->query($query)) 94 95 return false; -
trunk/expressoCalendar/inc/class.uicalendar.inc.php
r665 r696 114 114 if (isset ($_REQUEST["uid"])) 115 115 $this->db_obj->user_id = $_REQUEST["uid"]; 116 if (isset ($_REQUEST["cat"])) 117 $this->db_obj->cat_id = $_REQUEST["cat"]; 118 116 119 $fromBo = $this->db_obj->requestDayCal($dayTime); 117 120 … … 155 158 if (isset($_REQUEST["uid"])) 156 159 $this->db_obj->user_id = $_REQUEST["uid"]; 160 if (isset ($_REQUEST["cat"])) 161 $this->db_obj->cat_id = $_REQUEST["cat"]; 157 162 158 163 $dayViewTime -= (date('N', $dayViewTime)%7)*86400; … … 195 200 if (isset($_REQUEST["uid"])) 196 201 $this->db_obj->user_id = $_REQUEST["uid"]; 202 if (isset ($_REQUEST["cat"])) 203 $this->db_obj->cat_id = $_REQUEST["cat"]; 197 204 198 205 $fromBo = $this->db_obj->requestMonthCal($todayTime); … … 234 241 $currentWeekDay = date('w', $monthViewTime); 235 242 236 for($i = $this->workweekstarts+$currentWeekDay; $i <= $this->workweekends+$currentWeekDay; $i++){243 for($i = ($this->workweekstarts+$currentWeekDay)-1; $i <= $this->workweekends+$currentWeekDay; $i++){ 237 244 // Dayid is year+month+dayofMonth (currentDay-(dayofWeek+$i)) 238 245 $retorno.= "<dayofweek><dayname>".$this->daysofweek[$i%7]."</dayname></dayofweek>"; -
trunk/expressoCalendar/index.php
r656 r696 36 36 $cat->app_name = 'calendar'; // The categories still the same from egroupwareCalendar 37 37 $optionCategories = $cat->formated_list('select','all',$bo->cat_id,'True'); 38 $optionCategories .= '<option selected value="0">'.lang("all").'</option>' . "\n"; 39 38 40 foreach ($bo->list_cals() as $cal_) 39 41 if (! strstr($cal_['value'],'g_')) -
trunk/expressoCalendar/js/calendar_functions.js
r665 r696 10 10 this.previousView; 11 11 this.uid = calUid; 12 this.cat = ''; 13 this.currentTime = new Date(); 12 14 } 13 15 … … 73 75 74 76 } 75 Calendar.prototype.getView = function(idEl, type, data)77 Calendar.prototype.getView = function(idEl, type, viewTime) 76 78 { 79 if (typeof(type) == 'undefined') 80 return false; 81 if (typeof(viewTime) == 'undefined') 82 viewTime = calendar.currentTime.getTime(); 83 if (type == 'Year'){ 84 var handler = function (data) { 85 var div_main = document.getElementById('div_main'); 86 div_main.innerHTML = data; 87 } 88 cExecute('../index.php?menuaction=calendar.uicalendar.year&plain=True',handler); 89 return; 90 } 77 91 this.idEl = idEl; 78 92 var _this = this; … … 82 96 { 83 97 _this.parseView(XMLdata,type); 84 98 calendar.currentTime.setTime(id2timeStamp(document.getElementById('day').firstChild.id)); 99 var dayMS = (60*60*24*1000); 85 100 if (viewType == "Week"){ 86 var Today = new Date; 87 Today.setTime(id2timeStamp(document.getElementById('day').firstChild.id)); 88 var lastWeek = new Date; 89 lastWeek.setTime(Today.getTime()-(60*60*24*7*1000)); 90 this.previousView = (lastWeek.getYear()+1900)+normDec(lastWeek.getDate()-7)+normDec(lastWeek.getMonth()+1); 91 Today.setTime(Today.getTime()+(60*60*24*8*1000)); 92 this.nextView = (Today.getYear()+1900)+normDec(Today.getDate())+normDec(Today.getMonth()+1); 101 var previousWeek = new Date; 102 previousWeek.setTime(calendar.currentTime.getTime()-(dayMS*7)); 103 this.previousView = previousWeek.getTime(); 104 var nextWeek = new Date; 105 nextWeek.setTime(calendar.currentTime.getTime()+(dayMS*8)); 106 this.nextView = nextWeek.getTime(); 93 107 } 94 108 if (viewType == "Day"){ 95 var Today = new Date; 96 Today.setTime(id2timeStamp(document.getElementById('day').firstChild.id)); 97 this.previousView = (Today.getYear()+1900)+normDec(Today.getDate()-1)+normDec(Today.getMonth()+1); 98 Today.setDate(Today.getDate()+1); 99 this.nextView = (Today.getYear()+1900)+normDec(Today.getDate())+normDec(Today.getMonth()+1); 109 this.previousView = calendar.currentTime.getTime()-dayMS; 110 this.nextView = calendar.currentTime.getTime()+dayMS; 100 111 } 101 112 if (viewType == 'Month'){ 102 var Today = new Date; 103 Today.setTime(id2timeStamp(document.getElementById('day').firstChild.id)); 104 this.previousView = (Today.getYear()+1900)+normDec(Today.getDate())+normDec(Today.getMonth()); 105 Today.setMonth(Today.getMonth()+1); 106 this.nextView = (Today.getYear()+1900)+normDec(Today.getDate())+normDec(Today.getMonth()+1); 113 var previousMonth = new Date; 114 previousMonth.setTime(calendar.currentTime.getTime()); 115 previousMonth.setMonth(calendar.currentTime.getMonth()-1); 116 this.previousView = previousMonth.getTime(); 117 var nextMonth = new Date; 118 nextMonth.setTime(calendar.currentTime.getTime()); 119 nextMonth.setMonth(calendar.currentTime.getMonth()+1); 120 this.nextView = nextMonth.getTime(); 107 121 } 108 document.getElementById("l_date").innerHTML = "<a href=\"javascript:calendar.getView('div_main','"+viewType+"', '&time='+this.previousView);\">\<\< </a>";122 document.getElementById("l_date").innerHTML = "<a href=\"javascript:calendar.getView('div_main','"+viewType+"',this.previousView);\">\<\< </a>"; 109 123 if (viewType == "Week") 110 124 document.getElementById("l_date").innerHTML += calendar.parseWeek(id2timeStamp(document.getElementById('day').firstChild.id)); … … 113 127 if (viewType == "Month") 114 128 document.getElementById("l_date").innerHTML += calendar.parseMonth(id2timeStamp(document.getElementById('day').firstChild.id)); 115 document.getElementById("l_date").innerHTML += "<a href=\"javascript:calendar.getView('div_main','"+viewType+"', '&time='+this.nextView);\"> \>\></a>";129 document.getElementById("l_date").innerHTML += "<a href=\"javascript:calendar.getView('div_main','"+viewType+"',this.nextView);\"> \>\></a>"; 116 130 117 131 var getEventsDay = function (data) … … 125 139 } 126 140 XMLTools.__RETURN_MODE__ = 'XML'; 127 XMLTools.request('$this.uicalendar.getEvents'+type+ (data?data:'')+'&uid='+calendar.uid, 'GET', getEventsDay);141 XMLTools.request('$this.uicalendar.getEvents'+type+"&time="+timeStamp2id(calendar.currentTime.getTime())+'&uid='+calendar.uid+'&cat='+calendar.cat, 'GET', getEventsDay); 128 142 129 143 }; … … 132 146 viewType = type; 133 147 screenTable = new Array(); 134 XMLTools.request('$this.uicalendar.getView'+type+ (data?data:'')+'&uid='+this.uid, 'GET', handler_getView);135 };148 XMLTools.request('$this.uicalendar.getView'+type+"&time="+timeStamp2id(viewTime)+'&uid='+this.uid, 'GET', handler_getView); 149 }; 136 150 137 151 Calendar.prototype.resetView = function() … … 312 326 eventDiv.onmouseover = function () { this.style.height = "auto"; this.style.zIndex = 2;}; 313 327 eventDiv.onmouseout = function () { this.style.height = "20px"; this.style.zIndex = 1; }; 314 eventDiv.onclick = function () { calendar.getView('div_main','Day','&time='+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8)); }; 315 } 316 328 eventDiv.onclick = function () { calendar.getView('div_main','Day',eventDiv.childNodes[1].id); }; 329 } 317 330 var tdElement = document.getElementById(timeStamp2id(eventDiv.childNodes[0].id)); 318 331 … … 323 336 eventDiv.onmouseover = function () { if (this.childNodes[2].length > 9) this.style.width = "auto"; this.style.zIndex = 2; }; 324 337 eventDiv.onmouseout = function () { this.style.width = "60px"; this.style.zIndex = 1; }; 325 eventDiv.onclick = function () { calendar.getView('div_main','Day', '&time='+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8)); };338 eventDiv.onclick = function () { calendar.getView('div_main','Day',eventDiv.childNodes[1].id); }; 326 339 eventDiv.style.cursor = "pointer"; 327 340 … … 333 346 eventDiv.style.margin = "0 0 0 "+(20+(tdElement.childNodes.length-1)*25); 334 347 } 335 336 eventDiv.style.top = (tdElement.offsetTop + 160) + "px"; 337 tdElement.appendChild(eventDiv); 338 } 339 340 348 if (tdElement == null) 349 { 350 orphan_table = document.getElementById('orphan_table'); 351 if (!orphan_table) 352 { 353 orphan_table = document.createElement('table'); 354 orphan_table.id = "orphan_table"; 355 orphan_table.className = "table_common"; 356 orphan_table.innerHTML = "<tbody></tbody>"; 357 document.getElementById('div_main').appendChild(orphan_table); 358 359 } 360 tr_el = document.createElement('TR'); 361 td_el = document.createElement('TD'); 362 td_el.className = "td_header"; 363 td_el.innerHTML = get_lang("Out of table preferences"); 364 tr_el.appendChild(td_el); 365 td_el = document.createElement('TD'); 366 td_el.className = "td_common"; 367 tr_el.appendChild(td_el); 368 eventDiv.style.position = "relative"; 369 td_el.appendChild(eventDiv); 370 orphan_table.firstChild.appendChild(tr_el); 371 } 372 else 373 { 374 eventDiv.style.top = (tdElement.offsetTop + 160) + "px"; 375 tdElement.appendChild(eventDiv); 376 } 377 } 378 379 -
trunk/expressoCalendar/templates/default/index.tpl
r656 r696 4 4 <tr> 5 5 <td> 6 <select id="cat_id" >6 <select id="cat_id" onchange="calendar.cat=this.value; calendar.getView('div_main',viewType);"> 7 7 {cat_options} 8 8 </select> … … 12 12 {cal_options} 13 13 </select> 14 </td> 15 <td align="right"> 16 <label id="l_date"></label> 14 17 </td> 15 18 </tr> -
trunk/expressoCalendar/xsl/viewDay.xsl
r665 r696 6 6 <div id="{$today}"></div> 7 7 </div> 8 <div width="100%" class="title" align="left" >< label id="l_date"></label><br/><br/>8 <div width="100%" class="title" align="left" ><br/> 9 9 <table class="table_common" width="100%" cellpadding="0" cellspacing="0" border="0"> 10 10 <tbody> -
trunk/expressoCalendar/xsl/viewMonth.xsl
r665 r696 6 6 <div id="{$today}"></div> 7 7 </div> 8 <div width="100%" class="title" align="left" >< label id="l_date"></label><br/><br/>8 <div width="100%" class="title" align="left" ><br/> 9 9 <table class="table_common" height="auto" width="100%" cellpadding="0" cellspacing="0"> 10 10 <tbody> -
trunk/expressoCalendar/xsl/viewWeek.xsl
r665 r696 6 6 <div id="{$today}"></div> 7 7 </div> 8 <div width="100%" class="title" align="left" >< label id="l_date"></label><br/><br/>8 <div width="100%" class="title" align="left" ><br/> 9 9 <table class="table_common" width="100%" cellpadding="0" cellspacing="0" border="0"> 10 10 <tr>
Note: See TracChangeset
for help on using the changeset viewer.