Changeset 696


Ignore:
Timestamp:
03/12/09 10:43:22 (10 years ago)
Author:
niltonneto
Message:

Implementação do desenvolvedor (amuller).

Location:
trunk/expressoCalendar
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoCalendar/inc/class.bocalendar.inc.php

    r656 r696  
    1818                        $_SESSION['calendar']['server']['db_type'] 
    1919                ); 
    20                 $this -> user_id = $_SESSION['calendar']['user']['account_id'];  
     20                $this -> user_id = $_SESSION['calendar']['user']['account_id']; 
     21                $this -> cat_id  = 0;    
    2122        } 
    2223 
     
    3031        function requestDayCal ($dayTime) { 
    3132                $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']))."))"); 
    3334                if (!$this->db->query($query)) 
    3435                        return false; 
     
    5152        function requestWeekCal ($dayTime) { 
    5253                // 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)."))"; 
    5455                if (!$this->db->query($query)) 
    5556                        return false; 
     
    7778                // Performing SQL query 
    7879                $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'])."))"; 
    8081                if (!$this->db->query($query)) 
    8182                        return false; 
     
    9091        function requestYearCal ($dayTime) { 
    9192                // 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)."))"; 
    9394                if (!$this->db->query($query)) 
    9495                        return false; 
  • trunk/expressoCalendar/inc/class.uicalendar.inc.php

    r665 r696  
    114114                if (isset ($_REQUEST["uid"])) 
    115115                        $this->db_obj->user_id = $_REQUEST["uid"]; 
     116                if (isset ($_REQUEST["cat"])) 
     117                        $this->db_obj->cat_id = $_REQUEST["cat"]; 
     118 
    116119                $fromBo = $this->db_obj->requestDayCal($dayTime); 
    117120 
     
    155158                if (isset($_REQUEST["uid"])) 
    156159                        $this->db_obj->user_id = $_REQUEST["uid"]; 
     160                if (isset ($_REQUEST["cat"])) 
     161                        $this->db_obj->cat_id = $_REQUEST["cat"]; 
    157162 
    158163                $dayViewTime -= (date('N', $dayViewTime)%7)*86400; 
     
    195200                if (isset($_REQUEST["uid"])) 
    196201                        $this->db_obj->user_id = $_REQUEST["uid"]; 
     202                if (isset ($_REQUEST["cat"])) 
     203                        $this->db_obj->cat_id = $_REQUEST["cat"]; 
    197204 
    198205                $fromBo = $this->db_obj->requestMonthCal($todayTime); 
     
    234241                $currentWeekDay = date('w', $monthViewTime); 
    235242 
    236                 for($i = $this->workweekstarts+$currentWeekDay; $i <= $this->workweekends+$currentWeekDay; $i++){ 
     243                for($i = ($this->workweekstarts+$currentWeekDay)-1; $i <= $this->workweekends+$currentWeekDay; $i++){ 
    237244                        // Dayid is year+month+dayofMonth (currentDay-(dayofWeek+$i)) 
    238245                        $retorno.= "<dayofweek><dayname>".$this->daysofweek[$i%7]."</dayname></dayofweek>"; 
  • trunk/expressoCalendar/index.php

    r656 r696  
    3636        $cat->app_name = 'calendar'; // The categories still the same from egroupwareCalendar 
    3737        $optionCategories = $cat->formated_list('select','all',$bo->cat_id,'True'); 
     38        $optionCategories .= '<option selected value="0">'.lang("all").'</option>' . "\n"; 
     39         
    3840        foreach ($bo->list_cals() as $cal_) 
    3941                if (! strstr($cal_['value'],'g_')) 
  • trunk/expressoCalendar/js/calendar_functions.js

    r665 r696  
    1010        this.previousView; 
    1111        this.uid = calUid; 
     12        this.cat = ''; 
     13        this.currentTime = new Date(); 
    1214} 
    1315 
     
    7375 
    7476} 
    75 Calendar.prototype.getView = function(idEl, type, data) 
     77Calendar.prototype.getView = function(idEl, type, viewTime) 
    7678{ 
     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        } 
    7791        this.idEl = idEl; 
    7892        var _this = this; 
     
    8296        { 
    8397                        _this.parseView(XMLdata,type); 
    84  
     98                        calendar.currentTime.setTime(id2timeStamp(document.getElementById('day').firstChild.id)); 
     99                        var dayMS = (60*60*24*1000); 
    85100                        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(); 
    93107                        } 
    94108                        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; 
    100111                        } 
    101112                        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(); 
    107121                        } 
    108                         document.getElementById("l_date").innerHTML =  "<a href=\"javascript:calendar.getView('div_main','"+viewType+"','&time='+this.previousView);\">\<\<&nbsp;</a>"; 
     122                        document.getElementById("l_date").innerHTML =  "<a href=\"javascript:calendar.getView('div_main','"+viewType+"',this.previousView);\">\<\<&nbsp;</a>"; 
    109123                        if (viewType == "Week") 
    110124                                document.getElementById("l_date").innerHTML += calendar.parseWeek(id2timeStamp(document.getElementById('day').firstChild.id)); 
     
    113127                        if (viewType == "Month") 
    114128                                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);\">&nbsp;\>\></a>"; 
     129                        document.getElementById("l_date").innerHTML += "<a href=\"javascript:calendar.getView('div_main','"+viewType+"',this.nextView);\">&nbsp;\>\></a>"; 
    116130 
    117131                var getEventsDay = function (data) 
     
    125139                } 
    126140                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); 
    128142 
    129143        }; 
     
    132146        viewType = type; 
    133147        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        }; 
    136150 
    137151Calendar.prototype.resetView = function() 
     
    312326                eventDiv.onmouseover = function () { this.style.height = "auto"; this.style.zIndex = 2;}; 
    313327                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        } 
    317330        var tdElement = document.getElementById(timeStamp2id(eventDiv.childNodes[0].id)); 
    318331 
     
    323336                eventDiv.onmouseover = function () { if (this.childNodes[2].length > 9) this.style.width = "auto"; this.style.zIndex = 2; }; 
    324337                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); }; 
    326339                eventDiv.style.cursor = "pointer"; 
    327340 
     
    333346                        eventDiv.style.margin = "0 0 0 "+(20+(tdElement.childNodes.length-1)*25); 
    334347        } 
    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  
    44<tr> 
    55<td> 
    6 <select id="cat_id"> 
     6<select id="cat_id" onchange="calendar.cat=this.value; calendar.getView('div_main',viewType);"> 
    77{cat_options} 
    88</select> 
     
    1212{cal_options} 
    1313</select> 
     14</td> 
     15<td align="right"> 
     16<label id="l_date"></label> 
    1417</td> 
    1518</tr> 
  • trunk/expressoCalendar/xsl/viewDay.xsl

    r665 r696  
    66        <div id="{$today}"></div> 
    77</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/> 
    99        <table class="table_common" width="100%" cellpadding="0" cellspacing="0" border="0"> 
    1010<tbody> 
  • trunk/expressoCalendar/xsl/viewMonth.xsl

    r665 r696  
    66        <div id="{$today}"></div> 
    77</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/> 
    99        <table class="table_common" height="auto" width="100%" cellpadding="0" cellspacing="0"> 
    1010                <tbody> 
  • trunk/expressoCalendar/xsl/viewWeek.xsl

    r665 r696  
    66        <div id="{$today}"></div> 
    77</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/> 
    99<table class="table_common" width="100%" cellpadding="0" cellspacing="0" border="0"> 
    1010        <tr> 
Note: See TracChangeset for help on using the changeset viewer.