Changeset 6754 for branches/2.4/prototype/modules/calendar
- Timestamp:
- 07/11/12 11:45:10 (12 years ago)
- Location:
- branches/2.4
- Files:
-
- 15 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk merged eligible /sandbox/2.4.1-3 6237-6527
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/2.4/prototype/modules/calendar/alarms.php
r6378 r6754 7 7 require_once ROOTPATH.'/modules/calendar/constants.php'; 8 8 require_once ROOTPATH.'/api/parseTPL.php'; 9 10 use prototype\api\Config as Config; 9 11 10 12 $target = (gmdate('U') - 300 ).'000'; -
branches/2.4/prototype/modules/calendar/css/layout.css
r6501 r6754 227 227 .new-event-win ul.attendee-permissions-list, li.attendee-permissions-list{text-align: left;} 228 228 229 li.attendee-permissions-list input{width: 20px !important; margin: 3px 0 0 0 !important;} 229 li.attendee-permissions-list input{width: 20px !important; margin: 3px 0 0 0 !important;} 230 230 231 231 p.request-update{display: inline; position: relative; top: 2px;} … … 401 401 402 402 label.messagesHelpers{display: block; position: absolute; left: 60px; top: 21px;} 403 403 404 /* -- calendar list styles -- */ 404 405 -
branches/2.4/prototype/modules/calendar/interceptors/DAViCalAdapter.php
r6010 r6754 1 1 <?php 2 2 require_once ROOTPATH.'/modules/calendar/constants.php'; 3 use prototype\api\Config as Config; 3 4 4 5 class DAViCalAdapter { -
branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php
r6588 r6754 5 5 6 6 require_once ROOTPATH . '/modules/calendar/interceptors/Helpers.php'; 7 8 use prototype\api\Config as Config; 7 9 8 10 class DBMapping extends Helpers { … … 147 149 .'(range_start >= \'' . $start[1] . '\' AND range_start <= \'' . $end[1] . '\') OR ' 148 150 .'(range_start <= \'' . $start[2] . '\' AND range_end >= \'' . $end[2] . '\')) ' 149 .(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ') 150 .'AND calendar_object.dtstart NOT IN (SELECT calendar_repeat_occurrence.occurrence from calendar_repeat_occurrence, ' 151 .'calendar_repeat where (calendar_repeat_occurrence.repeat_id = calendar_repeat.id) ' 152 151 .(!empty($ids) ? ' ' .'AND calendar_object.id NOT IN (\'' . implode('\',\'', $ids) . '\') ' : ' ') 152 .'AND calendar_object.dtstart NOT IN (SELECT calendar_repeat_occurrence.occurrence from calendar_repeat_occurrence, ' 153 .'calendar_repeat where (calendar_repeat_occurrence.repeat_id = calendar_repeat.id) ' 154 .'AND (calendar_repeat.object_id = calendar_object.id))'; 153 155 154 156 $params = Controller::service('PostgreSQL')->execResultSql($sql.$where); … … 206 208 //Recurepa as execeções anteriores caso exista 207 209 if (isset($lastExceptions) && count($lastExceptions) && $lastExceptions) 208 foreach ($lastExceptions as $value) 209 210 foreach ($lastExceptions as $value) 211 array_push($exceptions, $value['occurrence']); 210 212 211 213 $params = array_diff(self::decodeRepeat($repeat, $ranges[0]['rangeStart'], $ranges[0]['rangeEnd']), $exceptions); … … 215 217 if (!empty($params)) 216 218 Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES('" . $id . "','0','" . implode("'),('" . $id . "','0','", $params) . "')" . ( empty($exceptions) ? "" : ",('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" )); 217 else if(!empty($exceptions)) 218 Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES ('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" ); 219 }219 else if(!empty($exceptions)) 220 Controller::service('PostgreSQL')->execResultSql("INSERT INTO calendar_repeat_occurrence(repeat_id,exception,occurrence)VALUES ('" . $id . "','1','" . implode("'),('" . $id . "','1','", $exceptions) . "')" ); 221 } 220 222 221 223 public function checkOccurrences($start, $end, $calendarIds) { … … 543 545 544 546 if (isset($v['id'])) { 545 $data = self::decodeParticipantsEvent($uri, $v, $criteria, $original);546 547 $result[$i]['statusAttendees'] = isset($data['statusAttendees']) ? $data['statusAttendees'] : false; 548 $result[$i]['sizeAttendees'] = isset($data['sizeAttendees']) ? $data['sizeAttendees'] : false; 549 $result[$i]['participants'] = $data['attendees']; 550 547 $data = self::decodeParticipantsEvent($uri, $v, $criteria, $original); 548 549 $result[$i]['statusAttendees'] = isset($data['statusAttendees']) ? $data['statusAttendees'] : false; 550 $result[$i]['sizeAttendees'] = isset($data['sizeAttendees']) ? $data['sizeAttendees'] : false; 551 $result[$i]['participants'] = $data['attendees']; 552 551 553 $attachmentRelation = Controller::find(array('concept' => 'schedulableToAttachment'), false, array('filter' => array('=', 'schedulable', $v['id']))); 552 554 if (is_array($attachmentRelation)) { … … 571 573 return $result; 572 574 } 573 575 574 576 575 577 //TODO: Remover apos suporte a deepness na api … … 698 700 ///////////////////////////////////////////////////////////////////////// 699 701 700 static function decodeParticipantsEvent( &$uri, $result, &$criteria, $original) { 701 $participants = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('=', 'schedulable' , $result['id']) )); 702 703 if($participants && ($size = count($participants)) < 100){ 704 if(isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0){ 705 self::deepnessFindParticipant($uri, $participants, $criteria, $original); 706 $participants['attendees'] = $participants; 707 } 708 709 }else if($participants && ($size = count($participants)) > 100){ 710 $owner = Controller::read( array( 'concept' => 'calendarSignature' ) , false ,array( 'filter' => array('AND', array('=', 'calendar' , $result['calendar']), array('=', 'isOwner', '1')))); 711 $owner = Controller::read( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable' , $result['id']), array('=', 'user', $owner[0]['user'])), 'deepness' => 2)); 712 713 if(is_array($owner)) 714 $owner = $owner[0]; 715 716 $reference = array_slice($participants, 0, 100); 717 $organizer = false; 718 $asOwner = false; 719 720 foreach($reference as $r => &$v){ 721 if($v['id'] == $owner['id']){ 722 $v = $owner; 723 $asOwner = true; 724 continue; 725 } 726 727 self::deepnessReadParticipant($uri, $v, $criteria, $original); 728 729 if($v['isOrganizer'] == "1" ) 730 $organizer = $v; 731 } 732 733 if(!$organizer){ 734 $organizer = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable' , $result['id']), array('=', 'isOrganizer', '1')), 'deepness' => 2)); 735 736 array_push($reference, $organizer[0]); 737 738 }else if($organizer && ($organizer['id'] != $owner['id'])) 739 array_merge($reference, $organizer); 740 741 if(!$asOwner) 742 array_push($reference, $owner); 743 744 $statusAttendees = array( 'default' => 0, 'accepted' => 0, 'tentative' => 0, 'cancelled' => 0, 'unanswered' => 0, 'delegated' => 0 ); 745 $statusLabels = array( 'default', 'accepted', 'tentative', 'cancelled', 'unanswered', 'delegated' ); 746 747 foreach($participants as $k => &$p){ 748 if(!$organizer && $p['isOrganizer'] == "1"){ 749 self::deepnessReadParticipant($uri, $p, $criteria, $original); 750 $reference = array_merge($reference, array($p)); 751 } 752 753 $statusAttendees[$statusLabels[$p['status']]]++; 754 } 755 756 $participants['statusAttendees'] = $statusAttendees; 757 $participants['sizeAttendees'] = $size; 758 $participants['attendees'] = $reference; 759 } 760 761 return $participants; 762 } 763 764 static function dayAlarm( &$uri , &$params , &$criteria , $original ) { 702 static function decodeParticipantsEvent( &$uri, $result, &$criteria, $original) { 703 $participants = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('=', 'schedulable' , $result['id']) )); 704 705 if($participants && ($size = count($participants)) < 100){ 706 if(isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0){ 707 self::deepnessFindParticipant($uri, $participants, $criteria, $original); 708 $participants['attendees'] = $participants; 709 } 710 711 }else if($participants && ($size = count($participants)) > 100){ 712 $owner = Controller::read( array( 'concept' => 'calendarSignature' ) , false ,array( 'filter' => array('AND', array('=', 'calendar' , $result['calendar']), array('=', 'isOwner', '1')))); 713 $owner = Controller::read( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable' , $result['id']), array('=', 'user', $owner[0]['user'])), 'deepness' => 2)); 714 715 if(is_array($owner)) 716 $owner = $owner[0]; 717 718 $reference = array_slice($participants, 0, 100); 719 $organizer = false; 720 $asOwner = false; 721 722 foreach($reference as $r => &$v){ 723 if($v['id'] == $owner['id']){ 724 $v = $owner; 725 $asOwner = true; 726 continue; 727 } 728 729 self::deepnessReadParticipant($uri, $v, $criteria, $original); 730 731 if($v['isOrganizer'] == "1" ) 732 $organizer = $v; 733 } 734 735 if(!$organizer){ 736 $organizer = Controller::find( array( 'concept' => 'participant' ) , false ,array( 'filter' => array('AND', array('=', 'schedulable' , $result['id']), array('=', 'isOrganizer', '1')), 'deepness' => 2)); 737 738 array_push($reference, $organizer[0]); 739 740 }else if($organizer && ($organizer['id'] != $owner['id'])) 741 array_merge($reference, $organizer); 742 743 if(!$asOwner) 744 array_push($reference, $owner); 745 746 $statusAttendees = array( 'default' => 0, 'accepted' => 0, 'tentative' => 0, 'cancelled' => 0, 'unanswered' => 0, 'delegated' => 0 ); 747 $statusLabels = array( 'default', 'accepted', 'tentative', 'cancelled', 'unanswered', 'delegated' ); 748 749 foreach($participants as $k => &$p){ 750 if(!$organizer && $p['isOrganizer'] == "1"){ 751 self::deepnessReadParticipant($uri, $p, $criteria, $original); 752 $reference = array_merge($reference, array($p)); 753 } 754 755 $statusAttendees[$statusLabels[$p['status']]]++; 756 } 757 758 $participants['statusAttendees'] = $statusAttendees; 759 $participants['sizeAttendees'] = $size; 760 $participants['attendees'] = $reference; 761 } 762 763 return $participants; 764 } 765 766 static function dayAlarm( &$uri , &$params , &$criteria , $original ) { 765 767 if(isset($criteria['filter'][1]) && $criteria['filter'][1] == 'date') 766 768 { … … 898 900 Controller::delete(array('concept' => 'attachment', 'id' => $original['URI']['id'])); 899 901 } 900 901 public function decodeDeleteCalendarSignatureAlarm(&$uri, &$params, &$criteria, $original) { 902 if ($original['URI']['id'] == '' && isset($original['criteria']['filter'])){ 903 Controller::deleteAll(array('concept' => 'calendarSignatureAlarm'), null,$original['criteria']); 904 return false; 905 } 906 } 902 903 public function decodeDeleteCalendarSignatureAlarm(&$uri, &$params, &$criteria, $original) { 904 if ($original['URI']['id'] == '' && isset($original['criteria']['filter'])){ 905 Controller::deleteAll(array('concept' => 'calendarSignatureAlarm'), null,$original['criteria']); 906 return false; 907 } 908 } 909 907 910 public function createDefaultSignature(&$uri, &$result, &$criteria, $original) { 908 911 … … 963 966 //Criaremos uma agenda padrão 964 967 $cal = array('name' => 'Calendario', 965 'description' => 'Calendario Padrão',968 'description' => 'Calendario Padrão', 966 969 'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 967 970 'dtstamp' => time() . '000' -
branches/2.4/prototype/modules/calendar/interceptors/Notifications.php
r6331 r6754 5 5 require_once ROOTPATH . '/plugins/icalcreator/iCalcreator.class.php'; 6 6 require_once ROOTPATH . '/api/parseTPL.php'; 7 8 use prototype\api\Config as Config; 7 9 8 10 class Notifications extends Helpers { -
branches/2.4/prototype/modules/calendar/js/calendar.codecs.js
r6588 r6754 349 349 return { 350 350 participant : meAttendee(form.attendee), 351 startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 352 endTime: Date.parseExact(form.endDate + " "+$.trim(form.endHour), formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 351 startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 352 endTime: Date.parseExact(form.endDate + " "+$.trim(form.endHour), formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 353 353 allDay: ( !!form.allDay ? 1 : 0 ), 354 354 schedulable: form.idEvent … … 499 499 500 500 var isShared = !objEvent.id ? false : (!!objEvent.calendar) && parseInt(Calendar.signatureOf[objEvent.calendar].isOwner) ? false : true; 501 var limitAttendee = false; 501 var limitAttendee = false; 502 502 503 503 return { … … 587 587 me: me, 588 588 delegatedFrom: delegatedFrom, 589 statusParticipants: (objEvent.sizeAttendees != "") ? objEvent.statusAttendees : statusParticipants, 590 sizeAttendeeLimit: (objEvent.sizeAttendees != "") ? objEvent.sizeAttendees : false 589 statusParticipants: (objEvent.sizeAttendees != "") ? objEvent.statusAttendees : statusParticipants, 590 sizeAttendeeLimit: (objEvent.sizeAttendees != "") ? objEvent.sizeAttendees : false 591 591 }; 592 592 }); … … 641 641 patati['byday'] = day.join(','); 642 642 643 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 644 645 var date = Date.parseExact( form.startDate + " "+$.trim(form.startHour) , formatString ) 646 643 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 644 645 var date = Date.parseExact( form.startDate + " "+$.trim(form.startHour) , formatString ) 646 647 647 patati['startTime'] = date.toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'); 648 648 649 649 if( !patati['byday'] ) 650 650 switch(form.frequency) { … … 657 657 break; 658 658 case 'yearly': 659 patati['byyearday'] = (1 + date.getDayOfYear()); 659 patati['byyearday'] = (1 + date.getDayOfYear()); 660 660 break; 661 661 default : … … 667 667 668 668 if (($(".endRepeat").val() == 'customDate')) 669 patati['endTime'] = Date.parseExact( $(".customDateEnd").val() + (" "+$.trim(form.endHour)) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'); 670 671 patati['interval'] = $(".eventInterval").val();669 patati['endTime'] = Date.parseExact( $(".customDateEnd").val() + (" "+$.trim(form.endHour)) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'); 670 671 patati['interval'] = $(".eventInterval").val(); 672 672 673 673 /** … … 722 722 return DataLayer.merge({ 723 723 "class": form["class"], 724 startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 725 endTime: Date.parseExact(form.endDate + " "+$.trim(form.endHour), formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), //+ (!!form.allDay ? 86400000 : 0) , 724 startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 725 endTime: Date.parseExact(form.endDate + " "+$.trim(form.endHour), formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), //+ (!!form.allDay ? 86400000 : 0) , 726 726 allDay: ( !!form.allDay ? 1 : 0 ), 727 727 id: form.idEvent, -
branches/2.4/prototype/modules/calendar/js/calendar.contentMenu.js
r6588 r6754 26 26 var schedulable = DataLayer.get('schedulable', idEvent); 27 27 28 var isRecurrence = DataLayer.get('repeat', schedulable.repeat).frequency || false; 29 30 var top = $('#divAppbox').scrollTop(); 31 28 var isRecurrence = DataLayer.get('repeat', schedulable.repeat).frequency || false; 29 30 var top = $('#divAppbox').scrollTop(); 31 32 32 var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: schedulable.id , 33 top: (event.clientY - 135 + top), left: (event.clientX - 445), 34 signature: Calendar.signatureOf[idCalendar], 35 33 top: (event.clientY - 135 + top), left: (event.clientX - 445), 34 signature: Calendar.signatureOf[idCalendar], 35 calendars: Calendar.calendars, isRecurrence: (!isRecurrence || isRecurrence == 'none') ? false : true, 36 36 idRecurrence: idRecurrence 37 37 }); 38 38 39 39 $('#context-menu-event').html(template); 40 40 41 41 var method = function(value){ 42 42 switch (value){ -
branches/2.4/prototype/modules/calendar/js/calendar.date.js
r6453 r6754 143 143 return dateFormat( date, format.replace(/m/g, 'M') ); 144 144 145 }, 146 147 toString: function(date, format){ 148 return dateFormat( date, format.replace(/M/g, 'm') ); 149 }, 150 151 decodeRange: function(date, range){ 152 return (parseInt(date.getTime()) + (range * 60000)); 145 }, 146 147 toString: function(date, format){ 148 return dateFormat( date, format.replace(/M/g, 'm') ); 149 }, 150 151 decodeRange: function(date, range){ 152 return (parseInt(date.getTime()) + (range * 60000)); 153 153 } 154 154 -
branches/2.4/prototype/modules/calendar/js/calendar.shared.js
r6613 r6754 71 71 }); 72 72 }); 73 74 75 DataLayer.commit(); 76 UI.dialogs.sharedCalendar.dialog("close"); 73 74 DataLayer.commit(); 75 UI.dialogs.sharedCalendar.dialog("close"); 77 76 }; 78 77 -
branches/2.4/prototype/modules/calendar/js/helpers.js
r6734 r6754 13 13 14 14 function validDateEvent(){ 15 16 var errors = { 17 'emptyInitData': 'Por favor, informe uma data inicial', 18 'emptyEndData': 'Por favor, informe uma data final', 19 'emptyInitHour': 'Por favor, informe uma hora inicial', 20 'emptyEndHour': 'Por favor, informe uma hora final', 21 22 'invalidInitData' : 'Data inicial inválida', 23 'invalidEndData' : 'Data final inválida', 24 25 'equalData' : 'Hora inicial igual a final', 26 'theirData' : 'Data final menor que a inicial', 27 'theirHour' : 'Hora final menor que a inicial', 28 29 'emptyOcurrence' : 'Por favor, informe o número de ocorrências', 30 'invalidOcurrence' : 'Por favor, informe um valor válido para a quantidade de ocorrências', 31 32 'emptyInterval' : 'Por favor, informe o intervalo', 33 'invalidInterval' : 'Por favor informe um valor válido para o intervalo' 34 }; 15 16 var errors = { 17 'emptyInitData': 'Por favor, informe uma data inicial', 18 'emptyEndData': 'Por favor, informe uma data final', 19 'emptyInitHour': 'Por favor, informe uma hora inicial', 20 'emptyEndHour': 'Por favor, informe uma hora final', 21 22 'invalidInitData' : 'Data inicial inválida', 23 'invalidEndData' : 'Data final inválida', 24 25 'equalData' : 'Hora inicial igual a final', 26 'theirData' : 'Data final menor que a inicial', 27 'theirHour' : 'Hora final menor que a inicial', 28 29 'emptyOcurrence' : 'Por favor, informe o número de ocorrências', 30 'invalidOcurrence' : 'Por favor, informe um valor válido para a quantidade de ocorrências', 31 32 'emptyInterval' : 'Por favor, informe o intervalo', 33 'invalidInterval' : 'Por favor informe um valor válido para o intervalo' 34 }; 35 35 36 36 var start_date = $(".new-event-win.active .start-date").val(); … … 44 44 45 45 if(start_date == "") 46 return errors['emptyInitData'];46 return errors['emptyInitData']; 47 47 else if(end_date == "") 48 return errors['emptyEndData'];48 return errors['emptyEndData']; 49 49 else if(!isAllDay && start_time == "") 50 return errors['emptyInitHour'];50 return errors['emptyInitHour']; 51 51 else if(!isAllDay && end_time == "") 52 return errors['emptyEndHour'];53 54 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat;55 56 var startDate = Date.parseExact( start_date + " " + $.trim(start_time) , formatString );57 var endDate = Date.parseExact( end_date + " " + $.trim(end_time) , formatString );52 return errors['emptyEndHour']; 53 54 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 55 56 var startDate = Date.parseExact( start_date + " " + $.trim(start_time) , formatString ); 57 var endDate = Date.parseExact( end_date + " " + $.trim(end_time) , formatString ); 58 58 59 59 if(startDate == null || startDate.getTime() < 0 ) 60 return errors['invalidInitData'];60 return errors['invalidInitData']; 61 61 if(endDate == null || endDate.getTime() < 0) 62 return errors['invalidEndData'];63 64 if(isAllDay){ 65 startDate.clearTime(); 66 endDate.clearTime(); 67 if(endDate.compareTo(startDate) == -1) 68 return errors['theirData']; 69 }else{ 70 var condition = endDate.compareTo(startDate); 71 if(condition != 1){72 if(condition < 0){73 startDate.clearTime();74 endDate.clearTime();75 condition = endDate.compareTo(startDate);76 return (errors[ condition == 0 ? 'theirHour' : 'theirData'] );77 }78 else79 return errors['equalData'];80 81 62 return errors['invalidEndData']; 63 64 if(isAllDay){ 65 startDate.clearTime(); 66 endDate.clearTime(); 67 if(endDate.compareTo(startDate) == -1) 68 return errors['theirData']; 69 }else{ 70 var condition = endDate.compareTo(startDate); 71 if(condition != 1){ 72 if(condition < 0){ 73 startDate.clearTime(); 74 endDate.clearTime(); 75 condition = endDate.compareTo(startDate); 76 return (errors[ condition == 0 ? 'theirHour' : 'theirData'] ); 77 } 78 else 79 return errors['equalData']; 80 } 81 } 82 82 83 if (customDate)84 if ( !($('.new-event-win.active .customDateEnd').val().length) ) 85 return errors['emptyEndData']; 86 87 if (occurrences){88 if ( !($('.occurrencesEnd').val().length) )89 return errors['emptyOcurrence']; 90 else if (parseInt($('.occurrencesEnd').val(),10) <= 0 || parseInt($('.occurrencesEnd').val(),10).toString() == "NaN") 91 return errors['invalidOcurrence']; 92 } 83 if (customDate) 84 if ( !($('.new-event-win.active .customDateEnd').val().length) ) 85 return errors['emptyEndData']; 86 87 if (occurrences){ 88 if ( !($('.occurrencesEnd').val().length) ) 89 return errors['emptyOcurrence']; 90 else if (parseInt($('.occurrencesEnd').val(),10) <= 0 || parseInt($('.occurrencesEnd').val(),10).toString() == "NaN") 91 return errors['invalidOcurrence']; 92 } 93 93 94 94 if (!($('.new-event-win.active p.input-group.finish_event.repeat-in').hasClass('hidden'))){ 95 95 if (!eventInterval.length) 96 return errors['emptyInterval'];96 return errors['emptyInterval']; 97 97 else if (parseInt(eventInterval,10) < 1 || parseInt(eventInterval,10).toString() == "NaN") 98 return errors['invalidInterval'];98 return errors['invalidInterval']; 99 99 } 100 100 return false; … … 337 337 $('.qtip-active').find('input[name="'+acl_names[aclsParticipant.charAt(i)]+'"]').attr('checked', true); 338 338 } 339 340 $('.qtip .button').button(); 339 341 340 341 $('.qtip .button').button();342 342 }; 343 343 }else{ … … 402 402 position: 'center', 403 403 close: function(event, ui) { 404 404 /** 405 405 * Remove tooltip possivelmente existente 406 406 */ 407 if ($('.qtip.qtip-blue.qtip-active').length) 408 $('.qtip.qtip-blue.qtip-active').qtip('destroy'); 409 attendees = {}; 410 407 if ($('.qtip.qtip-blue.qtip-active').length) 408 $('.qtip.qtip-blue.qtip-active').qtip('destroy'); 409 attendees = {}; 411 410 }, 412 411 beforeClose: function(event, ui) { … … 442 441 zebraDiscardEventDialog = false; 443 442 } 444 445 /**446 * Uma vez aberta uma janela de confirmação (Zebra_Dialog), ao fechá-la447 * com ESC, para que o evento ESC não seja propagado para fechamento da 448 * janela de edição de eventos, deve ser setada uma flag indicando que 449 * já existe uma janela de confirmação aberta. 450 */ 443 444 /** 445 * Uma vez aberta uma janela de confirmação (Zebra_Dialog), ao fechá-la 446 * com ESC, para que o evento ESC não seja propagado para fechamento da 447 * janela de edição de eventos, deve ser setada uma flag indicando que 448 * já existe uma janela de confirmação aberta. 449 */ 451 450 if (!clicked) { 452 451 window.setTimeout(function() { … … 462 461 //DataLayer.rollback(); 463 462 return canDiscardEventDialog; 464 }, 465 dragStart: function(event, ui) { 466 if ($('.qtip.qtip-blue.qtip-active').length) 467 463 }, 464 dragStart: function(event, ui) { 465 if ($('.qtip.qtip-blue.qtip-active').length) 466 $('.qtip.qtip-blue.qtip-active').qtip('destroy'); 468 467 } 469 468 }); … … 473 472 } 474 473 475 var tabs = UI.dialogs.addEvent.children('.content').tabs({ 476 select: function(event, ui) {477 if ($('.qtip.qtip-blue.qtip-active').length) 478 $('.qtip.qtip-blue.qtip-active').qtip('destroy'); 479 } 480 474 var tabs = UI.dialogs.addEvent.children('.content').tabs({ 475 select: function(event, ui) { 476 if ($('.qtip.qtip-blue.qtip-active').length) 477 $('.qtip.qtip-blue.qtip-active').qtip('destroy'); 478 } 479 }); 481 480 var calendar = DataLayer.get('calendar', objEvent.calendar); 482 481 … … 493 492 494 493 UI.dialogs.addEvent.find('#calendar_addevent_details3').html(repeatHtml); 495 $(".date").datepicker({ 496 dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy') 497 }); 494 $(".date").datepicker({ 495 dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy') 496 }); 498 497 499 498 if(objEvent.repeat) … … 675 674 } 676 675 677 /*Seleciona a agenda padrão para visualização/edição de um evento*/ 678 if(objEvent.id) 679 UI.dialogs.addEvent.find('option[value="'+objEvent.calendar+'"]').attr('selected','selected').trigger('change'); 680 676 /*Seleciona a agenda padrão para visualização/edição de um evento*/ 677 if(objEvent.id) 678 UI.dialogs.addEvent.find('option[value="'+objEvent.calendar+'"]').attr('selected','selected').trigger('change'); 679 681 680 /*Adicionar alarms padrões, quando alterado a agenda do usuário*/ 682 681 UI.dialogs.addEvent.find('select[name="calendar"]').change(function(){ … … 704 703 } 705 704 706 var participant = UI.dialogs.addEvent.find('dd.me input[name="attendee[]"]').val(); 707 var calendar = $(this).val();708 709 if( !parseInt(Calendar.signatureOf[calendar].isOwner) ){710 var signature = Calendar.signatureOf[calendar]; 705 var participant = UI.dialogs.addEvent.find('dd.me input[name="attendee[]"]').val(); 706 var calendar = $(this).val(); 707 708 if( !parseInt(Calendar.signatureOf[calendar].isOwner) ){ 709 var signature = Calendar.signatureOf[calendar]; 711 710 var organizer = DataLayer.get('calendarSignature', { 712 711 filter: ['AND', ['=','calendar',signature.calendar.id], ['=','isOwner','1']], … … 1554 1553 if(acls.remove) 1555 1554 UI.dialogs.addEvent.find('.button.remove').show(); 1556 1557 UI.dialogs.addEvent.find('.button.cancel').show(); 1555 1556 UI.dialogs.addEvent.find('.button.cancel').show(); 1558 1557 } 1559 1558 … … 1561 1560 1562 1561 /*Seleciona a agenda padrão para criação de um evento*/ 1563 if(!objEvent.id){ 1564 var selectedCalendar = (objEvent.calendar != undefined) ? objEvent.calendar : (User.preferences.defaultCalendar ? User.preferences.defaultCalendar : myCalendar()); 1565 UI.dialogs.addEvent.find('option[value="'+selectedCalendar+'"]').attr('selected','selected').trigger('change'); 1566 } 1562 if(!objEvent.id){ 1563 var selectedCalendar = (objEvent.calendar != undefined) ? objEvent.calendar : (User.preferences.defaultCalendar ? User.preferences.defaultCalendar : myCalendar()); 1564 UI.dialogs.addEvent.find('option[value="'+selectedCalendar+'"]').attr('selected','selected').trigger('change'); 1565 } 1567 1566 UI.dialogs.addEvent.find(':input').change(function(event){ 1568 1567 if (event.keyCode != '27' && event.keyCode != '13') … … 1697 1696 var signatures = []; 1698 1697 var previewActiveCalendarConf = 0; 1699 var calendarAlarms = []; 1700 1698 var calendarAlarms = []; 1699 1701 1700 for (var i=0; i<Calendar.signatures.length; i++) { 1702 1701 calendars[i] = Calendar.signatures[i].calendar; … … 1722 1721 var populateAccordionOnActive = function(event, ui) { 1723 1722 var nowActive = (typeof(event) == 'number') ? event : $(event.target).accordion( "option", "active" ); 1724 if (nowActive === false) 1725 1723 if (nowActive === false) 1724 return; 1726 1725 dataColorPicker.colorsDefined = { 1727 1726 border: '#'+signatures[nowActive].borderColor, … … 1746 1745 }); 1747 1746 form_content.find('.button').button(); 1748 jQuery('.preferences-alarms-list').find('.button.remove').click(function(el){ 1749 calendarAlarms[calendarAlarms.length] = $(this).parent('li').find('input[name="alarmId[]"]').val(); 1750 $(this).parent().remove(); 1751 }); 1747 jQuery('.preferences-alarms-list').find('.button.remove').click(function(el){ 1748 calendarAlarms[calendarAlarms.length] = $(this).parent('li').find('input[name="alarmId[]"]').val(); 1749 $(this).parent().remove(); 1750 }); 1752 1751 1753 1752 DataLayer.render( 'templates/timezone_list.ejs', {}, function( timezones_options ){ … … 1868 1867 var template_content = jQuery('#configure_tab').html( template ).find('.configure-calendars-win'); 1869 1868 template_content.find('.button').button().filter('.save').click(function(evt){ 1870 if(calendarAlarms.length) 1871 DataLayer.removeFilter('calendarSignatureAlarm', {filter: ['IN','id', calendarAlarms]}); 1869 if(calendarAlarms.length) 1870 DataLayer.removeFilter('calendarSignatureAlarm', {filter: ['IN','id', calendarAlarms]}); 1872 1871 template_content.find('form').submit(); 1873 1872 $tabs.tabs( "remove", "#configure_tab"); … … 1877 1876 refresh_calendars(); 1878 1877 }); 1879 if(calendarAlarms.length) 1880 Calendar.load(); 1878 if(calendarAlarms.length) 1879 Calendar.load(); 1881 1880 }).end().filter('.cancel').click(function(evt){ 1882 1881 $tabs.tabs( "remove", "#configure_tab"); … … 1904 1903 1905 1904 } else { 1906 $('.positionHelper').css('display','none');1907 1905 $('.positionHelper').css('display','none'); 1906 $('.cal-list-options-btn').removeClass('fg-menu-open ui-state-active'); 1908 1907 $tabs.tabs("select", "#configure_tab"); 1909 1908 $('.accordion-user-calendars').accordion( "activate" , previewActiveCalendarConf ); … … 2070 2069 var meu_container = $(".calendars-list").html( html ); 2071 2070 2072 var doMenu = function(){ 2073 $('ul.list-calendars .cal-list-options-btn').each(function(){2074 $(this).menu({2075 content: $(this).next().html(),2076 width: '120',2077 positionOpts: {2078 posX: 'left',2079 posY: 'bottom',2080 offsetX: 0,2081 offsetY: 0,2082 directionH: 'right',2083 directionV: 'down',2084 detectH: true, // do horizontal collision detection2085 detectV: true, // do vertical collision detection2086 linkToFront: false2087 },2088 flyOut: true,2089 showSpeed: 100,2090 crumbDefaultText: '>'2091 });2092 }); 2093 } 2094 doMenu(); 2095 $('#divAppbox').on('scroll',function(){ 2096 if ($('.cal-list-options-btn.fg-menu-open.ui-state-active')){ 2097 var offset = $('.cal-list-options-btn.fg-menu-open.ui-state-active').offset(); 2098 if (offset) 2099 $('.positionHelper').css('top',offset.top); 2100 } 2101 }); 2102 $('ul.list-calendars .cal-list-options-btn').on('click',function(){doMenu();}); 2103 2071 var doMenu = function(){ 2072 $('ul.list-calendars .cal-list-options-btn').each(function(){ 2073 $(this).menu({ 2074 content: $(this).next().html(), 2075 width: '120', 2076 positionOpts: { 2077 posX: 'left', 2078 posY: 'bottom', 2079 offsetX: 0, 2080 offsetY: 0, 2081 directionH: 'right', 2082 directionV: 'down', 2083 detectH: true, // do horizontal collision detection 2084 detectV: true, // do vertical collision detection 2085 linkToFront: false 2086 }, 2087 flyOut: true, 2088 showSpeed: 100, 2089 crumbDefaultText: '>' 2090 }); 2091 }); 2092 } 2093 doMenu(); 2094 $('#divAppbox').on('scroll',function(){ 2095 if ($('.cal-list-options-btn.fg-menu-open.ui-state-active')){ 2096 var offset = $('.cal-list-options-btn.fg-menu-open.ui-state-active').offset(); 2097 if (offset) 2098 $('.positionHelper').css('top',offset.top); 2099 } 2100 }); 2101 $('ul.list-calendars .cal-list-options-btn').on('click',function(){doMenu();}); 2102 2104 2103 meu_container.find(".button.new-calendar").button({ 2105 2104 icons: { … … 2544 2543 // não há resultados 2545 2544 2546 var currentView = '#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || ''); 2545 var currentView = '#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || ''); 2547 2546 2548 2547 if ((((typeof(results) == 'undefined') || (!results.events_list )) && selecteds) &&(keyword != '' && keyword != null)) { 2549 $(currentView).html( 2550 '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 2551 '<label>Não foi encontrado nenhum evento correspondente à sua pesquisa.</label>' + 2552 '</div>' 2548 $(currentView).html( 2549 '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 2550 '<label>Não foi encontrado nenhum evento correspondente à sua pesquisa.</label>' + 2551 '</div>' 2553 2552 ); 2554 2553 // há resultados e Agendas Selecionadas 2555 2554 } else{ 2556 2555 if(typeof(results) != 'undefined'){ 2557 results['page_index'] = page_index; 2558 results['keyword'] = keyword;2559 2560 DataLayer.render( 'templates/event_list.ejs', results, function( html ){2561 2562 $(currentView).html( html );2563 $('.events-list-win .menu-container .button').button();2564 2565 $(".event-details-item").parent().click(function(){2566 2567 $(this).siblings("div.details-event-list").toggleClass("hidden")2568 .find('.button.delete').click(function(){2569 var eventId = $(this).siblings('[name="eventid"]').val();2570 var calendarId = $(this).siblings('[name="calendarid"]').val();2571 2572 remove_event(eventId, calendarId);2573 })2574 .end().find('.button.edit').click(function(){2575 eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true );2576 });2577 2578 });2579 paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search', !!view ? view : User.preferences.defaultCalView);2556 results['page_index'] = page_index; 2557 results['keyword'] = keyword; 2558 2559 DataLayer.render( 'templates/event_list.ejs', results, function( html ){ 2560 2561 $(currentView).html( html ); 2562 $('.events-list-win .menu-container .button').button(); 2563 2564 $(".event-details-item").parent().click(function(){ 2565 2566 $(this).siblings("div.details-event-list").toggleClass("hidden") 2567 .find('.button.delete').click(function(){ 2568 var eventId = $(this).siblings('[name="eventid"]').val(); 2569 var calendarId = $(this).siblings('[name="calendarid"]').val(); 2570 2571 remove_event(eventId, calendarId); 2572 }) 2573 .end().find('.button.edit').click(function(){ 2574 eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true ); 2575 }); 2576 2577 }); 2578 paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search', !!view ? view : User.preferences.defaultCalView); 2580 2579 }); 2581 2580 }else{ 2582 $(currentView).html(2583 '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 2584 '<input type="hidden" name="page_index" value="'+page_index+'"></inpunt>'+ 2585 '<input type="hidden" name="keyword" value="'+keyword+'"></inpunt>'+ 2586 '<label class="empty-result">Não foram encontrados eventos neste intervalo.</label>' + 2587 '</div>' 2588 ); 2589 paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView); 2590 } 2591 } 2592 if(currentView != '#tab_events_list_') 2593 $tabs.tabs("select", currentView); 2581 $(currentView).html( 2582 '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 2583 '<input type="hidden" name="page_index" value="'+page_index+'"></inpunt>'+ 2584 '<input type="hidden" name="keyword" value="'+keyword+'"></inpunt>'+ 2585 '<label class="empty-result">Não foram encontrados eventos neste intervalo.</label>' + 2586 '</div>' 2587 ); 2588 paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView); 2589 } 2590 } 2591 if(currentView != '#tab_events_list_') 2592 $tabs.tabs("select", currentView); 2594 2593 } 2595 2594 … … 2806 2805 2807 2806 } 2808 } 2809 2810 function messageHelper(msg, isShow){ 2811 if(isShow) 2812 new $.Zebra_Dialog('<span style="width: 50px; height: 50px;">'+ 2813 '<img src="'+DataLayer.dispatchPath+'/modules/calendar/img/loading.gif"></img>'+ 2814 '</span><label class="messagesHelpers"> '+ msg +' </label>' , { 2815 'buttons': false, 2816 'modal': true, 2817 'overlay_opacity': '0.5', 2818 'keyboard': false, 2819 'overlay_close': false, 2820 'type': false, 2821 'custom_class': 'messagesHelpersExpressoCalendar' 2822 } 2823 ); 2824 else{ 2825 $('.messagesHelpersExpressoCalendar').remove(); 2826 $('.ZebraDialogOverlay').remove(); 2827 } 2828 } 2807 } 2808 2809 function messageHelper(msg, isShow){ 2810 if(isShow) 2811 new $.Zebra_Dialog('<span style="width: 50px; height: 50px;">'+ 2812 '<img src="'+DataLayer.dispatchPath+'/modules/calendar/img/loading.gif"></img>'+ 2813 '</span><label class="messagesHelpers"> '+ msg +' </label>' , { 2814 'buttons': false, 2815 'modal': true, 2816 'overlay_opacity': '0.5', 2817 'keyboard': false, 2818 'overlay_close': false, 2819 'type': false, 2820 'custom_class': 'messagesHelpersExpressoCalendar' 2821 } 2822 ); 2823 else{ 2824 $('.messagesHelpersExpressoCalendar').remove(); 2825 $('.ZebraDialogOverlay').remove(); 2826 } 2827 } -
branches/2.4/prototype/modules/calendar/templates/attendee_add.ejs
r6656 r6754 3 3 %> 4 4 <dl class="block-attendee-list attendees-list"> 5 <dt class="me"><%= data.event.me.user ? data.event.me.user.name : data.event.me.name %></dt> 5 <dt class="me"><%= data.event.me.user ? data.event.me.user.name : data.event.me.name %></dt> 6 6 <dd class="me"> 7 7 <select class="status" name="status" <%= data.event.isAttendee ? '' : 'disabled' %>> … … 39 39 <dd class="attendee-list"> 40 40 <ul class="attendee-list"> 41 <% if (data.event.isAttendee && !data.event.acl.organization){ %> 42 <label for="attendee" title="<%= data.event.me.user ? data.event.me.user.mail : data.event.me.mail %>" class="mail hidden"></label> 43 <%}%> 41 <% if (data.event.isAttendee && !data.event.acl.organization){ %> 42 <label for="attendee" title="<%= data.event.me.user ? data.event.me.user.mail : data.event.me.mail %>" class="mail hidden"></label> 43 <%}%> 44 44 45 <li class="organizer <%= (data.event.acl.organization) ? "hidden" : "" %>"> 45 46 <div style="overflow:hidden; width:100%; display:table;"> … … 148 149 <% if (data.event && data.event.attendee.length > 0) { %> 149 150 <ul class="attendees-count"> 150 <li><label>Sim:</label><%=data.event.statusParticipants.accepted%></li>151 <li><label>Sim:</label><%=data.event.statusParticipants.accepted%></li> 151 152 <li><label>Não:</label><%=data.event.statusParticipants.cancelled%></li> 152 153 <li><label>Talvez:</label><%=data.event.statusParticipants.tentative%></li> 153 154 <li><label>Aguardando:</label><%=data.event.statusParticipants.unanswered%></li> 154 </ul> 155 <% } %> 156 <% if (data.event && data.event.sizeAttendeeLimit){%> 157 <ul class="attendees-count"> 158 <li>Evento com muitos participantes, exibindo os 100 primeiros!</li> 159 </ul> 155 </ul> 156 <% } %> 157 <% if (data.event && data.event.sizeAttendeeLimit){%> 158 <ul class="attendees-count"> 159 <li>Evento com muitos participantes, exibindo os 100 primeiros!</li> 160 </ul> 160 161 <% } %> 161 162 </dd> -
branches/2.4/prototype/modules/calendar/templates/event_add.ejs
r6586 r6754 225 225 <div title="" class="menu-container footer-container menu-addevent"> 226 226 <% if (data.event.id) { %> 227 <a title="Exportar" class="button export" href="#">Exportar</a> 228 <a title="Excluir" class="button delete" href="#">Excluir</a> 227 <a title="Exportar" class="button export" href="#">Exportar</a> 228 <a title="Excluir" class="button delete" href="#">Excluir</a> 229 229 <% } %> 230 <a title="Cancelar" class="button cancel" href="#">Cancelar</a> 231 <a title="Salvar" class="button save" href="#">Salvar</a> 230 <a title="Cancelar" class="button cancel" href="#">Cancelar</a> 231 <a title="Salvar" class="button save" href="#">Salvar</a> 232 232 </div> 233 233 </div> -
branches/2.4/prototype/modules/calendar/templates/event_list.ejs
r6586 r6754 168 168 <input name="eventid" type="hidden" value="<%=_event.id%>"></input> 169 169 <input name="calendarid" type="hidden" value="<%=_event.calendar%>"></input> 170 <a title="Excluir" class="button delete" href="#">Excluir</a> 171 170 <a title="Excluir" class="button delete" href="#">Excluir</a> 171 <a title="Editar" class="button edit" href="#">Editar</a> 172 172 </div> 173 173 </div> -
branches/2.4/prototype/modules/calendar/templates/index.ejs
r6586 r6754 102 102 <body> 103 103 <div id="wrap" class="expresso-calendar-container" style="text-align:left;"> 104 <div title="Configura ções" class="block-horizontal-toolbox">104 <div title="Configurações" class="block-horizontal-toolbox"> 105 105 <a class="button config-menu main-config-menu" href="#"></a> 106 106 <div class="main-config-menu-content hidden">
Note: See TracChangeset
for help on using the changeset viewer.