Changeset 6754 for branches/2.4/prototype
- Timestamp:
- 07/11/12 11:45:10 (12 years ago)
- Location:
- branches/2.4
- Files:
-
- 46 edited
- 240 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/api/config.php
r5764 r6754 1 1 <?php 2 3 namespace prototype\api; 2 4 3 5 class Config 4 6 { 5 6 7 static $register; 8 static $sessionStarted; 7 9 8 9 10 11 12 10 static function module($config , $module = false) 11 { 12 //Todo: registrar na nova api o currentapp 13 if(!$module) 14 $module = $_SESSION['flags']['currentapp']; 13 15 14 15 16 if( !isset( $_SESSION['config'][$module] ) || !isset( $_SESSION['config'][$module][$config] )) 17 $_SESSION['config'][$module] = parse_ini_file( ROOTPATH."/config/$module.ini", true ); 16 18 17 19 return isset($_SESSION['config'][$module][$config]) ? $_SESSION['config'][$module][$config] : false; 18 20 19 21 } 20 22 21 22 23 static function me($config) 24 { 23 25 24 25 26 return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; 27 } 26 28 27 28 29 30 29 static function service( $service , $config ) 30 { 31 if( !isset( $_SESSION['wallet'][$service] ) || !isset( $_SESSION['wallet'][$service][$config] )) 32 $_SESSION['wallet'][$service] = parse_ini_file( ROOTPATH."/config/$service.srv", true ); 31 33 32 33 34 return (isset($_SESSION['wallet'][$service][$config])) ? $_SESSION['wallet'][$service][$config] : false; 35 } 34 36 35 36 37 37 static function get( $concept , $config = false , $module = false ) 38 { 39 $load = parse_ini_file( ROOTPATH."/config/$concept.ini", true ); 38 40 39 41 if($config === false) return $load; 40 42 41 42 43 return (isset($load[$config])) ? $load[$config] : false; 44 } 43 45 44 45 46 47 48 49 50 51 46 static function regSet( $name , $value) 47 { 48 self::$register[$name] = $value; 49 } 50 static function regGet ($name ) 51 { 52 return (isset(self::$register[$name]) ? self::$register[$name] : false ); 53 } 52 54 53 static function init( ) 54 { 55 static function init( ) 56 { 57 58 if( !defined( 'ROOTPATH' ) ) 59 define( 'ROOTPATH', dirname(__FILE__).'/..' ); 55 60 56 if( !defined( 'ROOTPATH' ) ) 57 define( 'ROOTPATH', dirname(__FILE__).'/..' ); 58 59 if ( isset( $_COOKIE[ 'sessionid' ] ) ) 60 { 61 session_id( $_COOKIE[ 'sessionid' ] ); 62 $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ]; 63 } 61 if ( isset( $_COOKIE[ 'sessionid' ] ) ) 62 { 63 session_id( $_COOKIE[ 'sessionid' ] ); 64 $GLOBALS['phpgw']->session->sessionid = $_COOKIE[ 'sessionid' ]; 65 } 64 66 65 67 if( !self::$sessionStarted ) 66 self::$sessionStarted = session_start(); 67 // 68 // if( $header === true ) 69 // { 70 // require_once (dirname(__FILE__).'/../../header.inc.php'); 71 // 72 // $_SESSION['wallet']['Sieve']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; 73 // $_SESSION['wallet']['Sieve']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; 74 // 75 // $_SESSION['wallet']['Cyrus']['user'] = $GLOBALS['phpgw_info']['user']['account_lid']; 76 // $_SESSION['wallet']['Cyrus']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; 77 // 78 // $_SESSION['wallet']['user']['uid'] = $GLOBALS['phpgw_info']['user']['userid']; 79 // $_SESSION['wallet']['user']['uidNumber'] = $GLOBALS['phpgw_info']['user']['account_id']; 80 // $_SESSION['wallet']['user']['password'] = $GLOBALS['phpgw_info']['user']['passwd']; 81 // $_SESSION['wallet']['user']['cn'] = $GLOBALS['phpgw_info']['user']['cn']; 82 // $_SESSION['wallet']['user']['mail'] = $GLOBALS['phpgw_info']['user']['email']; 83 // 84 // $_SESSION['wallet']['PostgreSQL']['user'] = $GLOBALS['phpgw_info']['server']['db_user']; 85 // $_SESSION['wallet']['PostgreSQL']['password'] = $GLOBALS['phpgw_info']['server']['db_pass']; 86 // $_SESSION['wallet']['PostgreSQL']['dbname'] = $GLOBALS['phpgw_info']['server']['db_name']; 87 // $_SESSION['wallet']['PostgreSQL']['host'] = $GLOBALS['phpgw_info']['server']['db_host']; 88 // 89 // $_SESSION['wallet']['OpenLDAP']['context'] = $GLOBALS['phpgw_info']['server']['ldap_context']; 90 // $_SESSION['wallet']['OpenLDAP']['host'] = $GLOBALS['phpgw_info']['server']['ldap_host']; 91 // 92 // } 68 self::$sessionStarted = session_start(); 93 69 94 } 70 } 71 72 public static function writeIniFile($assoc_arr, $path, $has_sections) 73 { 74 $content = ''; 75 self::_writeIniFile($content, $assoc_arr, $has_sections); 76 if( file_put_contents($path, $content) === false) 77 { 78 trigger_error("Permission failure when trying to write in the file: $path ", E_USER_WARNING); 79 return false; 80 } 81 return true; 82 } 83 84 private static function _writeIniFile(&$content, $assoc_arr, $has_sections) 85 { 86 foreach ($assoc_arr as $key => $val) 87 { 88 if (is_array($val)) 89 { 90 if($has_sections) 91 { 92 $content .= "[$key]\n"; 93 self::_writeIniFile(&$content, $val, false); 94 } 95 else 96 foreach($val as $iKey => $iVal) 97 { 98 if (is_int($iKey)) 99 $content .= $key ."[] = $iVal\n"; 100 else 101 $content .= $key ."[$iKey] = $iVal\n"; 102 } 103 } 104 else 105 $content .= "$key = $val\n"; 106 } 107 } 95 108 96 109 } 97 110 98 111 Config::init(); 99 112 100 113 -
branches/2.4/prototype/api/controller.php
r6420 r6754 44 44 45 45 require_once(ROOTPATH.'/api/config.php'); 46 46 use prototype\api\Config as Config; 47 47 /** 48 48 TODO list: -
branches/2.4/prototype/api/datalayer.js
r6453 r6754 1 2 (function($){$.parseQuery=function(options){var config={query:window.location.search||""},params={};if(typeof options==='string'){options={query:options};} 3 $.extend(config,$.parseQuery,options);config.query=config.query.replace(/^\?/,'');$.each(config.query.split(config.separator),function(i,param){var pair=param.split('='),key=config.decode(pair.shift(),null).toString(),value=config.decode(pair.length?pair.join('='):null,key);if(config.array_keys(key)){params[key]=params[key]||[];params[key].push(value);}else{params[key]=value;}});return params;};$.parseQuery.decode=$.parseQuery.default_decode=function(string){return decodeURIComponent((string||"").replace('+',' '));};$.parseQuery.array_keys=function(){return false;};$.parseQuery.separator="&";}(jQuery)); 4 1 5 internalUrl = /^([A-z0-9-_]+)(:[A-z0-9-_]+)?$/; 2 6 internalUri = /^([a-zA-Z0-9-_]+)\(([a-zA-Z0-9-_]+)\):\/\/(.*)|([a-zA-Z0-9-_]+):\/\/(.*)$/; … … 57 61 58 62 jqXHR.abort(); 63 64 if( typeof options.data === "string" ) 65 options.data = $.parseQuery( options.data ); 59 66 60 67 switch( options.type.toUpperCase() ) … … 624 631 625 632 rollback: function( concept, ids ){ 626 627 if(!DataLayer.storage.cache[':diff']) 628 return false; 633 if(!DataLayer.storage.cache[':diff']) 634 return false; 629 635 if(concept){ 630 636 if(ids){ … … 1394 1400 properties: criteria.properties || '' 1395 1401 1396 } );1402 }, false, true ); 1397 1403 }, 1398 1404 -
branches/2.4/prototype/api/newcontroller.php
r5715 r6754 5 5 6 6 require_once(ROOTPATH.'/api/config.php'); 7 use prototype\api\Config as Config; 7 8 8 9 /** -
branches/2.4/prototype/config/calendarSignatureAlarm.ini
r5592 r6754 15 15 16 16 [before.delete] 17 encodeURICalendarSignatureAlarm = modules/calendar/interceptors/DBMapping.php 17 decodeDeleteCalendarSignatureAlarm = modules/calendar/interceptors/DBMapping.php 18 18 19 19 [PostgreSQL.mapping] -
branches/2.4/prototype/config/filter.ini
r6021 r6754 10 10 11 11 [before.delete] 12 deleteVacationRule = modules/filters/interceptors/FilterMapping.php 12 13 deleteRule = modules/filters/interceptors/FilterMapping.php 13 14 … … 22 23 makeId = modules/filters/interceptors/FilterMapping.php 23 24 applySieveFilter = modules/filters/interceptors/FilterMapping.php 25 verifyVacationRule = modules/filters/interceptors/FilterMapping.php 24 26 25 27 26 28 [after.update] 27 29 makeId = modules/filters/interceptors/FilterMapping.php 30 verifyVacationRule = modules/filters/interceptors/FilterMapping.php 28 31 29 32 -
branches/2.4/prototype/config/labeled.ini
r6638 r6754 1 1 ;service = PostgreSQL 2 2 ;PostgreSQL.concept = expressomail_message_label 3 3 4 service = Imap 4 5 Imap.concept = labeled -
branches/2.4/prototype/config/user.ini
r6644 r6754 44 44 givenName = givenName 45 45 sn = sn 46 dn = dn 47 vacationInfo = vacationInfo 48 vacationActive = vacationActive 46 49 displayName = displayName 47 50 mailAlternateAddress = mailAlternateAddress … … 52 55 phpgwAccountVisible = phpgwAccountVisible 53 56 gidNumber = gidNumber 57 telephoneNumber=telephoneNumber -
branches/2.4/prototype/me.php
r5399 r6754 1 1 <?php 2 3 2 require_once (dirname(__FILE__).'/api/controller.php'); 3 use prototype\api\Config as Config; 4 4 5 5 $me = Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP' , 'id' => Config::me('uidNumber'))); 6 6 7 // 8 //if(isset($_POST['refreshToken'])){ 9 // 10 // $ch = curl_init(); 11 // 12 // $restConf = parse_ini_file( __DIR__ . '/config/REST.ini', true ); 13 // 14 // $param = 'grant_type=refresh_token'; 15 // $param .= '&client_id=' . $restConf['oauth']['client_id']; 16 // $param .= '&client_secret=' . $restConf['oauth']['client_secret']; 17 // $param .= '&refresh_token=' . $_SESSION['oauth']['refresh_token']; 18 // 19 // // set URL and other appropriate options 20 // curl_setopt($ch, CURLOPT_URL, $restConf['oauth']['url_token']); 21 // curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*')); 22 // curl_setopt($ch, CURLOPT_POST, TRUE); 23 // curl_setopt($ch, CURLOPT_POSTFIELDS, $param); 24 // curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //configura para nao imprimir a saida na tela 25 // curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);//Passe um número long como parâmetro que contêm o limite de tempo, em segundos, que você permite as funções CURL levar. 26 // 27 // // grab URL and pass it to the browser 28 // $res = curl_exec($ch); 29 // 30 // // close cURL resource, and free up system resources 31 // curl_close($ch); 32 // $a = json_decode($res); 33 // 34 // if ( isset($a->access_token) ) { 35 // $_SESSION['oauth']['access_token'] = $a->access_token; 36 // $_SESSION['oauth']['expires_in'] = $a->expires_in; 37 // $_SESSION['oauth']['token_type'] = $a->token_type; 38 // $_SESSION['oauth']['scope'] = $a->scope; 39 // $_SESSION['oauth']['refresh_token'] = $a->refresh_token; 40 // $_SESSION['oauth']['client_secret'] = $restConf['oauth']['client_secret']; 41 // } else { 42 // echo json_encode(null); 43 // return; 44 // } 45 //} 46 47 48 $me['token'] = 'asdf1as5d1f56a1sdf1qw5e1q2we5qfq8ew';//$_SESSION['oauth']['access_token']; 7 49 echo json_encode( $me ); 8 50 -
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"> -
branches/2.4/prototype/modules/filters/edit-filter.ejs
r6387 r6754 124 124 %> 125 125 </select> 126 <input type="checkbox" name="actionType[]" value="alertMessage" class="alertMessage"/> 127 <label><%= get_lang("Alert message filter by sender")%></label> 126 128 </fieldset> 127 129 <fieldset> -
branches/2.4/prototype/modules/filters/filter-list.ejs
r6728 r6754 4 4 data.rules = (data.rules || []); 5 5 for (var i=0; i<data.rules.length; i++) { 6 if(data.rules[i].id != "vacation") continue; 7 %> 8 <li class="rule vacation" title="vacation"> 9 <strong class="title <%= (data.rules[i].enabled == "true")? 'enable':'disable' %>"><%= (data.rules[i].name ? data.rules[i].name : data.rules[i].id)%></strong> 10 <input type="hidden" class="id" value="<%= data.rules[i].id %>"> 11 <dl class="rule-briefing"> 12 <dt><%= get_lang("Criteria")%>:</dt> 13 <dd class="rule-briefing-criteria"> 14 <ul class="rule-briefing-criteria-list"> 15 <li><br></li> 16 </ul> 17 </dd> 18 <dt><%= get_lang("Actions")%>:</dt> 19 <dd class="rule-briefing-action"> 20 <ul class="rule-briefing-action-list"> 21 <% 22 for (var k=0; k<data.rules[i].actions.length; k++) { 23 if(data.rules[i].actions[k].type == "addflag") { 24 %> 25 <li><strong> (<%= get_lang("The filter is active for alerts") %>) </strong></li> 26 <% 27 continue; 28 } 29 %> 30 <li><strong><%= get_lang(data.rules[i].actions[k].type) %>:</strong> <%= (data.rules[i].actions[k].type == 'setflag') ? get_lang(data.rules[i].actions[k].parameter) : data.rules[i].actions[k].parameter %></li> 31 <% 32 } 33 %> 34 </ul> 35 </dd> 36 </dl> 37 <ul class="menu-control"> 38 <li><a href="#<%= data.rules[i].name %>" class="button update" title="<%= get_lang("Change rule")%> '<%= data.rules[i].name %>'"></a></li> 39 <li><a href="#<%= data.rules[i].name %>" class="button enable<%= (data.rules[i].enabled == "true")? '': ' hidden' %>" title="<%= get_lang("Disable rule")%>"></a></li> 40 <li><a href="#<%= data.rules[i].name %>" class="button disable<%= (data.rules[i].enabled == "true")? ' hidden': '' %>" title="<%= get_lang("Enable rule")%>"></a></li> 41 <li><a href="#<%= data.rules[i].name %>" class="button close" title="<%= get_lang("Delete rule")%> '<%= data.rules[i].name %>'"></a></li> 42 <li class="select" ><input type="checkbox"/></li> 43 </ul> 44 </li> 45 <% 46 } 47 %> 48 <% 49 for (var i=0; i<data.rules.length; i++) { 50 if(typeof data.rules[i].criteria == "undefined" && data.rules[i].id != "vacation") continue; 51 if(data.rules[i].id == "vacation") continue; 52 6 if(data.rules[i].id != "vacation") continue; 7 %> 8 <li class="rule vacation" title="vacation"> 9 <strong class="title <%= (data.rules[i].enabled == "true")? 'enable':'disable' %>"><%= (data.rules[i].name ? data.rules[i].name : data.rules[i].id)%></strong> 10 <input type="hidden" class="id" value="<%= data.rules[i].id %>"> 11 <dl class="rule-briefing"> 12 <dt><%= get_lang("Criteria")%>:</dt> 13 <dd class="rule-briefing-criteria"> 14 <ul class="rule-briefing-criteria-list"> 15 <li><br></li> 16 </ul> 17 </dd> 18 <dt><%= get_lang("Actions")%>:</dt> 19 <dd class="rule-briefing-action"> 20 <ul class="rule-briefing-action-list"> 21 <% 22 for (var k=0; k<data.rules[i].actions.length; k++) { 23 if(data.rules[i].actions[k].type == "addflag") { 24 %> 25 <li><strong> (<%= get_lang("The filter is active for alerts") %>) </strong></li> 26 <% 27 continue; 28 } 29 %> 30 <li><strong><%= get_lang(data.rules[i].actions[k].type) %>:</strong> <%= (data.rules[i].actions[k].type == 'setflag') ? get_lang(data.rules[i].actions[k].parameter) : data.rules[i].actions[k].parameter %></li> 31 <% 32 } 33 %> 34 </ul> 35 </dd> 36 </dl> 37 <ul class="menu-control"> 38 <li><a href="#<%= data.rules[i].name %>" class="button update" title="<%= get_lang("Change rule")%> '<%= data.rules[i].name %>'"></a></li> 39 <li><a href="#<%= data.rules[i].name %>" class="button enable<%= (data.rules[i].enabled == "true")? '': ' hidden' %>" title="<%= get_lang("Disable rule")%>"></a></li> 40 <li><a href="#<%= data.rules[i].name %>" class="button disable<%= (data.rules[i].enabled == "true")? ' hidden': '' %>" title="<%= get_lang("Enable rule")%>"></a></li> 41 <li><a href="#<%= data.rules[i].name %>" class="button close" title="<%= get_lang("Delete rule")%> '<%= data.rules[i].name %>'"></a></li> 42 <li class="select" ><input type="checkbox"/></li> 43 </ul> 44 </li> 45 <% 46 } 53 47 %> 54 <% if(data.rules[i].id == "") continue; %> 55 <li class="rule" title="<%= data.rules[i].id %>"> 48 <% 49 for (var i=0; i<data.rules.length; i++) { 50 if(typeof data.rules[i].criteria == "undefined" && data.rules[i].id != "vacation") continue; 51 if(data.rules[i].id == "vacation") continue; 52 53 %> 54 <% if(data.rules[i].id == "") continue; %> 55 <li class="rule" title="<%= data.rules[i].id %>"> 56 56 <strong class="title <%= (data.rules[i].enabled == "true")? 'enable':'disable' %>"><%= (data.rules[i].name ? data.rules[i].name : data.rules[i].id)%></strong> 57 57 <input type="hidden" class="id" value="<%= data.rules[i].id %>"> … … 80 80 <% 81 81 for (var k=0; k<data.rules[i].actions.length; k++) { 82 if(data.rules[i].actions[k].type == "addflag") { 83 %> 84 <li><strong> (<%= get_lang("The filter is active for alerts") %>) </strong></li> 85 <% 86 continue; 87 } 82 88 %> 83 89 <li><strong><%= get_lang(data.rules[i].actions[k].type) %>:</strong> <%= (data.rules[i].actions[k].type == 'setflag') ? get_lang(data.rules[i].actions[k].parameter) : data.rules[i].actions[k].parameter %></li> -
branches/2.4/prototype/modules/filters/filters.js
r6646 r6754 1 /* Verifica se a regra fora de escritório está ativa */ 1 /* 2 * Retorna as regras por remetente e que o usuário deseja ser avisado 3 */ 4 function getFromAlertRules() { 5 var filters = DataLayer.get("filter"); 6 fromRules = []; 7 var alertMessage; 8 var active; 9 for (var index in filters) { 10 alertMessage = filters[index]['alertMessage']; 11 active = filters[index]['enabled']; 12 for(var criterias in filters[index]['actions']) { 13 if (filters[index]['actions'][criterias]['type'] == 'fileinto' && alertMessage == 'true' && active == 'true') 14 fromRules[fromRules.length] = filters[index]['actions'][criterias]['parameter']; 15 } 16 } 17 return fromRules; 18 } 19 20 /* 21 * Verifica se a regra Fora de escritório está ativa 22 */ 2 23 function outOfficeVerify() { 3 24 DataLayer.remove('filter', false); … … 9 30 outoffice = true; 10 31 if(filters[index].id == "vacation" && filters[index].enabled == "true"){ 11 write_msg(get_lang("Attention, you are in out of office mode."), true); 32 write_msg(get_lang("Attention, you are in out of office mode."), true); 12 33 outoffice_active = true; 13 34 break; … … 18 39 } 19 40 20 21 /* Valida as informações do formulário de filtro de mensagens */ 41 /* 42 * Valida os campos do formulário da tela de filtros para salvar. 43 */ 22 44 valid_save = function(){ 23 45 var accord = list_container.find(".rule-details-container").accordion({autoHeight: false}); … … 53 75 error = true; 54 76 return; 55 } 77 } 56 78 }); 57 79 if(error){ … … 63 85 var criteria_list = list_container.find('[name="criteriaValue[]"]'); 64 86 var er_num = /^[0-9]+$/; 65 87 66 88 if($(".sizeRule").val() != "" && er_num.test($(".sizeRule").val()) == false) { 67 89 $.Zebra_Dialog(get_lang("Size rule must be a number"),{ … … 74 96 } 75 97 $.each(criteria_list, function(index, value){ 76 criteria += $.trim($(criteria_list[index]).val()); 98 if(($(criteria_list[index]).val() != "" && index != 5) || ($(criteria_list[index]).is(':checked'))){ 99 criteria += $.trim($(criteria_list[index]).val()); 100 } 77 101 }); 78 102 if(criteria == ""){ … … 101 125 } 102 126 }); 127 return false; 128 } 129 } 130 /*Validação ao salvar filtro com alerta*/ 131 var criteria_operator_list = list_container.find('[name="criteriaOperator[]"]'); 132 if(list_container.find('.alertMessage').is(':checked')){ 133 if($(criteria_list[0]).val() != "" && $('.select-folderlist').find('[type="radio"]').is(':checked') && $(criteria_operator_list[0]).find('option:selected').val() != "!*"){ 134 var hasValue = false; 135 $.each(criteria_list, function(index, value){ 136 if(($(criteria_list[index]).val() != "" && index != 0 && index != 5) || ($(criteria_list[index]).is(':checked'))){ 137 if($('.fields-isexact').find(':checked').val() == 'or'){ 138 hasValue = true; 139 } 140 } 141 }); 142 if(hasValue){ 143 $.Zebra_Dialog('<strong>'+get_lang('Filter with alert')+'</strong><br>'+get_lang('If more than one criterion for the filter, the "Meeting all the criteria" must be selected')); 144 return false; 145 } 146 }else{ 147 $.Zebra_Dialog('<strong>'+get_lang('Filter with alert')+'</strong><br>'+get_lang('The filter should be set as a criteria "Sender" and action "Archive folder"')); 103 148 return false; 104 149 } … … 132 177 date2Time = function (timestamp) { 133 178 var date = new Date(); 179 if( typeof timestamp === "string" ) 180 timestamp = parseInt( timestamp, 10 ); 134 181 if ((date.getTime() - timestamp) < (24*60*60*1000)) { 135 182 return '<span class="timable" title="'+timestamp+'"> </span>'; … … 143 190 144 191 keys = function( object ){ 145 192 146 193 var array = []; 147 194 148 195 for( var key in object ) 149 196 array[ array.length ] = key; 150 197 151 198 return( array ); 152 199 153 200 } 154 201 155 /* Mostra os detalhes do filtro para edição */ 202 /* 203 * Preenche o formulário de filtros com as informações originais para edição 204 */ 156 205 showDetails = function( filter ){ 157 206 158 207 form.get(0).reset(); 159 208 … … 175 224 if(filter.actions[i].type == "redirect") 176 225 actions.siblings('[name="addressRedirect"]').val(filter.actions[i].parameter); 177 if(filter.actions[i].type == "reject") 226 if(filter.actions[i].type == "reject") 178 227 actions.siblings('[name="messageReject"]').val(filter.actions[i].parameter); 179 228 if(filter.actions[i].type == "fileinto" || filter.actions[i].type == "setflag") 180 229 actions.parent().find('[value="'+filter.actions[i].parameter+'"]').attr("selected", "selected"); 181 230 } 182 isExact.filter('[value="'+(filter.isExact != "false"? "and" : "or")+'"]').attr("checked", "True"); 231 isExact.filter('[value="'+(filter.isExact != "false"? "and" : "or")+'"]').attr("checked", "True"); 232 233 if (filter.alertMessage == 'true') $('.alertMessage').attr('checked', 'True'); 183 234 } 184 235 185 236 186 237 DataLayer.codec( "filter", "detail", { 187 238 188 239 decoder: function( form ){ 189 240 if( form.vacation ) 190 241 return { 191 242 criteria: [{ value: "vacation", operator: "", field: "vacation" }], … … 199 250 200 251 var apply_messages_ = keys(selectedMessages); 201 252 202 253 action = ''; 203 254 204 255 return { 205 256 name: form.name ? form.name.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>') : nameObj.val().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'), 206 257 isExact: ( form.isExact === "and" ), 207 criteria: $.map( form.criteriaOperator || [], function( criteriaOperator, i ){ 258 criteria: $.map( form.criteriaOperator || [], function( criteriaOperator, i ){ 208 259 return (!form.criteriaValue[i]) ? null: 209 { 260 { 210 261 value: form.criteriaValue[i].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'), 211 262 operator: criteriaOperator, … … 215 266 actions: $.map( form.actionType || [], function( type, i ){ 216 267 var the_parameter = form.actionParameter[i]; 217 268 218 269 !the_parameter ? the_parameter = form.actionParameter[i+1] : ""; 270 271 if (type == 'alertMessage') { 272 //if(!$('[value="alertMessage"]').parent().hasClass("hidden")){ 273 type = 'addflag'; 274 the_parameter = '$FilteredMessage'; 275 //}else{ 276 // return; 277 //} 278 } 219 279 if (type == 'fileinto') { 220 280 the_parameter = form.valueFileInto; … … 223 283 the_parameter = form.messageReject; 224 284 } 225 if (type == 'fileintoInbox') { 285 if (type == 'fileintoInbox') { 226 286 if(!$('[value="fileintoInbox"]').parent().hasClass("hidden")){ 227 287 type = 'fileinto'; … … 238 298 the_parameter = form.addressRedirect; 239 299 } 240 if (type == 'setflag') { 300 if (type == 'setflag') { 241 301 the_parameter = form.valueSetFlag; 242 302 action = form.valueSetFlag; … … 247 307 }), 248 308 enabled : true, 309 alertMessage: $('.alertMessage').is(':checked'), 310 //applyMessages: allMessages? !$.isEmptyObject( selectedMessages ) ? 311 //keys( selectedMessages ) : allMessages : "" 249 312 applyMessages: apply_messages_ 313 //applyMessages: "" 250 314 }; 251 315 }, 252 316 253 317 encoder: function( filters ){ 254 318 var rules = []; … … 260 324 261 325 } 262 326 263 327 }); 264 328 265 329 /* Codec do datalayer */ 266 330 DataLayer.codec( "folder", "select", { 267 331 268 332 decoder:function(){ 269 333 270 334 }, 271 335 encoder:function( data ){ 272 336 273 337 var tree1 = [], tree2 = [], tree3 = []; 274 338 … … 295 359 296 360 } 297 361 298 362 return {folders: [ tree1, tree2, tree3 ]}; 299 363 … … 301 365 302 366 }); 367 368 369 fromRules = getFromAlertRules(); 303 370 304 371 var BASE_PATH = '../prototype/'; … … 310 377 var allMessages = false; 311 378 312 /* Bloqueio de usuários na tela de mensagem do ExpressoMail */ 313 function block_user_email(email) { 379 /* 380 * Bloqueia usuário por email - utilizado na tela de mensagens do ExpressoMail 381 */ 382 function block_user_email(email) { 314 383 delete selectedMessages; 315 384 var idd = urlencode(email); … … 324 393 $.Zebra_Dialog(get_lang("Lock User") + " " + email + " " + get_lang("removed")); 325 394 list_filters(); 395 getFromAlertRules(); 326 396 }); 327 397 return true; … … 331 401 } 332 402 if(confirm(get_lang("Want to block the user") + " " + email + "?")){ 333 DataLayer.put( 'filter', idd, 334 { name: email, isExact: false, 403 DataLayer.put( 'filter', idd, 404 { name: email, isExact: false, 335 405 criteria:{ 0: {value: email, operator: "=", field: "from"} }, 336 actions: { 0: {parameter: "INBOX" + cyrus_delimiter + "Spam", type: "fileinto"}}, 337 enabled: true, 406 actions: { 0: {parameter: "INBOX" + cyrus_delimiter + "Spam", type: "fileinto"}}, 407 enabled: true, 338 408 id: email, 339 block: true 409 block: true 340 410 }); 341 411 DataLayer.commit("filter", false, function(){ 342 412 $.Zebra_Dialog(get_lang("User") + " " + email + " " + get_lang("blocked")); 343 413 list_filters(); 344 }); 345 414 getFromAlertRules(); 415 }); 416 346 417 } 347 418 } 348 419 349 /* Gerencia o grid das mensagens da caixa de entrada */ 420 421 DataLayer.codec( 'message', 'jqGrid', { 422 423 encoder: function( data ){ 424 425 return( data ); 426 427 } 428 }); 429 430 /* Gerencia o grid das mensagens da caixa de entrada 431 * Mostra o grid de mensagens para aplicar a regra nas mensagens da caixa de entrada. 432 */ 350 433 function showGridMessages(thiss) { 351 434 var criteria_list = list_container.find('[name="criteriaValue[]"]'); … … 366 449 var options = ["from", "to", "subject", "body", "size"]; 367 450 var criterias_ = new Array(); 368 var j = 0; 369 for (i in criteria_) { 370 if(criteria_[i] != "") { 371 (j == 0) ? criterias_[j] = {"0": options[i], "1": criteria_value_[i], "2": criteria_[i]} : criterias_[j] = {"0": "OR", "1": options[i], "2": criteria_value_[i], "3": criteria_[i]}; 372 j++; 373 } 374 } 451 452 for (i in criteria_) 453 if(criteria_[i] != "") 454 criterias_.push( criterias_.length ? {"0": "OR", "1": options[i], "2": criteria_value_[i], "3": criteria_[i]} : {"0": options[i], "1": criteria_value_[i], "2": criteria_[i]} ); 455 375 456 showGridButton = thiss.parent(); 376 // .html('buscando mensagens...'); 377 showGridButton.siblings("#filtergrid-container").block({ 378 message: '<div id="loading-content"><div class="image"></div></div>', 379 css: { 380 backgroundImage: 'url('+BASE_PATH+'modules/attach_message/images/loading.gif)', 381 backgroundRepeat: 'no-repeat', 382 backgroundPosition: 'center', 383 backgroundColor: 'transparent', 384 width: '32px', 385 height: '32px', 386 border:'none' 387 }, 388 overlayCSS: { 389 backgroundColor: '#CCC', 390 opacity: 0.5 391 } 392 }); 393 394 $.ajax({395 url: DataLayer.basePath + 'folder/INBOX/message&' + $.param( {"filter": criterias_} ), 396 dataType: 'json',397 success: function(data){ 398 allMessages = data;399 400 var parametro = { "filter": ( data != false ? [ "msgNumber", "IN", data ] : criterias_ )};401 402 if (typeof grid !== "undefined") { 403 grid.jqGrid( 'setGridParam', { url: DataLayer.basePath + 'folder/INBOX/message&' + $.param( parametro ) } ).trigger( 'reloadGrid' );404 //return; 405 }406 grid = showGridButton.siblings("#filtergrid-container").removeClass('empty-container')407 .html('<table class="hidden fields-search-messages-grid" id="fields-search-messages-grid"><tr><td/></tr></table><div class="hidden fields-search-messages-grid-pager" id="fields-search-messages-grid-pager"></div>')408 .children(".fields-search-messages-grid, .fields-search-messages-grid-pager").removeClass('hidden').filter(".fields-search-messages-grid").trigger( 'reloadGrid' ).jqGrid({409 //url: DataLayer.basePath + 'folder/INBOX/message&' + $.param( {"filter": [ "msgNumber", "IN", data ]} ),410 url: DataLayer.basePath + 'folder/INBOX/message&' + $.param( parametro ),411 datatype: "json",412 mtype: 'GET',413 colNames:['#', 'De', 'Assunto', 'Data', 'Tamanho'],414 colModel:[415 {name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false},416 {name:'from.email',index:'msg_number', width:130, sortable:false},417 {name:'subject',index:'subject', width:250, sortable:false},418 {name:'timestamp',index:'timestamp', width:65, align:"center", sortable:false, formatter:date2Time},419 {name:'size',index:'size', width:50, align:"right", sortable:false, formatter:bytes2Size}420 ],421 jsonReader : {422 root:"rows",423 page: "page",424 total: "total",425 records: "records",426 repeatitems: false,427 id: "0"428 },429 rowNum:10,430 //rowList:[10,25,50],431 rowList:[10],432 pager: '#fields-search-messages-grid-pager',433 sortname: 'id',434 viewrecords: true,435 sortorder: "desc",436 multiselect: true,437 autowidth: true,438 reloadAfterEdit: true,439 reloadAfterSubmit: true,440 height:200,441 loadComplete: function(data) {442 // // aplica o contador443 // jQuery('.timable').each(function (i) {444 // jQuery(this).countdown({445 // since: new Date(parseInt(this.title)),446 // significant: 1,447 // layout: 'há {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}',448 // description: ' atrás'449 // });450 // });451 },452 onSelectRow: function (id, selected) {453 if( selected )454 455 selectedMessages[ id ] = true;456 }457 else458 {459 delete selectedMessages[ id ];460 }461 },462 onSelectAll: function (id, selected) {463 for (i in id) {464 if(selected)465 selectedMessages[id[i]] = true;466 else467 delete selectedMessages[id[i]];468 }469 },470 caption: 'Mensagens que atendem aos critérios'471 }); // end jqGrid472 } // end success473 }); // end ajax457 458 showGridButton.siblings("#filtergrid-container").block({ 459 message: '<div id="loading-content"><div class="image"></div></div>', 460 css: { 461 backgroundImage: 'url('+BASE_PATH+'modules/attach_message/images/loading.gif)', 462 backgroundRepeat: 'no-repeat', 463 backgroundPosition: 'center', 464 backgroundColor: 'transparent', 465 width: '32px', 466 height: '32px', 467 border:'none' 468 }, 469 overlayCSS: { 470 backgroundColor: '#CCC', 471 opacity: 0.5 472 } 473 }); 474 475 var data = DataLayer.get( 'message', { filter: criterias_, criteria: { properties: { context: { folder: 'INBOX' } } } }, true ); 476 477 DataLayer.register( 'criterias', 'message:jqGrid', function( crit ){ 478 479 crit.properties = { context: { folder: 'INBOX' } }; 480 481 return { filter: [ "msgNumber", "IN", data ], criteria: crit }; 482 }); 483 484 allMessages = data; 485 486 if (typeof grid !== "undefined") { 487 grid.jqGrid( 'setGridParam', { url: 'message:jqGrid', postData: data } ).trigger( 'reloadGrid' ); 488 //return; 489 } 490 grid = showGridButton.siblings("#filtergrid-container").removeClass('empty-container') 491 .html('<table class="hidden fields-search-messages-grid" id="fields-search-messages-grid"><tr><td/></tr></table><div class="hidden fields-search-messages-grid-pager" id="fields-search-messages-grid-pager"></div>') 492 .children(".fields-search-messages-grid, .fields-search-messages-grid-pager").removeClass('hidden').filter(".fields-search-messages-grid").trigger( 'reloadGrid' ).jqGrid({ 493 url: 'message:jqGrid', 494 datatype: "json", 495 mtype: 'GET', 496 colNames:['#', 'De', 'Assunto', 'Data', 'Tamanho'], 497 colModel:[ 498 {name:'msg_number',index:'msg_number', width:45, hidden:true, sortable:false}, 499 {name:'from.email',index:'msg_number', width:130, sortable:false}, 500 {name:'subject',index:'subject', width:250, sortable:false}, 501 {name:'timestamp',index:'timestamp', width:65, align:"center", sortable:false, formatter:date2Time}, 502 {name:'size',index:'size', width:50, align:"right", sortable:false, formatter:bytes2Size} 503 ], 504 jsonReader : { 505 root:"rows", 506 page: "page", 507 total: "total", 508 records: "records", 509 repeatitems: false, 510 id: "0" 511 }, 512 rowNum:10, 513 //rowList:[10,25,50], 514 rowList:[10], 515 pager: '#fields-search-messages-grid-pager', 516 sortname: 'id', 517 viewrecords: true, 518 sortorder: "desc", 519 multiselect: true, 520 autowidth: true, 521 reloadAfterEdit: true, 522 reloadAfterSubmit: true, 523 height:200, 524 loadComplete: function(data) { 525 // // aplica o contador 526 // jQuery('.timable').each(function (i) { 527 // jQuery(this).countdown({ 528 // since: new Date(parseInt(this.title)), 529 // significant: 1, 530 // layout: 'há {d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}', 531 // description: ' atrás' 532 // }); 533 // }); 534 }, 535 onSelectRow: function (id, selected) { 536 if( selected ) 537 { 538 selectedMessages[ id ] = true; 539 } 540 else 541 { 542 delete selectedMessages[ id ]; 543 } 544 }, 545 onSelectAll: function (id, selected) { 546 for (i in id) { 547 if(selected) 548 selectedMessages[id[i]] = true; 549 else 550 delete selectedMessages[id[i]]; 551 } 552 }, 553 caption: 'Mensagens que atendem aos critérios' 554 }); // end jqGrid 474 555 } 475 556 476 557 /* Gerencia a listagem de filtros do usuário */ 558 /* 559 * Lista os filtros para o usuário 560 */ 477 561 function list_filters(html){ 478 562 outOfficeVerify(); … … 486 570 } 487 571 list_container = $(".expresso-window-filters").dialog({ 572 title: get_lang('Filters'), 488 573 width:700, 489 574 modal: true, … … 493 578 event.stopPropagation(); 494 579 if(list_container.find(".cancel").length) 495 list_container.find(".cancel").trigger('click'); 580 list_container.find(".cancel").trigger('click'); 496 581 $(".dialog-head-buttonpane").hide(); 497 582 }, … … 516 601 $(".dialog-head-buttonpane").css("padding", "5px"). 517 602 find(".header-buttonpane").html("<a href='#' class='button add' title='"+get_lang("Add new rule")+"'>"+get_lang("New rule")+"</a>"+(!outoffice ? "<a href='#' class='button add vacation' title='"+get_lang("Add rule out of office")+"'>"+get_lang("Out of office")+"</a>" : "")).find(".button").button(); 518 603 519 604 $(".ui-dialog-buttonpane.ui-widget-content").css("background-color", "#E0EEEE"); 520 605 var list = DataLayer.render( BASE_PATH + 'modules/filters/filter-list.ejs', DataLayer.get("filter:detail", true)); 521 606 list_container.html(list).find(".button").button(); 522 607 523 608 list_container.find(".rule-list").selectable({ 524 609 selecting: function(event, ui) { … … 529 614 } 530 615 }); 531 616 532 617 list_container.find( ".menu-control .button" ).filter(".update").button({ 533 618 icons: { … … 542 627 filters = filters[i]; 543 628 break; 544 } 629 } 545 630 } 546 631 DataLayer.render( BASE_PATH + 'modules/filters/edit-filter.ejs', {folders : DataLayer.get("folder", true), delimiter: cyrus_delimiter},function(html){ … … 571 656 else 572 657 return; 573 DataLayer.commit( 'filter', false,function(){ 574 if($('#gbox_fields-search-messages-grid').length > 0 && action != '') { 658 DataLayer.commit( 'filter', false,function(data){ 659 if(filters['alertMessage'] == "true"){ 660 if(filters['alertMessage'] != $('.alertMessage').is(':checked').toString()){ 661 /**RETIRA FLAG*/ 662 removeMessagesFlag(filters['id']); 663 } 664 } 665 if($('#gbox_fields-search-messages-grid').length > 0 && action != '') { 575 666 for (var index in selectedMessages) { 576 667 set_message_flag(index, action, false); … … 578 669 } 579 670 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 671 getFromAlertRules(); 580 672 }); 581 }).end().filter('.button.search').click(function() { 673 }).end().filter('.button.search').click(function() { 582 674 /* Valida se o usuário preencheu as informações */ 583 675 if(valid_save()) … … 595 687 DataLayer.commit( 'filter', false,function(){ 596 688 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 689 getFromAlertRules(); 597 690 }); 598 691 }); … … 607 700 text: false 608 701 }).click(function(){ 609 var id = $(this).parents("li.rule").find('.id').val(); 702 var id = $(this).parents("li.rule").find('.id').val(); 610 703 DataLayer.put( 'filter', id, { enabled: false }); 704 /**RETIRA FLAG*/ 705 removeMessagesFlag(id); 611 706 DataLayer.commit("filter", false,function(){ 612 707 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 708 getFromAlertRules(); 613 709 }); 614 710 }).end() … … 624 720 DataLayer.commit("filter", false,function(){ 625 721 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 722 getFromAlertRules(); 626 723 }); 627 724 }).end() 628 725 629 726 .filter(".close").button({ 630 727 icons: { … … 644 741 DataLayer.remove('filter', false); 645 742 DataLayer.get('filter'); 743 /**RETIRA FLAG*/ 744 removeMessagesFlag(filter_name); 646 745 DataLayer.remove( 'filter', filter_name); 746 647 747 DataLayer.commit("filter", false,function(){ 648 748 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 749 getFromAlertRules(); 649 750 }); 650 751 }else{ … … 654 755 }); 655 756 }).end().removeClass("ui-button-icon-only"); 656 757 657 758 $(".button.allenable").click(function(){ 658 759 container.find('.rule-list').find('.rule').find('.select').find(':checked').parents('.rule').find('.title').each(function(i,o){ 659 DataLayer.put( 'filter', o.innerHTML, { enabled: true });760 DataLayer.put( 'filter', urlencode(o.innerHTML), { enabled: true }); 660 761 }); 661 762 DataLayer.commit("filter", false, function(){ 662 763 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 663 }); 664 }); 665 764 getFromAlertRules(); 765 }); 766 }); 767 666 768 $(".button.alldisable").click(function(){ 667 769 container.find('.rule-list').find('.rule').find('.select').find(':checked').parents('.rule').find('.title').each(function(i,o){ 668 DataLayer.put( 'filter', o.innerHTML, { enabled: false }); 770 DataLayer.put( 'filter', urlencode(o.innerHTML), { enabled: false }); 771 /**RETIRA FLAG*/ 772 removeMessagesFlag(o.innerHTML); 669 773 }); 670 774 DataLayer.commit("filter", false, function(){ 671 775 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 672 }); 673 }); 674 776 getFromAlertRules(); 777 }); 778 }); 779 675 780 $(".button.alldelete").click(function(){ 676 781 $.Zebra_Dialog(get_lang("Are you sure to delete the filters?"),{ … … 683 788 DataLayer.remove('filter', false); 684 789 DataLayer.get('filter'); 685 container.find('.rule-list').find('.rule').find('.select').find(':checked').parents('.rule').find('.title').each(function(i,o){ 686 removeMessagesFlag(urlencode(o.innerHTML)); 687 filter_Name = urlencode(o.innerHTML.replace(".", "_")); 688 DataLayer.remove( 'filter', (filter_Name) ); 790 container.find('.rule-list').find('.rule').find('.select').find(':checked').parents('.rule').find('.title').each(function(i,o){ 791 /**RETIRA FLAG*/ 792 removeMessagesFlag(urlencode(o.innerHTML)); 793 filter_Name = urlencode(o.innerHTML.replace(".", "_")); 794 DataLayer.remove( 'filter', (filter_Name) ); 689 795 }); 690 796 DataLayer.commit("filter", false,function(){ 691 797 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 798 getFromAlertRules(); 692 799 }); 693 800 }else{ … … 697 804 }); 698 805 }); 699 806 700 807 var aa = 0; 701 808 702 809 list_container.parent().find(".button.add:first").click(function(){ 703 810 list_container.parent().find(".dialog-head-buttonpane").addClass("hidden"); … … 721 828 return; 722 829 DataLayer.commit( 'filter',false,function(){ 723 if($('#gbox_fields-search-messages-grid').length > 0 && action != '') { 830 if($('#gbox_fields-search-messages-grid').length > 0 && action != '') { 724 831 for (var index in selectedMessages) { 725 832 set_message_flag(index, action, false); … … 727 834 } 728 835 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 836 getFromAlertRules(); 729 837 }); 730 }).end().filter('.button.search').click(function() { 838 }).end().filter('.button.search').click(function() { 731 839 if(valid_save()) 732 840 showGridMessages($(this)); … … 737 845 }); 738 846 list_container.parent().find(".button.add.vacation").click(function(){ 739 847 740 848 list_container.parent().find(".dialog-head-buttonpane").addClass("hidden"); 741 849 DataLayer.render( BASE_PATH + 'modules/filters/edit-filter.ejs', {folders : DataLayer.get("folder", true), delimiter: cyrus_delimiter},function(html){ … … 745 853 list_container.find(".button").button().filter(".back").click(function(){ 746 854 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 747 }).end().filter(".submit").click(function(){ 855 }).end().filter(".submit").click(function(){ 748 856 if(list_container.find(".vacation-details-container .filter-textarea").val().length <= 0){ 749 857 $.Zebra_Dialog(get_lang('Write a message')); … … 753 861 DataLayer.commit( 'filter',false,function(){ 754 862 DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 863 getFromAlertRules(); 755 864 }); 756 865 } 757 866 }); 758 }); 867 }); 759 868 }); 760 869 } 761 870 762 /* Inicializa os filtros e chama o list_filters */ 871 872 /* Inicializa os filtros e chama o list_filters 873 * Inicia a funcionalidade de filtros de mensagens 874 */ 763 875 function init_filters(){ 764 876 var html = DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {}); 765 877 list_filters(html); 766 878 } 879 880 /* 881 * Ao excluir filtro, desabilitar filtro ou retirar a ação Alerta de um filtro 882 * esta função é chamada para retirar as flags que caracterizam uma mensagem como alertada pelos Filtros por Remetente 883 */ 884 function removeMessagesFlag(id){ 885 var filters_c = DataLayer.get('filter', urlencode(id)); 886 var folder = ''; 887 var from = ''; 888 if(filters_c['actions']) 889 for(var i=0; i < filters_c['actions'].length; i++){ 890 if(filters_c['actions'][i].type == 'fileinto'){ 891 folder = filters_c['actions'][i].parameter; 892 } 893 } 894 $.each(fromRules, function(index, value) { 895 if(value == folder){ 896 for(var i=0; i < filters_c['criteria'].length; i++){ 897 if(filters_c['criteria'][i].field == 'from'){ 898 from = filters_c['criteria'][i].value; 899 } 900 } 901 cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+folder+"&from="+from, function(){}); 902 return false; 903 } 904 }); 905 } -
branches/2.4/prototype/modules/filters/interceptors/FilterMapping.php
r6590 r6754 41 41 */ 42 42 43 use prototype\api\Config as Config; 43 use prototype\api\Config as Config; 44 44 45 45 /** … … 224 224 $script_criteria .= ")"; 225 225 226 $script_action = " {\r\n "; 226 //$script_action = " {\r\n "; 227 /* Somente para controlar que o addFlag virá antes de qualquer ação. Modificar isso depois */ 228 $action_addFlag = ''; 227 229 228 230 if( is_array($action) ) … … 230 232 { 231 233 switch ($action[$k]['type']) { 234 case 'setflag': 235 $require_flag = true; 236 $action[$k]['parameter'] = "\\\\" . $action[$k]['parameter']; 237 break; 238 case 'addflag': 239 $require_flag = true; 240 $action_addFlag = "addflag \"" . $action[$k]['parameter'] . "\";\r\n "; 241 break; 232 242 case 'redirect': 233 243 break; … … 245 255 $vacation = true; 246 256 continue; 247 case 'setflag':248 $require_flag = true;249 $action[$k]['parameter'] = "\\\\" . $action[$k]['parameter'];250 break;251 257 case 'discard': 252 258 break; 253 259 } 254 if ($vacation == false ) $script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n ";260 if ($vacation == false && $action[$k]['type'] != 'addflag') $script_action .= $action[$k]['type'] . " \"" . $action[$k]['parameter'] . "\";\r\n "; 255 261 } 256 $script_action .= "}";257 262 263 /* ATENÇÃO: Colocar sempre o comando addflag antes de qualquer outro no caso de ações compostas no Sieve */ 264 if ($action_addFlag != '') $script_action = $action_addFlag . $script_action; 265 266 $script_action = "{\r\n " . $script_action . "}"; 267 $action_addFlag = ''; 258 268 if($vacation == false) 259 269 $script_rules .= $script_match . $script_criteria . $script_action . "\r\n"; … … 263 273 $script_match = ""; 264 274 $script_criteria = ""; 275 $script_action = ""; 265 276 $data['applyMessages'] = ""; 266 277 } … … 295 306 296 307 $content = $script_begin . $script_header . $script_rules . "\r\n\r\n#PseudoScript#" . "\r\n#" . $json_data; 297 308 298 309 return( $content ); 299 310 } … … 697 708 return( $return ); 698 709 } 710 711 /** 712 * Método que insere no ldap as informações do vacation 713 * 714 * @license http://www.gnu.org/copyleft/gpl.html GPL 715 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 716 * @sponsor Caixa Econômica Federal 717 * @author Cristiano Corrêa Schmidt 718 * @param <$uri> 719 * @param <$result> 720 * @param <$criteria> 721 * @param <$original> 722 * @return <void> 723 * @access public 724 */ 725 public function verifyVacationRule( &$uri , &$params , &$criteria , $original ) 726 { 727 if( $original['properties']['id'] === 'vacation' ) 728 { 729 730 $user = Controller::read(array('concept' => 'user' , 'id' => config::me('uidNumber') , 'service' => 'OpenLDAP')); 731 $ldapConf = Config::service('OpenLDAP', 'config'); 732 $con = ldap_connect( $ldapConf['host'] ); 733 ldap_set_option( $con,LDAP_OPT_PROTOCOL_VERSION, 3 ); 734 ldap_bind( $con, $ldapConf['user'], $ldapConf['password']); 735 736 $info = array(); 737 if(!in_array('Vacation', $user['objectClass'])) 738 $info['objectClass'] = 'Vacation'; 739 740 $info['vacationActive'] = strtoupper($original['properties']['enabled']); 741 742 if(isset($original['properties']['actions']) && isset($original['properties']['actions'][0]['parameter'])) 743 $info['vacationInfo'] = $original['properties']['actions'][0]['parameter']; 744 else if( !isset($user['vacationInfo']) ) 745 { 746 $rules = $this->getRules(); 747 if(is_array($rules)) 748 foreach ($rules as $rule) 749 if($rule['id'] === 'vacation') 750 $info['vacationInfo'] = $rule['actions'][0]['parameter']; 751 } 752 753 if(!in_array('Vacation', $user['objectClass'])) 754 ldap_mod_add ( $con , $user['dn'] , $info ); 755 else 756 ldap_modify ( $con , $user['dn'] , $info ); 757 758 759 ldap_close($con); 760 761 } 762 763 } 764 765 /** 766 * Método que remove do ldap as informações do vacation 767 * 768 * @license http://www.gnu.org/copyleft/gpl.html GPL 769 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 770 * @sponsor Caixa Econômica Federal 771 * @author Cristiano Corrêa Schmidt 772 * @param <$uri> 773 * @param <$result> 774 * @param <$criteria> 775 * @param <$original> 776 * @return <void> 777 * @access public 778 */ 779 public function deleteVacationRule( &$uri , &$params , &$criteria , $original ) 780 { 781 if( $original['URI']['id'] === 'vacation' ) 782 { 783 $user = Controller::read(array('concept' => 'user' , 'id' => config::me('uidNumber') , 'service' => 'OpenLDAP')); 784 $ldapConf = Config::service('OpenLDAP', 'config'); 785 $con = ldap_connect( $ldapConf['host'] ); 786 ldap_set_option( $con,LDAP_OPT_PROTOCOL_VERSION, 3 ); 787 ldap_bind( $con, $ldapConf['user'], $ldapConf['password']); 788 $info = array(); 789 $info['vacationActive'] = 'FALSE'; 790 $info['vacationInfo'] = ""; 791 ldap_modify ( $con , $user['dn'] , $info ); 792 ldap_close($con); 793 } 794 } 699 795 } -
branches/2.4/prototype/modules/mail/css/followupflag.css
r6167 r6754 53 53 .followupflag-container .background-color {margin:0; outline: 0; width: 100px; -moz-border-radius: 5px; -webkit-border-radius:5px; float: left; } 54 54 .flag-edit { background: #00820F; width: 8px; height: 6px; float:left; margin: 4px 0 -3px 5px; } 55 .flag-edited{ width: 8px; height: 6px; }55 .flag-edited{ width: 8px; height: 6px; } 56 56 .colorpicker { float: right; margin: -15px 0 0 0; } 57 57 … … 209 209 span.removeLabeledMsg {margin:0 5px 0 5px;font-weight: bold;} 210 210 span.removeLabeledMsg:hover {cursor: pointer;} 211 212 .freeow .gray:hover .background { 213 border-color: #BBB; 214 } 215 .minimize-alarm { 216 background: url("../img/minimizar.png") no-repeat scroll 0 0 transparent; 217 height: 16px; 218 position: relative; 219 width: 16px; 220 float:right; 221 margin-right:5px; 222 } 223 .maximize-alarm { 224 background: url("../img/maximizar.png") no-repeat scroll 0 0 transparent; 225 height: 16px; 226 position: relative; 227 width: 16px; 228 float:right; 229 margin-right:5px; 230 } 231 .content-alarm ul { 232 max-height: 100px; 233 overflow: auto; 234 } 235 .content-alarm { 236 margin-top: 5px; 237 } 238 .title-alarm { 239 margin-left: 90px; 240 font-size: 16px; 241 } 242 .alert-options { 243 border: none; 244 } 245 .confirm-alarm { 246 float:right; 247 } 248 .freeow .gray h2 { 249 font-size: 12px; 250 } 251 .freeow { 252 width: 325px; 253 } 254 .freeow .gray .content { 255 margin: 5px; 256 } 257 .freeow .gray .background { 258 background-color: #fafafa; 259 border: 2px solid #BBB; 260 } 261 .freeow .content { 262 margin: 5px; 263 } 264 265 .filtersDeadline .img_title { 266 background: url("../img/email.png") no-repeat scroll 0 0 transparent; 267 height: 20px; 268 position: absolute; 269 width: 20px; 270 float:left; 271 margin-left:40px; 272 top: 7px; 273 } 274 .alarmDeadline .img_title { 275 background: url("../img/flagDefault4.png") no-repeat scroll 0 0 transparent; 276 height: 10px; 277 position: absolute; 278 width: 10px; 279 float:left; 280 margin-left:42px; 281 top: 11px; 282 } 283 .doneDeadline .img_title { 284 background: url("../img/flagDone.png") no-repeat scroll 0 0 transparent; 285 height: 10px; 286 position: absolute; 287 width: 10px; 288 float:left; 289 margin-left:43px; 290 top: 11px; 291 } 292 .search-result-item { 293 border: none; 294 } 295 .td-label-search { 296 border: none; 297 } -
branches/2.4/prototype/modules/mail/interceptors/Attachments.php
r6130 r6754 47 47 * @since Classe disponibilizada na versão 2.4 48 48 */ 49 50 use prototype\api\Config as Config; 51 49 52 class Attachments { 50 53 -
branches/2.4/prototype/modules/mail/interceptors/FollowupflagSecure.php
r5611 r6754 1 1 <?php 2 3 use prototype\api\Config as Config; 4 2 5 class FollowupflagSecure { 3 6 -
branches/2.4/prototype/modules/mail/interceptors/Helpers.php
r6653 r6754 1 1 <?php 2 2 include_once ROOTPATH."/../expressoMail1_2/inc/class.imap_functions.inc.php"; 3 4 use prototype\api\Config as Config; 3 5 4 6 class Helpers { … … 41 43 $labeledsIds[] = $e['id']; 42 44 } 43 44 45 Controller::delete( array( 'concept' => 'labeled', 'service' => 'Imap' ), false, array( 'filter' => array( 'IN', 'id', $labeledsIds )) ); 45 46 … … 205 206 206 207 if(empty($params['messageId'])) 207 throw new Exception('#FollowupflagMessageIdError'); 208 else209 208 throw new Exception('#FollowupflagMessageIdError'); 209 else 210 $params = Controller::create($imap_uri, $params); 210 211 211 212 if (!$params) … … 219 220 * deste interceptor. 220 221 */ 221 222 223 224 222 223 224 225 225 226 if ($original['URI']['service'] == 'PostgreSQL') return $result; 226 227 … … 268 269 //followupflagged:PostgreSQL.after.find 269 270 public function doImapFind( &$uri , &$result , &$criteria , $original ){ 270 271 $imap_uri = $uri;271 272 $imap_uri = $uri; 272 273 $imap_uri['service'] = 'Imap'; 273 274 $imap_criteria = $original['criteria']; -
branches/2.4/prototype/modules/mail/interceptors/LabelSecure.php
r5540 r6754 1 1 <?php 2 3 use prototype\api\Config as Config; 4 2 5 class LabelSecure { 3 6 -
branches/2.4/prototype/modules/mail/js/foldertree.js
r6635 r6754 233 233 // eventnsagens : SE O DROP VIER DE UMA ABA ABERTA 234 234 else if(folder_to_move == "border_tr"){ 235 var id_msg = border_id.split("_")[0]; 235 var id_msg = border_id.split("_")[0]; 236 236 folder = $("#input_folder_"+border_id+"_r")[0] ? $("#input_folder_"+border_id+"_r").val() : (openTab.imapBox[border_id] ? openTab.imapBox[border_id]:get_current_folder()); 237 alternate_border(border_id); 237 238 move_msgs2(folder, id_msg, border_id, folder_to, to_folder_title,true); 238 239 return refresh(); -
branches/2.4/prototype/modules/mail/js/followupflag.js
r6653 r6754 1 MsgsCallbackFollowupflag = { 2 3 '#FollowupflagMessageIdError': function(){ 4 alert('Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém o atributo message-id.'); 5 }, 6 '#FollowupflagLimitError': function(){ 7 alert('Não foi possível sinalizar esta mensagem. \nDetalhes do erro: limite de flags atingido para esta pasta.'); 8 }, 9 '#FollowupflagParamsError': function(){ 10 alert('Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém todos os atributos necessários.'); 11 } 12 13 } 1 MsgsCallbackFollowupflag = { 2 3 '#FollowupflagMessageIdError': function(){ 4 alert('Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém o atributo message-id.'); 5 }, 6 '#FollowupflagLimitError': function(){ 7 alert('Não foi possível sinalizar esta mensagem. \nDetalhes do erro: limite de flags atingido para esta pasta.'); 8 }, 9 '#FollowupflagParamsError': function(){ 10 alert('Não foi possível sinalizar esta mensagem. \nDetalhes do erro: mensagem não contém todos os atributos necessários.'); 11 } 12 13 } 14 14 15 15 function updateCacheFollowupflag(msgNumber, msgFolder, op){ … … 265 265 updateCacheFollowupflag(selectedMessageIds, folders, true); 266 266 winElement.dialog("close"); 267 alarmFollowupflagged( );267 alarmFollowupflagged('followupflagAlarms'); 268 268 }); 269 269 winElement.find('.menu-configure-followupflag .save').button("option", "disabled", true); … … 342 342 DataLayer.commit(false, false, function(){ 343 343 winElement.dialog("close"); 344 alarmFollowupflagged( );344 alarmFollowupflagged('followupflagAlarms'); 345 345 }); 346 346 … … 485 485 486 486 /** 487 * constrói as duas possíveis janela de alerta, utilizando o mesmo template 487 * constrói as três possíveis janelas de alerta, utilizando o mesmo template 488 * para o parametro alert_type, espera-se vazio, followupflagAlarms ou filtersAlarms 489 * vazio: quando serão carregadas todas as modais de alarmes 490 * followupflagAlarms: quando serão carregadas as modais referentes à sinalizações 491 * filtersAlarms: quando será carregada a modal de filtros (nesse caso o parametro filter_list deve conter a lista de mensagens a ser exibida na modal) 488 492 */ 489 function alarmFollowupflagged(){ 490 $('.followupflag-alarm').remove(); 491 var toIterate = [ 492 { 493 attrDeadline: 'doneDeadline', 494 caption: {singular:'You have one undone message today:', 495 plural:"You have %1 undone messages today:" 496 }, 497 onOk: function(event){ 498 if($(event.target).parents('.doneDeadline').find('[name="stopAlert"]').is(':checked')){ 499 $.cookie("fadeCompleted", (new Date).toString("dd/MM/yyyy"), { 500 expires: 1 501 }); 502 } 503 }, 504 enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy")) 505 }, 506 { 507 attrDeadline: 'alarmDeadline', 508 caption: { 509 singular:'You have a follow up due for today:', 510 plural:'You have %1 follow ups due for today:' 511 }, 512 onOk: function(event){ 513 if($(event.target).parents('.alarmDeadline').find('[name="stopAlert"]').is(':checked')){ 514 $.cookie("fadeAlarm", (new Date).toString("dd/MM/yyyy"), { 515 expires: 1 516 }); 517 } 518 }, 519 enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")) 520 } 521 ]; 493 function alarmFollowupflagged(alert_type, filter_list){ 494 switch(alert_type){ 495 // carregar modais de sinalizadores 496 case 'followupflagAlarms': 497 $('.doneDeadline').remove(); 498 $('.alarmDeadline').remove(); 499 var toIterate = [ 500 { 501 attrDeadline: 'doneDeadline', 502 caption: {singular:'You have one undone message today:', 503 plural:"You have %1 undone messages today:" 504 }, 505 title: get_lang('Done'), 506 enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy")) 507 }, 508 { 509 attrDeadline: 'alarmDeadline', 510 caption: { 511 singular:'You have a follow up due for today:', 512 plural:'You have %1 follow ups due for today:' 513 }, 514 title: get_lang('Follow ups'), 515 enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")) 516 } 517 ]; 518 break; 519 // carregar modal de filtros 520 case 'filtersAlarms': 521 $('.filtersDeadline').remove(); 522 var toIterate = [ 523 { 524 attrDeadline: 'filtersDeadline', 525 caption: { 526 singular:'You have an archived message:', 527 plural:'You have %1 messages archived:' 528 }, 529 title: get_lang('Filter by sender'), 530 enable: ($.cookie("fadeFilterAlarm") != (new Date).toString("dd/MM/yyyy")) 531 } 532 ]; 533 break; 534 // carregar todas as modais 535 default: 536 $('.gray').remove(); 537 var toIterate = [ 538 { 539 attrDeadline: 'filtersDeadline', 540 caption: { 541 singular:'You have an archived message:', 542 plural:'You have %1 messages archived:' 543 }, 544 title: get_lang('Filter by sender'), 545 enable: ($.cookie("fadeFilterAlarm") != (new Date).toString("dd/MM/yyyy")) 546 }, 547 { 548 attrDeadline: 'doneDeadline', 549 caption: {singular:'You have one undone message today:', 550 plural:"You have %1 undone messages today:" 551 }, 552 title: get_lang('Done'), 553 enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy")) 554 }, 555 { 556 attrDeadline: 'alarmDeadline', 557 caption: { 558 singular:'You have a follow up due for today:', 559 plural:'You have %1 follow ups due for today:' 560 }, 561 title: get_lang('Follow ups'), 562 enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")) 563 } 564 ]; 565 break; 566 } 522 567 var i = 0; 568 // recupera e monta os dados para serem exibidos nas modais de alarmes 523 569 while (it = toIterate.pop()){ 524 570 if (!it.enable) continue; 525 526 var alarmInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00')]], criteria: {deepness: 1}}); 571 572 var alarmInRange = {}; 573 // caso for alarme de sinalizadores 574 if(it.attrDeadline == 'doneDeadline' || it.attrDeadline == 'alarmDeadline'){ 575 alarmInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00')]], criteria: {deepness: 1}}); 576 if(alarmInRange.length > 0){ 577 for(var i=0; i<alarmInRange.length; i++){ 578 if(alarmInRange[i].isDone == 1){ 579 alarmInRange.splice(i,1); 580 i--; 581 } 582 } 583 } 584 585 if(alarmInRange.length > 0){ 586 var messages_alarm = []; 587 for(var i=0; i<alarmInRange.length; i++){ 588 var date = Date.parseExact(alarmInRange[i][it.attrDeadline], 'yyyy-MM-dd HH:mm:ss'); 589 if(date) 590 alarmInRange[i][it.attrDeadline] = date.toString('HH:mm'); 591 592 if(alarmInRange[i]['followupflag']['id'] < 7){ 593 var nameFollowupflag = get_lang(alarmInRange[i]['followupflag']['name']); 594 }else{ 595 var nameFollowupflag = alarmInRange[i]['followupflag']['name']; 596 } 597 var li_alarm = alarmInRange[i][it.attrDeadline] + ' - ' + nameFollowupflag + ' - ' + truncate(alarmInRange[i]['message']['headers']['subject'], 15); 598 messages_alarm.push({ 599 "msg_number" : alarmInRange[i]['messageNumber'], 600 "msg_folder" : alarmInRange[i]['folderName'], 601 "a" : li_alarm 602 }); 603 } 604 } 605 } 606 // caso for alarme de filtros 607 else if(filter_list){ 608 alarmInRange = filter_list; 609 if(alarmInRange.length > 0){ 610 var messages_alarm = []; 611 for(var i=0; i<alarmInRange.length; i++){ 612 var d = new Date(alarmInRange[i]['udate']*1000); 613 var dia = d.getDate(); 614 if(dia < 10){ 615 dia = "0" + dia; 616 } 617 var mes = (d.getMonth()) + 1; 618 if(mes < 10){ 619 mes = "0" + mes; 620 } 621 var ano = d.getFullYear(); 622 var dtFormatada = dia + '/' + mes + '/' + ano; 623 alarmInRange[i]['udate'] = dtFormatada; 624 625 var li_alarm = alarmInRange[i]['udate'] + ' ' + alarmInRange[i]['smalldate'] + ' - ' + alarmInRange[i]['from'] + ' - ' + truncate(alarmInRange[i]['subject'], 15); 626 messages_alarm.push({ 627 "msg_number" : alarmInRange[i]['msg_number'], 628 "msg_folder" : alarmInRange[i]['msg_folder'], 629 "a" : li_alarm 630 }); 631 } 632 } 633 } 634 527 635 if(alarmInRange.length > 0){ 528 for(var i=0; i<alarmInRange.length; i++){ 529 if(alarmInRange[i].isDone == 1){ 530 alarmInRange.splice(i,1); 531 i--; 532 } 533 } 534 } 535 if(alarmInRange.length > 0){ 536 for(var i=0; i<alarmInRange.length; i++){ 537 var date = Date.parseExact(alarmInRange[i][it.attrDeadline], 'yyyy-MM-dd HH:mm:ss'); 538 if(date) 539 alarmInRange[i][it.attrDeadline] = date.toString('HH:mm'); 540 } 636 // monta o subtitulo da modal 541 637 var caption = (alarmInRange.length == 1) ? 542 638 get_lang(it.caption.singular): 543 639 get_lang(it.caption.plural, alarmInRange.length); 544 640 // monta o array de dados a ser passado para o template 545 641 var data = { 546 alarmInRange : alarmInRange,642 alarmInRange : messages_alarm, 547 643 caption: caption, 548 it : it 644 type: it.attrDeadline, 645 captions: it.caption 549 646 }; 647 // tipo de modal a ser exibida 648 var type_alarm = it.attrDeadline; 649 //função chamada ao clicar no botão Ok da modal 650 var ok_function = function(event, type, type_cookie){ 651 if($(event.target).parents('.'+type).find('[name="stopAlert"]').is(':checked')){ 652 $.cookie(type_cookie, (new Date).toString("dd/MM/yyyy"), { 653 expires: 1 654 }); 655 } 656 } 657 // carrega o template dos alarmes e cria a modal utilizando o plugin freeow 550 658 var dialogText = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", data); 659 var titulo = '<div class="header-alarm"><span class="img_title"></span><span class="title-alarm"><strong>'+it.title+'</strong></span><span name="header-icon" class="maximize-alarm"></span></div>'; 660 $("#freeow").freeow(titulo, dialogText, { 661 classes: ["gray", type_alarm], 662 autoHide: false, 663 startStyle: null, 664 onClick: function(event){ 665 var type = ''; 666 var type_cookie = ''; 667 if($(this).hasClass('alarmDeadline')){ 668 type = 'alarmDeadline'; 669 type_cookie = 'fadeAlarm'; 670 }else if($(this).hasClass('doneDeadline')){ 671 type = 'doneDeadline'; 672 type_cookie = 'fadeCompleted'; 673 }else if($(this).hasClass('filtersDeadline')){ 674 type = 'filtersDeadline'; 675 type_cookie = 'fadeFilterAlarm'; 676 } 677 if($(event.target).hasClass('stop-alert-alarm')){ 678 return; 679 } 680 if($(event.target).hasClass('minimize-alarm')){ 681 $('.'+type).find('.content-alarm').hide(); 682 $(event.target).removeClass('minimize-alarm').addClass('maximize-alarm'); 683 return; 684 } 685 if($(event.target).hasClass('maximize-alarm')){ 686 $('.'+type).find('.content-alarm').show(); 687 $(event.target).removeClass('maximize-alarm').addClass('minimize-alarm'); 688 return; 689 } 690 if($(event.target).hasClass('confirm-alarm')){ 691 ok_function(event, type, type_cookie); 692 $('.'+type).remove(); 693 return; 694 } 695 return false; 696 } 697 }); 698 // elementos do freeow desnecessários 699 $('.gray .background .content p').remove(); 700 $('.gray .icon').remove(); 701 $('.gray .close').remove(); 551 702 552 /** 553 * A última dialog criada é a dialog mais ao alto 554 */ 555 var offsetHeight = $('.ZebraDialog.right-bottom:last').length ? 556 $(window).height() - $('.ZebraDialog.right-bottom:last').position().top : 0; 557 558 /** 559 * Se for a primeira, desloca para cima do rodapé do grid 560 * caso contrário desloca para um pouco acima da última dialog criada 561 */ 562 offsetHeight = !offsetHeight ? 35 : offsetHeight + 20 ; 563 var dialog = new $.Zebra_Dialog(dialogText, { 564 'buttons': ['Ok'], 565 'modal': false, 566 'vcenter_short_message': false, 567 'position': ['right - 20', 'bottom - ' + offsetHeight.toString() ], 568 'custom_class': 'right-bottom followupflag-alarm '+it.attrDeadline 569 }).dialog; 570 $(".ZebraDialog.followupflag-alarm .ZebraDialog_Button0").click(it.onOk); 571 $(".ZebraDialog.followupflag-alarm .display-options .more").click(function(event) { 572 $(event.target).parents('.followupflag-alarm').find('.message-list').css('height', 'auto'); 573 }); 703 // botão ok da modal com jquery button 704 $('.content-alarm button').button(); 574 705 } 575 706 } 707 708 // controle de qual janela de alarme estará maximizada 709 $('.gray').find('.content-alarm').hide(); 710 $('.gray').find('.header-alarm [name="header-icon"]').removeClass('minimize-alarm').addClass('maximize-alarm'); 711 712 if($('.gray').length > 0){ 713 if($('.gray').hasClass('filtersDeadline')){ 714 $('.filtersDeadline').find('.content-alarm').show(); 715 $('.filtersDeadline .header-alarm [name="header-icon"]').removeClass('maximize-alarm').addClass('minimize-alarm'); 716 }else if($('.gray').hasClass('alarmDeadline')){ 717 $('.alarmDeadline').find('.content-alarm').show(); 718 $('.alarmDeadline .header-alarm [name="header-icon"]').removeClass('maximize-alarm').addClass('minimize-alarm'); 719 }else if($('.gray').hasClass('doneDeadline')){ 720 $('.doneDeadline').find('.content-alarm').show(); 721 $('.doneDeadline .header-alarm [name="header-icon"]').removeClass('maximize-alarm').addClass('minimize-alarm'); 722 } 723 } 724 576 725 } 726 577 727 $('#main_table').ready(function(){ 578 alarmFollowupflagged(); 728 handlerMessageFilter = function (data) { 729 alarmFollowupflagged(null, data); 730 } 731 /* Busca nas pastas indexadas para ver se há novas mensagens com a flag $FilteredMessage */ 732 cExecute ("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules, handlerMessageFilter); 579 733 }); 734 -
branches/2.4/prototype/modules/mail/js/label.js
r6653 r6754 127 127 var hasLabel = true; 128 128 $.each(data, function(index, value) { 129 130 hasLabel = typeof value == 'object' ? false : value;131 129 130 hasLabel = typeof value == 'object' ? false : value; 131 132 132 }); 133 133 … … 166 166 167 167 draw_tree_labels(); 168 var msgsReference = DataLayer.get('labeled', {filter: ['=', 'labelId', ''+labelEdited.id]}, true); 169 168 var msgsReference = DataLayer.get('labeled', {filter: ['=', 'labelId', ''+labelEdited.id]}, true); 169 updateMessageLabels(msgsReference); 170 170 171 171 /** … … 207 207 208 208 DataLayer.remove('label', id); 209 209 210 210 DataLayer.commit(false, false, function(data){ 211 211 $.contextMenu( 'destroy', ".table_box tbody tr"); 212 212 loadMenu(); 213 updateMessageLabels(msgsReference); 213 updateMessageLabels(msgsReference); 214 214 }); 215 215 winElement.find(".label-list li:first").trigger("click"); -
branches/2.4/prototype/modules/mail/templates/followupflag_alarm_list.ejs
r5738 r6754 1 <p class="title"><strong><%= data.caption %> </strong></p> 2 3 <ul class="message-list"> 4 <% 5 for(var i=0; i<data.alarmInRange.length; i++){ 6 var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarmInRange[i].messageNumber+"&msg_folder="+data.alarmInRange[i].folderName+"&alarm=true', show_msg);"; 7 if(data.alarmInRange[i].followupflag.id < 7){ 8 var nameFollowupflag = get_lang(data.alarmInRange[i].followupflag.name); 9 }else{ 10 var nameFollowupflag = data.alarmInRange[i].followupflag.name; 1 <div class="content-alarm"> 2 <span class="subtitle-alarm"> 3 <strong><%=data.caption %></strong> 4 </span> 5 <ul class="message-list"> 6 <% 7 for(var i=0; i<data.alarmInRange.length; i++){ 8 if(data.type == 'filtersDeadline') 9 var openMessageScript = "$(this).parent().remove(); var msgs_count = $('.filtersDeadline').find('.message-item').length; if(msgs_count == 0){ $('.filtersDeadline').remove(); } $('.subtitle-alarm').find('strong').html((msgs_count == 1)?get_lang('"+data.captions.singular+"'):get_lang('"+data.captions.plural+"', msgs_count)); cExecute('$this.imap_functions.open_flagged_msg&msg_number="+data.alarmInRange[i].msg_number+"&msg_folder="+data.alarmInRange[i].msg_folder+"&alarm=true', show_msg);"; 10 else 11 var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarmInRange[i].msg_number+"&msg_folder="+data.alarmInRange[i].msg_folder+"&alarm=true', show_msg);"; 12 %> 13 <li class="message-item"> 14 <a onclick="<%=openMessageScript%>"> 15 <%= data.alarmInRange[i].a %> 16 </a> 17 </li> 18 <% 11 19 } 12 %> 13 <li class="message-item"> 14 <a onclick="<%=openMessageScript%>"> 15 <%= (it.attrDeadline == 'alarmDeadline') ? data.alarmInRange[i].alarmDeadline : data.alarmInRange[i].doneDeadline %> - <%= nameFollowupflag %> - <%= data.alarmInRange[i].message.headers.subject %> 16 </a> 17 </li> 18 <% 19 } 20 %> 21 </ul> 22 23 <fieldset class="alert-options"> 24 <input type="checkbox" name="stopAlert"> <label><%= get_lang("Don't show this window anymore today.")%></label> 25 </fieldset> 20 %> 21 </ul> 22 <fieldset class="alert-options"> 23 <input type="checkbox" class="stop-alert-alarm" name="stopAlert"> <label><%= get_lang("Don't show this window anymore today.")%></label> 24 <button class="confirm-alarm">Ok</button> 25 </fieldset> 26 </div> -
branches/2.4/prototype/modules/mail/templates/label_list.ejs
r6723 r6754 14 14 background: <%= (data.labels[i].backgroundColor) ? data.labels[i].backgroundColor : '#ffffff' %>; float:right;"></div> 15 15 16 <div class="button close tiny" style="float: right" title="<%= get_lang("Delete")%>"></div> 17 <div class="button edit tiny" style="float: right" title="<%= get_lang("Edit")%>"></div> 16 <div class="button close tiny" style="float: right" title="<%= get_lang("Delete")%>"></div> 17 <div class="button edit tiny" style="float: right" title="<%= get_lang("Edit")%>"></div> 18 18 </li> 19 19 <%}%> -
branches/2.4/prototype/modules/mail/templates/label_listitem.ejs
r6723 r6754 5 5 <input type="hidden" value="<%= data.id%>" name="labelItemId" class="id-item-list" /> 6 6 <span class="text-list"><%= data.name %></span> 7 <div class="button close tiny" style="float: right" title="<%= get_lang("Delete")%>"></div> 8 7 <div class="button close tiny" style="float: right" title="<%= get_lang("Delete")%>"></div> 8 <div class="button edit tiny" style="float: right" title="<%= get_lang("Edit")%>"></div> 9 9 10 10 </li> -
branches/2.4/prototype/modules/mail/templates/new_message.ejs
r6220 r6754 61 61 </td> 62 62 <td class="value" style="width: 100%;"> 63 <textarea class="new-message-input to" name="input_to" style="width:99%; resize: none;"></textarea> 63 <div class="email-area ui-corner-all"> 64 <input class="new-message-input to email-text" name="input_aux_to" type="text" value="" autocomplete="off"/> 65 </div> 66 <textarea class="new-message-input to" name="input_to" style="width:99%; resize: none;display : none;"></textarea> 64 67 </td> 65 68 </tr> … … 71 74 </td> 72 75 <td class="value"> 73 <textarea class="new-message-input cc" name="input_cc" style="width:99%; resize: none;"></textarea> 76 <div class="email-area ui-corner-all"> 77 <input class="new-message-input cc email-text" name="input_aux_cc" type="text" value="" autocomplete="off"/> 78 </div> 79 <textarea class="new-message-input cc" name="input_cc" style="width:99%; resize: none;display : none;"></textarea> 74 80 </td> 75 81 </tr> … … 81 87 </td> 82 88 <td class="value"> 83 <textarea class="new-message-input cco" name="input_cco" style="width:99%; resize: none;"></textarea> 89 <div class="email-area ui-corner-all"> 90 <input class="new-message-input cco email-text" name="input_aux_cco" type="text" value="" autocomplete="off"/> 91 </div> 92 <textarea class="new-message-input cco" name="input_cco" style="width:99%; resize: none;display : none;"></textarea> 84 93 </td> 85 94 </tr> … … 89 98 </td> 90 99 <td class="value"> 91 <input name="input_subject" class="new-message-input subject" style="width:99.2%; "></input>100 <input name="input_subject" class="new-message-input subject" style="width:99.2%; border-radius: 5px;"></input> 92 101 </td> 93 102 </tr> -
branches/2.4/prototype/modules/mail/templates/quickAddContact.ejs
r6690 r6754 1 <div style="width:auto;"> 2 <table> 3 <tr> 4 <td> 5 <span><%=get_lang('Nickname')%>:</span> 6 </td> 7 <td> 8 <input type="text" value="<%=data.nick%>" maxlength="50" id="quickAddOne_nickName" style="width:205px;"/> 9 </td> 10 </tr> 11 12 <tr> 13 <td> 14 <span><%=get_lang('First Name')%>:</span> 15 </td> 16 <td> 17 <input type="text" value="<%=data.fname%>" maxlength="50" id="quickAddOne_firstName" style="width:205px;" class="required-field"/> 18 </td> 19 </tr> 20 21 <tr> 22 <td> 23 <span><%=get_lang('Last Name')%>:</span> 24 </td> 25 <td> 26 <input type="text" value="<%=data.lname%>" maxlength="50" id="quickAddOne_lastName" style="width:205px;"/> 27 </td> 28 </tr> 29 30 <tr> 31 <td> 32 <span><%=get_lang('Email')%>:</span> 33 </td> 34 <td> 35 <input type="text" value="<%=data.email%>" maxlength="50" id="quickAddOne_email" style="width:205px;" class="required-field"/> 36 </td> 37 </tr> 38 </table> 1 <div style="width:auto;"> 2 <table> 3 <tr> 4 <td> 5 <span><%=get_lang('Nickname')%>:</span> 6 </td> 7 <td> 8 <input type="text" value="<%=data.nick%>" maxlength="50" id="quickAddOne_nickName" style="width:205px;"/> 9 </td> 10 </tr> 11 12 <tr> 13 <td> 14 <span><%=get_lang('First Name')%>:</span> 15 </td> 16 <td> 17 <input type="text" value="<%=data.fname%>" maxlength="50" id="quickAddOne_firstName" style="width:205px;" class="required-field"/> 18 </td> 19 </tr> 20 21 <tr> 22 <td> 23 <span><%=get_lang('Last Name')%>:</span> 24 </td> 25 <td> 26 <input type="text" value="<%=data.lname%>" maxlength="50" id="quickAddOne_lastName" style="width:205px;"/> 27 </td> 28 </tr> 29 30 <tr> 31 <td> 32 <span><%=get_lang('Email')%>:</span> 33 </td> 34 <td> 35 <input type="text" value="<%=data.email%>" maxlength="50" id="quickAddOne_email" style="width:205px;" class="required-field"/> 36 </td> 37 </tr> 38 </table> 39 39 </div> -
branches/2.4/prototype/request.php
r6111 r6754 1 1 <?php 2 2 3 // $properties = $_ GET['properties'];4 // $limit = $_ GET['limit'];5 // $offset = $_ GET['offset'];6 // $group = $_ GET['group'];7 // $order = $_ GET['join'];8 // $filter = $_ GET['filter'];9 // $URI = $_ GET['URI'];3 // $properties = $_REQUEST['properties']; 4 // $limit = $_REQUEST['limit']; 5 // $offset = $_REQUEST['offset']; 6 // $group = $_REQUEST['group']; 7 // $order = $_REQUEST['join']; 8 // $filter = $_REQUEST['filter']; 9 // $URI = $_REQUEST['URI']; 10 10 11 $concept = isset( $_ GET['concept'] ) ? $_GET['concept'] : false;12 $id = isset( $_ GET['id'] ) ? $_GET['id'] : false;13 $filter = isset( $_ GET['filter'] ) ? $_GET['filter'] : false;14 $criteria = isset( $_ GET['criteria'] ) ? $_GET['criteria'] : false;11 $concept = isset( $_REQUEST['concept'] ) ? $_REQUEST['concept'] : false; 12 $id = isset( $_REQUEST['id'] ) ? $_REQUEST['id'] : false; 13 $filter = isset( $_REQUEST['filter'] ) ? $_REQUEST['filter'] : false; 14 $criteria = isset( $_REQUEST['criteria'] ) ? $_REQUEST['criteria'] : false; 15 15 16 16 $criteria = $filter ? $criteria ? -
branches/2.4/prototype/services/ImapServiceAdapter.php
r6719 r6754 42 42 include_once ROOTPATH."/../expressoMail1_2/inc/class.imap_functions.inc.php"; 43 43 44 use prototype\api\Config as Config; 45 44 46 /** 45 47 * … … 536 538 537 539 $data['messageId'] = $headers[0]->message_id; 538 539 540 /* 541 * TODO 542 * Verificar erro ao tentar setar uma flag com o limite de flags atingido 543 * onde o status retornado pelo imap_setflag_full é true mesmo não sendo possível 544 * a inserção da flag. 545 */ 546 547 return (($s) && (imap_last_error() != 'Too many user flags in mailbox')) ? $data : array(); 540 541 /* 542 * TODO 543 * Verificar erro ao tentar setar uma flag com o limite de flags atingido 544 * onde o status retornado pelo imap_setflag_full é true mesmo não sendo possível 545 * a inserção da flag. 546 */ 547 548 return (($s) && (imap_last_error() != 'Too many user flags in mailbox')) ? $data : array(); 548 549 549 550 } else if (isset($data['messageId'])) { … … 614 615 $mailService->addHeaderField('Disposition-Notification-To', Config::me('mail')); 615 616 617 $this->rfc2397ToEmbeddedAttachment($mailService , $body); 618 616 619 $isHTML = ( isset($data['type']) && $data['type'] == 'html' )? true : false; 617 620 … … 633 636 { 634 637 $body = str_replace('"../prototype/getArchive.php?mailAttachment='.$att['id'].'"', '"'.mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1').'"', $body); 635 $mailService->addStringImage(base64_decode($att['source']), $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1')); 638 $mailService->addStringImage(base64_decode($att['source']), $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1')); 636 639 } 637 640 else 638 641 $mailService->addStringAttachment(base64_decode($att['source']), mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1'), $att['type'], 'base64', isset($att['disposition']) ? $att['disposition'] :'attachment' ); 639 642 640 643 unset($att); 641 644 } … … 650 653 { 651 654 $body = str_ireplace('<img src="./inc/get_archive.php?msgFolder='.$value['folder'].'&msgNumber='.$value['uid'].'&indexPart='.$value['part'].'" />' , '<img src="'.$att['name'].'" />', $body); 652 $mailService->addStringImage($att['source'], $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1')); 655 $mailService->addStringImage($att['source'], $att['type'], mb_convert_encoding($att['name'], 'ISO-8859-1' , 'UTF-8,ISO-8859-1')); 653 656 } 654 657 else … … 783 786 public function deleteAll( $URI, $justthese = false, $criteria = false ) 784 787 { 785 $op = $criteria['filter'][0]; 786 $ids = $criteria['filter'][2]; 787 if($op == 'IN'){ 788 foreach ($ids as $id){ 789 self::delete( array( 'concept' => $URI['concept'], 'id' => $id), false, false); 790 } 791 792 788 $op = $criteria['filter'][0]; 789 $ids = $criteria['filter'][2]; 790 if($op == 'IN'){ 791 foreach ($ids as $id){ 792 self::delete( array( 'concept' => $URI['concept'], 'id' => $id), false, false); 793 } 794 } 795 793 796 /** 794 797 * TODO - implementar a deleção de todos os followupflaggeds conforme filtro -
branches/2.4/prototype/services/OpenLDAP.php
r5804 r6754 1 1 <?php 2 3 use prototype\api\Config as Config; 2 4 3 5 class OpenLDAP implements Service … … 13 15 if( !isset($criteria["limit"]) ) 14 16 $criteria["limit"] = $this->limit; 15 17 16 18 $sr = ldap_search( $this->con , $this->config['context'] , self::parseCriteria($criteria , $map) , self::parseJustthese($justthese, $map) , 0 , $criteria["limit"]); 17 19 if(!$sr) return false; … … 156 158 $as = array_shift( $filter ); 157 159 $op = self::parseOperator( $as ); 158 160 159 161 if( is_array($filter[0]) ) 160 162 { -
branches/2.4/prototype/services/PostgreSQL.php
r6299 r6754 40 40 */ 41 41 42 use prototype\api\Config as Config; 43 42 44 class PostgreSQL implements Service 43 45 { … … 87 89 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 88 90 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.addslashes( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.addslashes( $uri['id'] ).'\''; 91 89 92 return $this->execSql('UPDATE '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '. self::parseUpdateData( $data ,$map).$criteria); 90 93 } … … 197 200 $val[] = '\''.addslashes($v).'\''; 198 201 } 199 200 return '('.implode(',', $ind).') VALUES ('.implode(',', $val).') RETURNING '.$map['id'].' as id'; 202 return '('.implode(',', $ind).') VALUES ('.implode(',', $val).') RETURNING '.$map['id'].' as id'; 201 203 } 202 204 … … 244 246 $query .= ' GROUP BY '.( is_array($criteria["group"]) ? implode(', ', $criteria["group"]) : $criteria["group"] ).' '; 245 247 } 246 248 247 249 if( isset($criteria["order"]) ) 248 250 { 249 $query .= ' ORDER BY '.self::parseOrder( $criteria["order"], $map ).' '; 250 } 251 //Verificar se os atributos para o ORDER BY serao ordenados em ordem decrescente [DESC] 252 $orderDesc = ( isset($criteria["orderDesc"]) && count($criteria["order"]) == count($criteria["orderDesc"]) ) ? $criteria["orderDesc"] : false; 253 254 $query .= ' ORDER BY '.self::parseOrder( $criteria["order"], $map, $orderDesc ).' '; 255 256 } 257 251 258 if( isset($criteria["limit"]) ) 252 259 { … … 339 346 } 340 347 341 private static function parseOrder($order , &$map)348 private static function parseOrder($order , &$map, $orderDesc=false) 342 349 { 343 350 344 351 if($notArray = !is_array($order)) //Caso seja um full select pegar todas as keys 345 352 $order = array( $order ); 353 354 //Caso seja feita ordenacao em ordem descrescente 355 //concatenar DESC em cada atributo 356 if($orderDesc !== false){ 357 if(!is_array($orderDesc)){ 358 $orderDesc = array( $orderDesc ); 359 } 360 361 for($i=0; $i<count($order); $i++){ 362 $order[$i] .= ($orderDesc[$i] === true) ? ' DESC' : ''; 363 } 364 } 346 365 347 366 $return = array(); … … 356 375 return ( $notArray ? $order[0] : implode(', ', $order) ); 357 376 } 377 358 378 } 359 379 -
branches/2.4/prototype/services/iCal.php
r6346 r6754 4 4 require_once ROOTPATH . '/plugins/icalcreator/iCalcreator.class.php'; 5 5 require_once ROOTPATH . '/modules/calendar/constants.php'; 6 7 use prototype\api\Config as Config; 6 8 7 9 //TODO:Timeout request
Note: See TracChangeset
for help on using the changeset viewer.