- Timestamp:
- 06/02/12 17:33:39 (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoCalendar/inc/class.ui_migration.inc.php
r6210 r6393 20 20 function __construct() 21 21 { 22 23 24 25 26 27 22 include_once dirname(__FILE__ ).'/../../header.inc.php'; 23 24 if (is_array($_SESSION['phpgw_info']['expresso']['server'])) 25 $GLOBALS['phpgw_info']['server'] = $_SESSION['phpgw_info']['expresso']['server']; 26 else 27 $_SESSION['phpgw_info']['expresso']['server'] = $GLOBALS['phpgw_info']['server']; 28 28 29 29 $local = $_SESSION['phpgw_info']['expresso']['server']['db_host']; … … 93 93 } 94 94 } 95 96 function decode_days_repeat($hex){ 97 $bin = str_split( decbin($hex) ); 98 99 $decoded = array('SU','MO','TU','WE','TH','FR','SA'); 100 $returns = array(); 101 102 foreach($bin as $key => $value) 103 if((int)$value == 1) 104 $returns[] = $decoded[$key]; 105 106 return implode(',', $returns); 107 } 108 109 //Repetição de um evento 110 function as_repeat($cal_id, $calendar_object ,$startTime){ 111 $sql_select_repeat = "select * from phpgw_cal_repeats where cal_id = ".$cal_id; 112 $result = pg_query($this->current_base ,$sql_select_repeat); 113 114 while($repeat = pg_fetch_array($result)){ 115 $sql_insert = "insert into calendar_repeat (frequency, dtstart, object_id, until, byday, bymonthday, byyearday, interval) values ( "; 116 $type = ''; 117 $weeklyDays = ''; 118 $byMonthDay = ''; 119 $byYearDay = ''; 120 switch($repeat['recur_type']){ 121 case 1: 122 $type = 'daily'; 123 break; 124 case 2: 125 $type = 'weekly'; 126 $weeklyDays = $this->decode_days_repeat($repeat['recur_data']); 127 break; 128 case 3: 129 case 4: 130 $type = 'monthly'; 131 $day = new DateTime('@' . (int)$startTime, new DateTimeZone('UTC')); 132 $byMonthDay = date_format($day, 'j'); 133 break; 134 case 5: 135 $type = 'yearly'; 136 $day = new DateTime('@' . (int)$startTime, new DateTimeZone('UTC')); 137 $byYearDay = (1 + date_format($day, 'z')); 138 break; 139 } 140 141 $sql_insert .= "'".$type."', "; 142 $sql_insert .= "'".$startTime."000', "; 143 $sql_insert .= "'".$calendar_object."', "; 144 145 $sql_insert .= ($repeat['recur_enddate']) == 0 ? ("'', ") : ("'".$repeat['recur_enddate']."000',"); 146 $sql_insert .= "'".$weeklyDays."', "; 147 $sql_insert .= "'".$byMonthDay."', "; 148 $sql_insert .= "'".$byYearDay."', "; 149 $sql_insert .= "'".$repeat['recur_interval']."') RETURNING id"; 150 151 $result = pg_query($this->new_base ,$sql_insert); 152 $repeatEvent = pg_fetch_assoc($result); 153 154 if($repeat['recur_exception'] != ''){ 155 156 $ocurrences = explode(',', $repeat['recur_exception']); 157 158 foreach($ocurrences as $value){ 159 $sql_insert_excepetions = 'insert into calendar_repeat_ocurrence (ocurrence, exception, repeat_id) values ( '; 160 $sql_insert_excepetions .= "'".$value."', "; 161 $sql_insert_excepetions .= "'1', "; 162 $sql_insert_excepetions .= "'".$repeatEvent['id']."' )"; 163 pg_query($this->new_base ,$sql_insert_excepetions); 164 } 165 } 166 167 168 169 } 170 } 171 95 172 //Alarmes de um evento 96 function as_alarm($cal_id, $ date_ini, $date_end){173 function as_alarm($cal_id, $event_id, $date_ini){ 97 174 $sql_select_evento = "select * from phpgw_async where id like '%".$cal_id."%'"; 98 175 $result = pg_query($this->current_base ,$sql_select_evento); 99 176 100 while($evento = pg_fetch_array($result)){ 101 if(!$result['account_id']) 102 continue; 103 $sql_insert = "insert into calendar_alarm (action_id, time, range_end, range_start, unit, participant_id, object_id,sent) values ( "; 177 while($evento = pg_fetch_array($result)){ 178 179 $data = unserialize($evento['data']); 180 181 $attendee = pg_query($this->new_base , "select id from calendar_participant where (user_info_id = '".$data['owner']."' AND object_id = '".$event_id."' )"); 182 $attendee = pg_fetch_array($attendee); 183 184 $offset = ($date_ini - $evento['next']); 185 186 $sql_insert = "insert into calendar_alarm (action_id, unit, alarm_offset, time, participant_id, object_id, sent) values ( "; 104 187 //action_id 105 188 $sql_insert .= "1, "; 106 189 //unit 190 $sql_insert .= "'m', "; 191 //offset 192 $sql_insert .= "'".$offset."', "; 107 193 //time 108 $time = preg_split('/:/', $result['times']); 109 $sql_insert .= substr($time, -1).", "; 110 //range_end 111 $sql_insert .= "'".$date_end."', "; 112 //range_start 113 $sql_insert .= "'".$date_ini."', "; 114 //arrumar unit 115 $sql_insert .= "1, "; 116 //participant_id 117 $sql_insert .= $result['account_id'].", "; 194 $sql_insert .= "'".($offset / 60)."', "; 195 //participant 196 $sql_insert .= $attendee['id'] .", "; 118 197 //object_id 119 $sql_insert .= $ cal_id.", ";198 $sql_insert .= $event_id.", "; 120 199 //sent 121 200 if($date_ini > time()) … … 188 267 //Todo 189 268 //Implementar Repetição 190 269 191 270 $result = pg_query($this->current_base, $sql); 192 271 while($evento = pg_fetch_array($result)){ … … 272 351 $this->as_user_external($evento['cal_id'] ,$calendar['id'], $evento['owner'], $evento['ex_participants']); 273 352 274 //Por equanto desativado 275 //$this->as_alarm($evento['cal_id'], $evento['datetime'],$evento['edatetime']) ; 353 //Alarmes de eventos 354 $this->as_alarm($evento['cal_id'], $calendar['id'], $evento['datetime']) ; 355 356 //Repetição de um evento 357 $this->as_repeat($evento['cal_id'] ,$calendar['id'], $evento['datetime']); 276 358 277 359 } -
trunk/expressoMail1_2/js/draw_api.js
r6384 r6393 3001 3001 attachments: [], 3002 3002 isAttendee: true, 3003 3003 attendee: '',//TODOOOOOO, 3004 3004 calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0], 3005 3005 calendars: Calendar.calendars, … … 3011 3011 startHour: startEvent.toString(User.preferences.hourFormat), 3012 3012 endHour: endEvent(startEvent).toString(User.preferences.hourFormat), 3013 timezone: User.preferences.defaultCalendar ? Calendar. calendarOf[User.preferences.defaultCalendar].timezone : User.preferences.timezone,3013 timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone, 3014 3014 summary : $("#subject_"+ID).text(), 3015 3015 description : $("#body_" + ID).text(), -
trunk/prototype/modules/calendar/interceptors/DBMapping.php
r6369 r6393 261 261 Controller::begin(array('service' => 'PostgreSQL')); 262 262 263 foreach ($result as $id => $res) 264 Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,occurrence)VALUES('" . $id . "','" . implode("'),('" . $id . "', '", $res) . "')"); 265 263 foreach ($result as $id => $res){ 264 265 $ocurrences = array_unique($res); 266 Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,occurrence)VALUES('" . $id . "','" . implode("'),('" . $id . "', '", $ocurrences) . "')"); 267 } 266 268 $data = array(); 267 269 -
trunk/prototype/modules/calendar/js/helpers.js
r6371 r6393 1411 1411 1412 1412 if(!!data.result && data.result != "[]"){ 1413 var newAttach = jQuery.parseJSON(data.result);1413 var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 1414 1414 $('.attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>'); 1415 1415 currentUpload.removeClass('on-complete').parents('p') … … 1421 1421 }); 1422 1422 $('.attachments-list .button').button(); 1423 1423 1424 if(!!window.FormData) 1424 1425 $('#fileupload').bind('fileuploadstart', function () { 1425 1426 var widget = $(this), -
trunk/prototype/modules/calendar/templates/alarms_add_itemlist.ejs
r5652 r6393 6 6 <option value="alert" <%= data.alarm.defaultAlarms[i].type=='alert' ? 'selected="selected"':'' %>>Alerta</option> 7 7 <option value="mail" <%= data.alarm.defaultAlarms[i].type=='mail' ? 'selected="selected"':'' %>>E-mail</option> 8 < option value="sms" <%= data.alarm.defaultAlarms[i].type=='sms' ? 'selected="selected"':'' %>>SMS</option>8 <!--<option value="sms" <%= data.alarm.defaultAlarms[i].type=='sms' ? 'selected="selected"':'' %>>SMS</option>--> 9 9 </select> 10 10 <input type="text" name="alarmTime[]" class="number input-small" value="<%= data.alarm.defaultAlarms[i].time %>"/> -
trunk/prototype/modules/calendar/templates/event_add.ejs
r6369 r6393 9 9 <input type="hidden" class="id-event" name="idEvent" value="<%= data.event.id %>"/> 10 10 <% } %> 11 <% if( data.event. calendar ){ %>11 <% if( data.event.id && data.event.calendar ){ %> 12 12 <input type="hidden" class="last-calendar" name="lastCalendar" value="<%= data.event.calendar %>"/> 13 13 <% } %>
Note: See TracChangeset
for help on using the changeset viewer.