Changeset 5134
- Timestamp:
- 11/03/11 13:24:28 (12 years ago)
- Location:
- trunk/expressoMail1_2
- Files:
-
- 48 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/controller.php
r1738 r5134 8 8 } 9 9 require_once '../header.session.inc.php'; 10 require_once '../API/class.servicelocator.php'; 10 11 11 12 // Explode action from cExecuteForm function … … 16 17 $array_files = array(); 17 18 for($idx = 1; $idx <= $count_files; $idx++) { 18 if( $_FILES['file_'.$idx] && !$_FILES['file_'.$idx]['error'])19 if(array_key_exists('file_'.$idx , $_FILES) && $_FILES['file_'.$idx] && !$_FILES['file_'.$idx]['error']) 19 20 $array_files[] = $_FILES['file_'.$idx]; 20 21 } 21 22 $_POST['FILES'] = $array_files; 22 23 } 23 list($app,$class,$method) = explode('.',@$_POST['_action']); 24 $get_p = explode('.',@$_POST['_action']); 25 24 26 $cExecuteFormReturn = true; 25 27 } 26 28 // Explode action from cExecute function 27 else if($_GET['action']) 28 list($app,$class,$method) = explode('.',@$_GET['action']); 29 else if(array_key_exists('action', $_GET)) 30 $get_p = explode('.',@$_GET['action']); 31 32 29 33 // NO ACTION 30 34 else … … 32 36 33 37 // Load dinamically class file. 34 if($ app== '$this')35 $filename = 'inc/class.'.$ class.'.inc.php';38 if($get_p[0] == '$this') 39 $filename = 'inc/class.'.$get_p[1].'.inc.php'; 36 40 else 37 $filename = '../'.$ app.'/inc/class.'.$class.'.inc.php';41 $filename = '../'.$get_p[0].'/inc/class.'.$get_p[1].'.inc.php'; 38 42 39 43 include_once($filename); 40 44 41 45 // Create new Object (class loaded). 42 $obj = new $ class;46 $obj = new $get_p[1]; 43 47 44 48 // Prepare parameters for execution. … … 60 64 // if params is not empty, then class method with parameters. 61 65 if($params) 62 $result = $obj -> $ method($params);66 $result = $obj -> $get_p[2]($params); 63 67 else 64 $result = $obj -> $ method();68 $result = $obj -> $get_p[2](); 65 69 66 70 // Return result serialized. 67 71 68 72 69 if(!$cExecuteFormReturn) 73 if(!$cExecuteFormReturn /*&& (!$_REQUEST['isPost'])*/ ) 74 if(array_key_exists(3,$get_p)) 75 echo $result; 76 else 70 77 echo serialize($result); 71 78 else -
trunk/expressoMail1_2/inc/class.ScriptS.inc.php
r4986 r5134 215 215 216 216 function convert_specialchar($input) { 217 $special_char = false; 218 for ($i = 0; $i < strlen($input); $i++) { 219 if (preg_match('/[^a-z0-9.@~_+=&\'*^\ \-\[\]]/i', $input[$i])) { 220 $special_char = true; 221 $input = preg_replace('/\\' . $input[$i] . '/', '=' . bin2hex($input[$i]), $input); 222 } 223 } 224 225 if ($special_char) { 226 /* * 227 * When using arrays with pattern and replacement, 228 * the keys are processed in the order they appear in the array. 229 * See preg_replace in php.net/preg_replace 230 * */ 231 $patterns[0] = '/=c3/i'; 232 $patterns[1] = '/ /'; 233 $replacements[1] = ''; 217 $temp_input = $input; 218 $temp_input = imap_8bit($temp_input); 219 220 $patterns[0] = '/ /'; 234 221 $replacements[0] = '_'; 235 $input = preg_replace($patterns, $replacements, $input); 236 } 237 238 return($input); 222 $temp_input = preg_replace($patterns, $replacements, $temp_input); 223 return ($temp_input); 239 224 } 240 225 … … 522 507 // Lê as regras fora do escritório; 523 508 if ($this->newout != "") { 524 $newscriptfoot .= preg_replace("/[\\n\\r]/", " %0A", $this->newout) . "\n";509 $newscriptfoot .= preg_replace("/[\\n\\r]/", " ", $this->newout) . "\n"; 525 510 } 526 511 $newscriptfoot .= "#mode&&basic\n"; -
trunk/expressoMail1_2/inc/class.attachment.inc.php
r5079 r5134 32 32 * @param integer $msgNumber Imap menssagem number 33 33 */ 34 function attachment( $rootPath = false)34 function attachment() 35 35 { 36 36 /* 37 37 * Requires 38 38 */ 39 if($rootPath)40 {41 require_once $rootPath.'/library/mime/mimePart.php';42 require_once $rootPath.'/library/mime/mimeDecode.php';43 }44 else45 {46 39 require_once $_SESSION['rootPath'].'/library/mime/mimePart.php'; 47 40 require_once $_SESSION['rootPath'].'/library/mime/mimeDecode.php'; 48 }49 41 //----------------------------------------------------------// 50 42 … … 52 44 $this->decodeConf['decode_bodies'] = true; 53 45 $this->decodeConf['decode_headers'] = true; 46 47 if( array_key_exists('nested_messages_are_shown', $_SESSION['phpgw_info']['user']['preferences']['expressoMail']) && ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['nested_messages_are_shown'] == '1')) 48 $this->decodeConf['rfc_822bodies'] = true; 54 49 } 55 50 //----------------------------------------------------------------------------// … … 86 81 $this->structure = $decoder->decode($this->decodeConf); 87 82 83 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 84 if($this->isSignedMenssage()) 85 $this->convertSignedMenssage($rawMessageData); 86 ////////////////////////////////////////////////////// 87 88 88 89 /* 89 90 * Clean memory and close imap connection … … 95 96 } 96 97 98 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 99 private function isSignedMenssage() 100 { 101 if(strtolower($this->structure->ctype_primary) == 'application' && strtolower($this->structure->ctype_secondary) == 'x-pkcs7-mime' ) 102 return true; 103 else 104 return false; 105 } 106 ////////////////////////////////////////////////////////////////////////// 107 108 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 109 private function convertSignedMenssage($rawMessageData) 110 { 111 $decoder = new Mail_mimeDecode($this->extractSignedContents($rawMessageData)); 112 $this->structure = $decoder->decode($this->decodeConf); 113 } 114 /////////////////////////////////////////////////////////////////////////// 115 116 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 117 private function extractSignedContents( $data ) 118 { 119 $pipes_desc = array( 120 0 => array('pipe', 'r'), 121 1 => array('pipe', 'w') 122 ); 123 124 $fp = proc_open( 'openssl smime -verify -noverify -nochain', $pipes_desc, $pipes); 125 if (!is_resource($fp)) { 126 return false; 127 } 128 129 $output = ''; 130 131 /* $pipes[0] => writeable handle connected to child stdin 132 $pipes[1] => readable handle connected to child stdout */ 133 fwrite($pipes[0], $data); 134 fclose($pipes[0]); 135 136 while (!feof($pipes[1])) { 137 $output .= fgets($pipes[1], 1024); 138 } 139 fclose($pipes[1]); 140 proc_close($fp); 141 142 return $output; 143 } 144 ///////////////////////////////////////////////////////////////////////////////////// 145 97 146 /** 98 147 * Set Stucture from Mail_mimeDecode Structure … … 116 165 $decoder = new Mail_mimeDecode($rawMail); 117 166 $this->structure = $decoder->decode($this->decodeConf); 167 168 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 169 if($this->isSignedMenssage()) 170 $this->convertSignedMenssage($rawMessageData); 171 ////////////////////////////////////////////////////////////////////////// 118 172 } 119 173 … … 169 223 $attachment = array(); 170 224 $this->_getPartInfo($this->structure,$partNumber,$attachment); 171 return $attachment ;225 return $attachment[0]; 172 226 } 173 227 … … 180 234 private function _getRaw() 181 235 { 182 return imap_fetchheader($this->mbox, $this->msgNumber, FT_UID).imap_body($this->mbox, $this->msgNumber, FT_UID); 236 /* 237 * Chamada original imap_fetchheader($this->mbox, $this->msgNumber, FT_UID)."\r\n".imap_body($this->mbox, $this->msgNumber, FT_UID); 238 * Inserido replace para corrigir um bug que acontece raramente em mensagens vindas do outlook com muitos destinatarios 239 */ 240 return str_replace("\r\n\t", '', imap_fetchheader($this->mbox, $this->msgNumber, FT_UID))."\r\n".imap_body($this->mbox, $this->msgNumber, FT_UID); 183 241 } 184 242 … … 202 260 else 203 261 { 204 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) )262 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) && $this->decodeConf['rfc_822bodies'] !== true ) 205 263 $this->_getPartContent($part,$soughtIndex,$body,$pIndex.'.'.$index); 206 264 else 207 265 { 208 266 $currentIndex = $pIndex.'.'.$index; 209 if($currentIndex == $soughtIndex)267 if($currentIndex === $soughtIndex) 210 268 { 211 269 $body = $part->body; … … 235 293 else 236 294 { 237 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) )295 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) && $this->decodeConf['rfc_822bodies'] !== true) 238 296 $this->_getPartInfo($part,$soughtIndex,$info,$pIndex.'.'.$index); 239 297 else 240 298 { 241 299 $currentIndex = $pIndex.'.'.$index; 242 if($currentIndex == $soughtIndex)300 if($currentIndex === $soughtIndex) 243 301 { 244 302 $this->_pushAttachmentsInfo($part,$info,$currentIndex); … … 262 320 { 263 321 264 if( $structure->parts)322 if(isset($structure->parts)) 265 323 { 266 324 foreach ($structure->parts as $index => $part) … … 270 328 else 271 329 { 272 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) )330 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) && $this->decodeConf['rfc_822bodies'] !== true) 273 331 $this->_getAttachmentsInfo($part,$attachments,$pIndex.'.'.$index); 274 332 else … … 293 351 /** 294 352 * Write in $$attachments, array with the information of attachment 295 * 296 * @license http://www.gnu.org/copyleft/gpl.html GPL 297 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 298 * @sponsor Caixa Econômica Federal 299 * @param $structure 300 * @param $attachments 301 * @param $pIndex 353 * @param <type> $structure 354 * @param <type> $attachments 355 * @param <type> $pIndex 302 356 */ 303 357 private function _pushAttachmentsInfo(&$structure, &$attachments, $pIndex = '0') 304 358 { 305 $name = false;306 if( $structure->d_parameters['filename']) $name = $structure->d_parameters['filename'];307 else if( $structure->ctype_parameters['name']) $name = $structure->ctype_parameters['name'];359 $name = ''; 360 if((isset($structure->d_parameters['filename']))&& ($structure->d_parameters['filename'])) $name = $structure->d_parameters['filename']; 361 else if((isset($structure->ctype_parameters['name']))&&($structure->ctype_parameters['name'])) $name = $structure->ctype_parameters['name']; 308 362 else if(strtolower($structure->ctype_primary) == 'text' && strtolower($structure->ctype_secondary) == 'calendar') $name = 'calendar.ics'; 309 363 364 //Attachments com nomes grandes são quebrados em varias partes VER RFC2231 365 if( !$name && isset($structure->disposition) && (strtolower($structure->disposition) === 'attachment' || strtolower($structure->ctype_primary) == 'image')) 366 foreach ($structure->d_parameters as $i => $v) 367 if(strpos($i , 'filename') !== false) 368 $name .= urldecode(str_ireplace(array('ISO-8859-1','UTF-8','US-ASCII'),'',$v)); 369 if( !$name && isset($structure->disposition) && (strtolower($structure->disposition) === 'attachment' || strtolower($structure->ctype_primary) == 'image') ) 370 foreach ($structure->ctype_parameters as $i => $v) 371 if(strpos($i , 'name') !== false) 372 $name .= urldecode(str_ireplace(array('ISO-8859-1','UTF-8','US-ASCII'),'',$v)); 373 //////////////////////////////////////////////////////////////////////////////////// 374 375 376 if($structure->ctype_primary == 'message') { 377 $attach = new attachment(); 378 $attach->setStructureFromRawMail($structure->body); 379 380 if (!$name) 381 $name = ($attach->structure->headers['subject']) ? $attach->structure->headers['subject'] : 'no title'; 382 383 if (!preg_match("/\.eml$/", $name)) 384 $name .= '.eml'; 385 } 386 387 if(!$name && strtolower($structure->ctype_primary) == 'image') 388 { 389 if(strlen($structure->ctype_secondary) === 3) 390 $ext = strtolower($structure->ctype_secondary); 391 392 $name = 'Embedded-Image.'.$ext; 393 } 394 310 395 if($name) 311 396 { … … 316 401 $definition['name'] = addslashes(mb_convert_encoding($name, "ISO-8859-1")); 317 402 $definition['encoding'] = $structure->headers['content-transfer-encoding']; 403 $definition['type'] = strtolower($structure->ctype_primary).'/'.strtolower($structure->ctype_secondary); 318 404 $definition['fsize'] = mb_strlen($structure->body, $structure->headers['content-transfer-encoding']); 319 405 … … 334 420 private function _getEmbeddedImagesInfo($structure, &$images, $pIndex = '0') 335 421 { 422 if(isset($structure->parts)) 336 423 foreach ($structure->parts as $index => $part) 337 424 { … … 340 427 else 341 428 { 342 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) )429 if(strtolower($part->ctype_primary) == 'message' && is_array($part->parts) && $this->decodeConf['rfc_822bodies'] !== true) 343 430 $this->_getEmbeddedImagesInfo($part,$images,$pIndex.'.'.$index); 344 431 else 345 432 { 346 if(!$part->ctype_parameters['name']) 433 if(is_array($part->ctype_parameters) && !array_key_exists('name', $part->ctype_parameters)) 434 if(isset($part->d_parameters['filename'])) 347 435 $name = $part->d_parameters['filename']; 348 436 else 437 $name = null; 438 else 349 439 $name = $part->ctype_parameters['name']; 350 440 351 $type = strtolower(substr($name, -4)); 441 if($name && (strlen($name) - (strrpos($name, '.')+1) === 3 )) 442 $ext = strtolower(substr ( $name , (strrpos($name, '.')+1) )); 443 else if(strlen($structure->ctype_secondary) === 3) 444 $ext = strtolower($structure->ctype_secondary); 445 446 if(!$name && strtolower($structure->ctype_primary) == 'image') $name = 'Embedded-Image.'.$ext; 447 352 448 $ctype = strtolower($part->ctype_primary.'/'.$part->ctype_secondary); 353 if(strtolower($part->ctype_primary) == 'image' || ($ctype == 'application/octet-stream' && ($type == '.png' || $type == '.jpg' || $type == '.gif'))) 449 450 if(strtolower($part->ctype_primary) == 'image' || ($ctype == 'application/octet-stream' && ($ext == 'png' || $ext == 'jpg' || $ext == 'gif' || $ext == 'bmp' || $ext == 'tif'))) 354 451 { 355 452 $definition['pid'] = $pIndex.'.'.$index; 356 453 $definition['name'] = addslashes($name); 357 $definition['type'] = 'image/'.strtolower($part->ctype_secondary);454 $definition['type'] = $ctype; 358 455 $definition['encoding'] = $part->headers['content-transfer-encoding']; 359 456 $definition['cid'] = $part->headers['content-id']; -
trunk/expressoMail1_2/inc/class.db_functions.inc.php
r3018 r5134 210 210 211 211 function get_dropdown_contacts(){ 212 213 $contacts = $this -> get_cc_contacts(); 214 $groups = $this -> get_cc_groups(); 212 $contacts = $this->get_cc_contacts(); 213 $groups = $this->get_cc_groups(); 215 214 216 215 if(($contacts) && ($groups)) … … 223 222 $stringDropDownContacts = $groups; 224 223 225 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] && 226 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) { 224 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) { 227 225 // Free others requests 228 226 session_write_close(); … … 270 268 { 271 269 // Pesquisa os emails e ultima inserção nos contatos dinamicos. 272 if(!$this->db->select('phpgw_expressomail_contacts','data', 273 'id_owner ='.$this -> user_id, 274 __LINE__,__FILE__)) 270 if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__)) 275 271 { 276 272 return $this->db->Error; … … 295 291 function update_contacts($contacts=array()) 296 292 { 293 294 295 if(!$this->db->select('phpgw_expressomail_contacts','data','id_owner ='.$this->user_id,__LINE__,__FILE__)) 296 { 297 $result['dberr1'] = $this->db->Error; 298 } 299 $regs = array(); 300 while($this->db->next_record()) 301 { 302 $regs[] = $this->db->row(); 303 } 304 $old_contatacts = array(); 305 foreach($regs as $old){ 306 $old_contatacts = unserialize($old['data']); 307 } 308 309 foreach($old_contatacts as $i => $v) 310 foreach($contacts as $ii => $vv) 311 if(trim($v['email']) == trim($vv['email'])) 312 unset($old_contatacts[$i]); 313 314 315 $old_contatacts = array_merge( $old_contatacts , $contacts); 297 316 // Atualiza um email nos contatos dinamicos. 298 if(!$this->db->update('phpgw_expressomail_contacts ','data=\''.serialize($contacts).'\'', 299 'id_owner ='.$this -> user_id, 300 __LINE__,__FILE__)) 317 if(!$this->db->update('phpgw_expressomail_contacts ','data=\''.serialize($old_contatacts).'\'','id_owner ='.$this->user_id,__LINE__,__FILE__)) 301 318 { 302 319 return $this->db->Error; … … 344 361 $msg_part = $params['msg_part']; 345 362 $msg_folder = $params['msg_folder']; 363 $from_ajax = $params['from_ajax']; 346 364 $encoding = strtolower($params['encoding']); 347 365 $fileContent = ""; 348 349 if($msg_number && $msg_part && $msg_folder && (intval($idx_file == '0' ? '1' : $idx_file))) { 350 $mbox_stream = $objImap->open_mbox($msg_folder); 351 $fileContent = imap_fetchbody($mbox_stream, $msg_number, $msg_part, FT_UID); 352 include_once('class.imap_attachment.inc.php'); 353 $imap_attachment = new imap_attachment(); 354 $a = $imap_attachment->download_attachment($mbox_stream, $msg_number); 355 $filename = $a[$idx_file]['name']; 366 $cirus_delimiter = $params['cirus_delimiter']; 367 $expFolder = explode($cirus_delimiter, $msg_folder); 368 369 if($msg_number != null && $msg_part != null && $msg_folder != null && (intval($idx_file == '0' ? '1' : $idx_file))) 370 { 371 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 372 $attachmentObj = new attachment(); 373 $attachmentObj->setStructureFromMail($msg_folder,$msg_number); 374 $fileContent = $attachmentObj->getAttachment($msg_part); 375 $info = $attachmentObj->getAttachmentInfo($msg_part); 376 $filename = $info['name']; 356 377 } 357 378 else 358 379 $filename = $idx_file; 359 380 360 if($fileContent) {361 if($encoding == 'base64')362 $calendar = imap_base64($fileContent);363 else if($encoding == 'quoted-printable')364 $calendar = quoted_printable_decode($fileContent);365 else366 $calendar = $fileContent;367 }368 381 // It's necessary to access calendar method. 382 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 383 $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 384 $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar'; 369 385 include_once(PHPGW_INCLUDE_ROOT.'/header.inc.php'); 370 371 386 $uiicalendar = CreateObject("calendar.uiicalendar"); 372 return $uiicalendar = $uiicalendar->import_from_mail($calendar); 387 388 if(strtoupper($expFolder[0]) == 'USER' && $expFolder[1]) // IF se a conta o ical estiver em uma conta compartilhada 389 { 390 include_once('class.ldap_functions.inc.php'); 391 $ldap = new ldap_functions(); 392 $account['uid'] = $expFolder[1]; 393 $account['uidnumber'] = $ldap->uid2uidnumber($expFolder[1]); 394 $account['mail'] = $ldap->getMailByUid($expFolder[1]); 395 396 return $uiicalendar->import_from_mail($fileContent, $from_ajax,$account); 397 } 398 else 399 return $uiicalendar->import_from_mail($fileContent, $from_ajax); 400 401 373 402 } 374 403 … … 439 468 } 440 469 470 471 /** 472 * @abstract Recupera o valor da regra padrão. 473 * @return retorna o valor da regra padrão. 474 */ 475 function get_default_max_size_rule() 476 { 477 $query = "SELECT config_value FROM phpgw_config WHERE config_name = 'expressoAdmin_default_max_size'"; 478 if(!$this->db->query($query)) 479 return false; 480 481 $return = array(); 482 483 while($this->db->next_record()) 484 array_push($return, $this->db->row()); 485 486 return $return; 487 } 488 489 /** 490 * @abstract Recupera a regra de um usuário. 491 * @return retorna a regra que o usuário pertence. Caso o usuário não participe de nenhuma regra, retorna false. 492 */ 493 function get_rule_by_user($id_user) 494 { 495 $return = array(); 496 $query = "SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE email_user='$id_user' AND configuration_type='MessageMaxSize'"; 497 498 if(!$this->db->query($query)) 499 return false; 500 501 while($this->db->next_record()) 502 array_push($return, $this->db->row()); 503 504 return $return; 505 } 506 507 508 function get_rule_by_user_in_groups($id_group) 509 { 510 $return = array(); 511 $query = "SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE configuration_type='MessageMaxSize' AND email_user_type='G' AND email_user='".$id_group."'"; 512 513 if(!$this->db->query($query)) 514 return false; 515 516 while($this->db->next_record()) 517 array_push($return, $this->db->row()); 518 519 return $return; 520 } 521 function getMaximumRecipientsUser($pUserUID) 522 { 523 524 $query = 'SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE email_user = \''.$pUserUID.'\' AND configuration_type = \'LimitRecipient\' AND email_user_type = \'U\' '; 525 $this->db->query($query); 526 527 $return = array(); 528 529 while($this->db->next_record()) 530 $return = $this->db->row(); 531 532 return $return['email_max_recipient']; 533 } 534 535 function getMaximumRecipientsGroup($pGroupsGuidnumbers) 536 { 537 $groupsGuidNumbers = ''; 538 539 foreach ($pGroupsGuidnumbers as $guidNumber => $cn) 540 $groupsGuidNumbers .= $guidNumber.', '; 541 542 $groupsGuidNumbers = substr($groupsGuidNumbers,0,-2); 543 544 $query = 'SELECT email_max_recipient FROM phpgw_expressoadmin_configuration WHERE email_user IN ('.$groupsGuidNumbers.') AND configuration_type = \'LimitRecipient\' AND email_user_type = \'G\' '; 545 $this->db->query($query); 546 547 $return = array(); 548 549 while($this->db->next_record()) 550 $return[] = $this->db->row(); 551 552 $maxSenderReturn = 0; 553 554 foreach ($return as $maxSender) 555 { 556 if($maxSender['email_max_recipient'] > $maxSenderReturn) 557 $maxSenderReturn = $maxSender['email_max_recipient']; 558 } 559 560 return $maxSenderReturn; 561 } 562 563 function validadeSharedAccounts($user,$grups,$accountsMails) 564 { 565 566 $arrayMailsBlocked = array(); 567 568 $query = 'SELECT * FROM phpgw_expressoadmin_configuration WHERE email_user = \''.$user.'\' AND email_recipient = \'*\' AND configuration_type = \'InstitutionalAccountException\' AND email_user_type = \'U\' '; 569 $this->db->query($query); 570 $this->db->next_record(); 571 if($this->db->row()) 572 return $arrayMailsBlocked; 573 574 foreach ($grups as $guidNumber => $cn) 575 { 576 $query = 'SELECT * FROM phpgw_expressoadmin_configuration WHERE email_user = \''.$guidNumber.'\' AND email_recipient = \'*\' AND configuration_type = \'InstitutionalAccountException\' AND email_user_type = \'G\' '; 577 $this->db->query($query); 578 $this->db->next_record(); 579 if($this->db->row()) 580 return $arrayMailsBlocked; 581 582 } 583 584 foreach ($accountsMails as $mail) 585 { 586 587 $blocked = true; 588 589 $query = 'SELECT * FROM phpgw_expressoadmin_configuration WHERE email_recipient = \''.$mail.'\' AND configuration_type = \'InstitutionalAccountException\' '; 590 $this->db->query($query); 591 592 while($this->db->next_record()) 593 { 594 $row = $this->db->row(); 595 596 if(($row['email_user'] == '*' || $row['email_user'] == $user) && ($row['email_user_type'] == 'T' || $row['email_user_type'] == 'U')) 597 $blocked = false; 598 else if(array_key_exists($row['email_user'], $grups) && $row['email_user_type'] == 'G') 599 $blocked = false; 600 601 } 602 603 if($blocked == true) 604 array_push ($arrayMailsBlocked, $mail); 605 } 606 607 return $arrayMailsBlocked; 608 } 609 441 610 } 442 611 ?> -
trunk/expressoMail1_2/inc/class.dynamic_contacts.inc.php
r1059 r5134 79 79 { 80 80 foreach($this->contacts as $item => $valor) 81 $contact .= ';'.$this->contacts[$item]['email']. ',';81 $contact .= str_replace("#",";",$this->contacts[$item]['email']) . ','; 82 82 //Retira ultima virgula. 83 83 $contact = substr($contact,0,(strlen($contact) - 1)); … … 106 106 { 107 107 // Trim all whitespaces and duplicated commas from full_email_address 108 $full_email_address = preg_replace('{(,)\1+}',',', ereg_replace( ' +', '', $full_email_address));108 $full_email_address = preg_replace('{(,)\1+}',',',$full_email_address); 109 109 $parse_address = imap_rfc822_parse_adrlist($full_email_address, ""); 110 110 $new_contacts = array(); … … 118 118 if(!$this->contacts) // Used one time to insert the first contact in database 119 119 { 120 $this->db->insert_contact($val-> mailbox."@".$val->host);120 $this->db->insert_contact($val->personal."#".$val->mailbox."@".$val->host); 121 121 // Just new contact added. 122 $new_contacts[] = $val-> mailbox."@".$val->host;122 $new_contacts[] = $val->personal.";".$val->mailbox."@".$val->host; 123 123 $this->contacts = $this->db->get_dynamic_contacts(); 124 124 } … … 129 129 foreach($this->contacts as $item => $valor) 130 130 { 131 if($this->contacts[$item]['email'] == $val-> mailbox."@".$val->host) // check if email already exists131 if($this->contacts[$item]['email'] == $val->personal."#".$val->mailbox."@".$val->host) // check if email already exists 132 132 { 133 133 $this->contacts[$item]['timestamp'] = time(); //update timestamp of email … … 143 143 { 144 144 // Just new contact added. 145 $new_contacts[] = $val-> mailbox."@".$val->host;145 $new_contacts[] = $val->personal.";".$val->mailbox."@".$val->host; 146 146 if($this->number_of_contacts > count($this->contacts)) 147 147 { 148 148 $this->contacts[] = array( 'timestamp' => time(), 149 'email' =>$val->mailbox."@".$val->host);149 'email' => $val->personal."#".$val->mailbox."@".$val->host); 150 150 } 151 151 if($this->number_of_contacts <= count($this->contacts)) 152 152 { 153 153 $this->contacts[$older_contact] = array( 'timestamp' => time(), 154 'email' =>$val->mailbox."@".$val->host);154 'email' => $val->personal."#".$val->mailbox."@".$val->host); 155 155 } 156 156 } -
trunk/expressoMail1_2/inc/class.exporteml.inc.php
r5079 r5134 17 17 var $tempDir; 18 18 19 20 /**21 * Construtor da classe ExportEml22 *23 * @license http://www.gnu.org/copyleft/gpl.html GPL24 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)25 * @sponsor Caixa Econômica Federal26 */27 19 function ExportEml() { 28 20 … … 303 295 } 304 296 297 function export_eml( $params ){ 298 299 return $this->export_msg_data( $params['msgs_to_export'], 300 $params['folder'] ); 301 } 302 305 303 function export_msg($params) { 306 $this-> folder = $params['folder'];307 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","ISO_8859-1");308 $id_number = $params['msgs_to_export'];309 304 $tempDir = $this->tempDir; 310 $this->connectImap();311 $header = $this-> getHeader($id_number);312 $body = $this-> getBody($id_number);313 314 305 $file = "source_".$_SESSION[ 'phpgw_session' ][ 'session_id' ].".php"; 315 306 $f = fopen($tempDir.'/'.$file,"w"); 316 fputs($f, $header ."\r\n\r\n". $body);307 fputs($f, $this->export_msg_data( $params['msgs_to_export'], $params['folder'] ) ); 317 308 fclose($f); 318 309 319 imap_close($this->mbox_stream);320 310 return $tempDir.'/'.$file; 321 311 } … … 336 326 337 327 function export_to_archive($id_msg,$folder) { 338 $this-> folder = $folder;328 $this->folder = $folder; 339 329 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","ISO_8859-1"); 340 341 330 $tempDir = $this->tempDir; 342 331 … … 344 333 $header = $this-> getHeader($id_msg); 345 334 $body = $this-> getBody($id_msg); 346 $name = md5($_SESSION[ 'phpgw_session' ][ 'session_id' ].microtime());347 335 348 //$file = $_SESSION[ 'phpgw_session' ][ 'session_id' ].$name; 349 $file = "source_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]."_".time().".php"; //source_[sessao]_[timestamp].php 350 $f = fopen($tempDir . '/'.$file,"w"); 351 fputs($f,utf8_encode($header) ."\r\n\r\n". utf8_encode($body)); 336 $file = tempnam ($tempDir, 'source_#'.$id_msg); 337 $file .= '.php'; 338 $fileName = basename ($file); 339 $f = fopen($file, "w"); 340 fputs($f,$phpheader.$header ."\r\n\r\n". $body); 352 341 fclose($f); 342 $urlPath = 'tmpLclAtt/' . $fileName; 353 343 354 344 imap_close($this->mbox_stream); 355 345 return "inc/gotodownload.php?idx_file=".$tempDir . '/'.$file."&newfilename=fonte_da_mensagem.txt"; 346 } 356 347 357 }358 359 function get_attachments_in_array($params) {360 $return_attachments = array();361 362 $id_number = $params['num_msg'];363 $attachments =unserialize(rawurldecode($params['s_attachments']));364 365 $tempDir = dirname( __FILE__ ) . '/../tmpLclAtt';366 $tempSubDir = md5(microtime());367 exec('mkdir ' . $tempDir . '/'.$tempSubDir.'; cd ' . $tempDir . '/'.$tempSubDir);368 369 $this-> folder = $params['folder'];370 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");371 $this->connectImap();372 373 include_once("class.imap_attachment.inc.php");374 375 $imap_attachment = new imap_attachment();376 $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number);377 foreach($attachments as $i => $attachment){378 if($i && $i == 'names')379 continue;380 $fileNameReal = $this->remove_accents($attachment['name']);381 $ContentType = $this->getFileType($fileNameReal);382 $fileName = $fileNameReal . ".php";383 $f = fopen($tempDir . '/'.$tempSubDir.'/'.$fileName,"wb");384 if(!$f)385 return $tempDir . '/'.$tempSubDir.'/'.$fileName;386 387 $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachment['pid'], FT_UID);388 $urlPath = 'tmpLclAtt/'.$tempSubDir.'/'.$fileName;389 390 $headers = "<?php header('Content-Type: ".$ContentType."');391 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');392 header('Pragma: public');393 header('Expires: 0'); // set expiration time394 header('Content-Disposition: attachment; filename=\"". addslashes($fileNameReal) ."\"');\n echo ";395 396 if($attachment['encoding'] == 'base64') {397 $headers.=" imap_base64('".$fileContent."');?>";398 }399 else if($attachment['encoding'] == 'quoted_printable_decode') {400 $headers.=" quoted_printable_decode('".$fileContent."');?>";401 }402 else {403 $headers.=" '".$fileContent."';?>";404 }405 406 fputs($f,$headers);407 408 array_push($return_attachments,array('name' => $fileName,'url' => $urlPath,'pid' =>$attachment['pid']));409 fclose($f);410 }411 imap_close($this->mbox_stream);412 return $return_attachments;413 }414 415 416 348 function remove_accents($string) { 417 349 /* … … 423 355 "áàâãäéèêëíìîïóòôõöúùûüç?\"'!@#$%š&*()-=+Ž`[]{}~^,<>;:/?\\|¹²³£¢¬§ªº°ÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ", 424 356 "aaaaaeeeeiiiiooooouuuuc___________________________________________AAAAAEEEEIIIIOOOOOUUUUC"); 425 } 426 427 357 } 358 359 function get_attachments_headers( $folder, $id_number ){ 360 361 $this->folder = mb_convert_encoding($folder, "UTF7-IMAP","UTF-8"); 362 363 $return_attachments = array(); 364 365 include_once("class.attachment.inc.php"); 366 367 $imap_attachment = new attachment(); 368 $imap_attachment->setStructureFromMail( $folder, $id_number ); 369 $attachments = $imap_attachment->getAttachmentsInfo(); 370 371 foreach($attachments as $i => $attachment){ 372 373 $fileContent = $imap_attachment->getAttachment( $attachment['pid'] ); 374 375 $headers = "<?php header('Content-Type: {$attachment['type']}'); 376 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 377 header('Pragma: public'); 378 header('Expires: 0'); // set expiration time 379 header('Content-Disposition: attachment; filename=\"{$attachment['name']}\"');\n 380 echo '$fileContent';?>"; 381 382 $return_attachments[ $attachment['name'] ] = array( "content" => $headers, "pid" => $attachment['pid'] ); 383 } 384 385 return( $return_attachments ); 386 } 387 388 function get_attachments_in_array($params) { 389 $return_attachments = array(); 390 391 $attachments = $this->get_attachments_headers( $params['folder'], $params['num_msg'] ); 392 393 if( !empty( $attachments ) ) 394 { 395 foreach($attachments as $fileNameReal => $attachment){ 396 397 array_push($return_attachments,array('name' => $fileNameReal, 'pid' =>$attachment['pid'], 'contentType' => $this->getFileType( $fileNameReal ) )); 398 } 399 } 400 401 return $return_attachments; 402 403 } 404 428 405 private function getFileType($nameFile) { 429 406 $strFileType = strrev(substr(strrev(strtolower($nameFile)),0,4)); … … 529 506 if ($strFileType == ".eml") 530 507 $ContentType = "text/plain"; 508 if ($strFileType == ".png") 509 $ContentType = "image/png"; 531 510 return $ContentType; 532 511 } … … 534 513 function download_all_attachments($params) { 535 514 515 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 516 $atObj = new attachment(); 517 $atObj->setStructureFromMail($params['folder'],$params['num_msg']); 518 $attachments = $atObj->getAttachmentsInfo(); 536 519 $id_number = $params['num_msg']; 537 $attachments =unserialize(rawurldecode($params['s_attachments']));538 539 520 $tempDir = $this->tempDir; 540 521 $tempSubDir = $_SESSION['phpgw_session']['session_id']; … … 543 524 $this-> folder = $params['folder']; 544 525 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 545 $this->connectImap();546 include("class.imap_attachment.inc.php");547 $imap_attachment = new imap_attachment();548 $attachments = $imap_attachment->download_attachment($this->mbox_stream, $id_number);549 526 550 527 $fileNames = Array(); … … 583 560 if(!$f) 584 561 return False; 585 586 $fileContent = imap_fetchbody($this->mbox_stream, $id_number,$attachments[$i]['pid'], FT_UID); 587 if($attachments[$i]['encoding'] == 'base64') 588 fputs($f,imap_base64($fileContent)); 589 else 562 $fileContent = $atObj->getAttachment( $attachments[$i]['pid'] ); 590 563 fputs($f,$fileContent); 591 564 -
trunk/expressoMail1_2/inc/class.imap_attachment.inc.php
r3289 r5134 26 26 include_once("class.message_components.inc.php"); 27 27 28 $msg = &new message_components($mbox);28 $msg = new message_components($mbox); 29 29 $msg->fetch_structure($msgno); 30 30 … … 50 50 include_once("class.message_components.inc.php"); 51 51 52 $msg = &new message_components($mbox);52 $msg = new message_components($mbox); 53 53 $msg->fetch_structure($msgno); 54 54 $array_parts_attachments = array(); -
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r5083 r5134 27 27 var $foldersLimit; 28 28 var $imap_sentfolder; 29 var $rawMessage; 29 30 30 31 function imap_functions (){ 32 $this->init(); 33 } 34 35 function init(){ 31 36 $this->foldersLimit = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['imap_max_folders'] ? $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['imap_max_folders'] : 20000; //Limit of folders (mailboxes) user can see 32 37 $this->username = $_SESSION['phpgw_info']['expressomail']['user']['userid']; … … 53 58 function open_mbox($folder = False,$force_die=true) 54 59 { 55 $folder = mb_convert_encoding($folder, "UTF7-IMAP", "ISO_8859-1");60 $folder = mb_convert_encoding($folder, "UTF7-IMAP", mb_detect_encoding($folder.'x', 'UTF-8, ISO-8859-1, UTF7-IMAP')); 56 61 if (is_resource($this->mbox)) 57 62 { … … 80 85 } 81 86 82 function parse_error($error ){87 function parse_error($error, $field = ''){ 83 88 // This error is returned from Imap. 84 89 if(strstr($error,'Connection refused')) { 85 90 return str_replace("%1", $this->functions->getLang("Mail"), $this->functions->getLang("Connection failed with %1 Server. Try later.")); 86 91 } 87 else if(strstr($error,'virus')) {92 else if(strstr($error,'virus')) { 88 93 return str_replace("%1", $this->functions->getLang("Mail"), $this->functions->getLang("Your message was rejected by antivirus. Perhaps your attachment has been infected.")); 94 } 95 else if(strstr($error,'Failed to add recipient:')) { 96 preg_match_all('/:\s([\s\.";@!a-z0-9]+)\s\[SMTP:/', $error, $res); 97 return str_replace("%1", $res['1']['0'], $this->functions->getLang("SMTP Error: The following recipient addresses failed: %1")); 98 } 99 else if(strstr($error,'Recipient address rejected')) { 100 return str_replace("%1", $this->functions->getLang("Mail"), $this->functions->getLang("Invalid recipients in the message").'.'); 101 } 102 else if(strstr($error,'Invalid Mail:')) { 103 return str_replace("%1", $field, $this->functions->getLang("The recipients addresses failed %1")); 104 } 105 else if(strstr($error,'Message file too big')) { 106 return ($this->functions->getLang("Message file too big.")); 89 107 } 90 108 // This condition verifies if SESSION is expired. … … 102 120 $msg_range_begin = $params['msg_range_begin']; 103 121 $msg_range_end = $params['msg_range_end']; 104 $sort_box_type = $params['sort_box_type']; 105 $sort_box_reverse = $params['sort_box_reverse']; 106 $search_box_type = $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" ? $params['search_box_type'] : false; 107 108 $folder = $params['folder']; 109 $msg_range_begin = $params['msg_range_begin']; 110 $msg_range_end = $params['msg_range_end']; 111 $sort_box_type = $params['sort_box_type']; 112 $sort_box_reverse = $params['sort_box_reverse']; 113 $search_box_type = $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" ? $params['search_box_type'] : false; 122 $sort_box_type = isset($params['sort_box_type']) ? $params['sort_box_type'] : ''; 123 $sort_box_reverse = isset($params['sort_box_reverse']) ? $params['sort_box_reverse'] : ''; 124 $search_box_type = (isset($params['search_box_type']) && $params['search_box_type'] != "ALL" && $params['search_box_type'] != "" )? $params['search_box_type'] : false; 114 125 115 126 if( !$this->mbox || !is_resource( $this->mbox ) ) … … 138 149 { 139 150 $temp = $this->get_info_head_msg($msg_number); 140 //$temp['msg_sample'] = $this->get_msg_sample($msg_number,$folder);151 $temp['msg_sample'] = $this->get_msg_sample($msg_number,$folder); 141 152 if(!$temp) 142 153 return false; … … 238 249 } 239 250 251 if(isset($header->from)) 240 252 $from = $header->from; 241 253 $head_array['from'] = array(); 242 254 $head_array['from']['name'] = ( isset( $from[0]->personal ) ) ? $this->decode_string($from[0]->personal) : NULL; 255 if(isset($from)) 243 256 $head_array['from']['email'] = $this->decode_string($from[0]->mailbox) . "@" . $from[0]->host; 244 if(!$head_array['from']['name']) 257 else 258 $head_array['from']['email'] = $this->decode_string($from[0]->mailbox) . "@"; 259 if(!$head_array['from']['name'] || trim($head_array['from']['name']) === '' ) 245 260 $head_array['from']['name'] = $head_array['from']['email']; 261 if(isset($header->to)) 246 262 $to = $header->to; 247 263 $head_array['to'] = array(); 248 if( $to[1]&& $to[1]->host == ".SYNTAX-ERROR.") { //E-mails que não possuem o campo "para", vêm com o recipiente preenchido, porém com um recipiente a mais alegando erro de sintaxe.264 if(isset($to[1]) && $to[1]->host == ".SYNTAX-ERROR.") { //E-mails que não possuem o campo "para", vêm com o recipiente preenchido, porém com um recipiente a mais alegando erro de sintaxe. 249 265 $head_array['to']['name'] = $head_array['to']['email'] = NULL; 250 266 } … … 256 272 $head_array['to']['name'] = $head_array['to']['email']; 257 273 } 274 $cc = null; 275 $cco = null; 276 if(isset($header->cc)){ 258 277 $cc = $header->cc; 278 } 279 if(isset($header->bcc)){ 259 280 $cco = $header->bcc; 281 } 260 282 if ( ($cc) && (!$head_array['to']['name']) ){ 261 283 $head_array['to']['name'] = ( isset( $cc[0]->personal ) ) ? $this->decode_string($cc[0]->personal) : NULL; 262 284 $head_array['to']['email'] = $this->decode_string($cc[0]->mailbox) . "@" . $cc[0]->host; 263 if(!$head_array['to']['name']) 264 $head_array['to']['name'] = $head_array['from']['email']; 285 if(!$head_array['to']['name']){ 286 $head_array['to']['name'] = $head_array['from']['name']; 287 //$head_array['to']['email'] = $head_array['from']['email']; 288 } 265 289 } 266 290 else if ( ($cco) && (!$head_array['to']['name']) ){ … … 268 292 $head_array['to']['email'] = $this->decode_string($cco[0]->mailbox) . "@" . $cco[0]->host; 269 293 if(!$head_array['to']['name']) 270 $head_array['to']['name'] = $head_array['from'][' email'];294 $head_array['to']['name'] = $head_array['from']['name']; 271 295 } 272 296 $head_array['subject'] = ( isset( $header->fetchsubject ) ) ? $this->decode_string($header->fetchsubject) : ''; 297 if($head_array['subject'] == "" || $head_array['subject'] == '' || $head_array['subject'] == null ){ 298 $head_array['subject'] = $this->functions->getLang("(no subject) "); 299 } 300 301 if($head_array['to']['name'] == 'undisclosed-recipients@' || $head_array['to']['name'] == '@'){ 302 $head_array['to']['name'] = $head_array['from']['name']; 303 $head_array['to']['email'] = $head_array['from']['email']; 304 } 273 305 274 306 $head_array['Size'] = $header->Size; … … 280 312 } 281 313 282 283 314 /** 284 * Decodifica a string da mensagem285 315 * 286 316 * @license http://www.gnu.org/copyleft/gpl.html GPL 287 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 288 * @sponsor Caixa Econômica Federal 289 * @param $string 317 * @param string $string String a ser decodificada 318 * @return string 290 319 * @todo Verificar a possibilidade de se utilizar a função iconv_mime_decode, que é capaz de identificar a codificação por si só, mas que pode ser interpretada de forma diversa dependendo da implementação do sistema 291 320 * @todo Executar testes suficientes para validar a funçao iconv_mime_decode em substituição à este método decode_string … … 293 322 function decode_string($string) 294 323 { 324 $return = ''; 325 $decoded = ''; 295 326 if ((strpos(strtolower($string), '=?iso-8859-1') !== false) || (strpos(strtolower($string), '=?windows-1252') !== false)) 296 327 { 297 $retun = '';298 328 $tmp = imap_mime_header_decode($string); 299 329 foreach ($tmp as $tmp1) … … 335 365 336 366 } 337 else if (eregi('=?', $string))338 return iconv_mime_decode($string);367 else if( strpos( $string , '=?' ) !== false ) 368 return $this->htmlspecialchars_encode(iconv_mime_decode( $string )); 339 369 340 370 … … 409 439 $email 410 440 ); 411 if(!$status){ 441 if(!$status) { 442 //TODO: remover zip_entry pois ele é tratado apenas ao importar mensagens zipadas 412 443 array_push($errors,zip_entry_name($zip_entry)); 413 444 zip_entry_close($zip_entry); 445 } 446 447 if ( isset( $tmp_box ) && ! sizeof( $errors ) ) { 448 $mc = imap_check($this->mbox); 449 450 $result = imap_fetch_overview( $this -> mbox, "1:{$mc -> Nmsgs}", 0 ); 451 452 $ids = array( ); 453 foreach ($result as $overview) 454 $ids[ ] = $overview -> uid; 455 456 return implode( ',', $ids ); 414 457 } 415 458 } … … 457 500 } 458 501 459 $msg = &new message_components($this->mbox);502 $msg = new message_components($this->mbox); 460 503 $msg->fetch_structure($params["msg_num"]);/* O fetchbody tava trazendo o email com problemas na acentuação. 461 504 Então uso essa classe para verificar a codificação e o charset, … … 492 535 "\r\n". 493 536 "\r\n". 494 str_replace("\n","\r\n", $this->decodeBody(537 str_replace("\n","\r\n",preg_replace("/<img[^>]+\>/i", " ", $this->decodeBody( 495 538 imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),$body_part_to_show), 496 539 $all_body_encoding, $all_body_charset 497 ) 498 ), "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 540 )) 541 ), "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. //Remove imagens do corpo, pois estas estão na lista de anexo e serão removidas. 499 542 500 543 if(!$status) … … 570 613 $attach_params["num_msg"] = $msg_number; 571 614 $msg_info['array_attach'] = $exporteml->get_attachments_in_array($attach_params); 572 $msg_info['url_export_file'] = $exporteml->export_to_archive($msg_number,$params["folder"]);573 615 imap_close($this->mbox); 574 616 $this->mbox=false; … … 589 631 590 632 /** 591 * Retorna a linha do Header da mensagem592 *593 633 * @license http://www.gnu.org/copyleft/gpl.html GPL 594 634 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 595 * @sponsor Caixa Econômica Federal 596 * @param $msg_number 635 * @param $msg_number numero da mensagem 597 636 */ 598 637 function getRawHeader($msg_number) … … 601 640 } 602 641 603 604 642 /** 605 * Retorna a linha do Corpo da mensagem606 *607 643 * @license http://www.gnu.org/copyleft/gpl.html GPL 608 644 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 609 * @sponsor Caixa Econômica Federal 610 * @param $msg_number 645 * @param $msg_number numero da mensagem 611 646 */ 612 647 function getRawBody($msg_number) … … 617 652 618 653 /** 619 * Constrói o Header da mensagem620 *621 654 * @license http://www.gnu.org/copyleft/gpl.html GPL 622 655 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 623 * @sponsor Caixa Econômica Federal 624 * @param $msg 656 * @param $msg mensagem 625 657 */ 626 658 function builderMsgHeader($msg) … … 654 686 655 687 /** 656 * Constrói o corpo da mensagem 657 * 658 * @license http://www.gnu.org/copyleft/gpl.html GPL 659 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 660 * @sponsor Caixa Econômica Federal 661 * @param $structure 662 * @param $content 663 * @param $printHeader 688 * Constroe o corpo da msg direto na variavel de conteudo 689 * @param Mail_mimeDecode $structure 690 * @param <type> $content Ponteiro para Variavel de conteudo da msg 664 691 */ 665 692 function builderMsgBody($structure , &$content , $printHeader = false) … … 676 703 { 677 704 case 'text': 678 $disposition = strtolower($part->disposition);705 $disposition = isset($part->disposition) ? strtolower($part->disposition) : ''; 679 706 if($disposition != 'attachment') 680 707 { … … 694 721 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body,$part->ctype_parameters['charset'],false)).'</pre>'; 695 722 } 696 697 723 if(strtolower($part->ctype_secondary) == 'calendar') 724 $content.= $this->builderMsgCalendar($this->decodeMailPart($part->body, $part->ctype_parameters['charset'])); 698 725 699 726 } … … 735 762 { 736 763 case 'text': 737 738 $disposition = strtolower($part->disposition); 764 $disposition = ''; 765 if(isset($part->disposition)) 766 $disposition = isset($part->disposition) ? strtolower($part->disposition) : ''; 739 767 if($disposition != 'attachment') 740 768 { … … 754 782 $content .= '<pre>'. htmlentities($this->decodeMailPart($part->body,$part->ctype_parameters['charset'],false)).'</pre>'; 755 783 } 756 784 if(strtolower($part->ctype_secondary) == 'calendar') 785 $content .= $this->builderMsgCalendar($part->body); 757 786 758 787 } … … 767 796 break; 768 797 case 'message': 769 798 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['nested_messages_are_shown'] != '1') 799 { 770 800 if(!is_array($part->parts)) 771 801 { … … 781 811 } 782 812 } 783 813 } 784 814 785 815 786 816 /** 787 * Retorna o788 *789 817 * @license http://www.gnu.org/copyleft/gpl.html GPL 790 818 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 791 * @sponsor Caixa Econômica Federal 792 * @param $msg_number 819 * @param $msg_number numero da mensagem 793 820 */ 794 821 function get_msg_sample($msg_number) 795 822 { 823 $content = ''; 796 824 797 825 $return = ""; … … 804 832 805 833 include_once("class.message_components.inc.php"); 806 $msg = &new message_components($this->mbox);834 $msg = new message_components($this->mbox); 807 835 $msg->fetch_structure($msg_number); 808 836 809 if(! $msg->structure[$msg_number]->parts)837 if(!isset($msg->structure[$msg_number]->parts)) 810 838 { 811 839 $content = ''; … … 827 855 } 828 856 } 829 $content = $this->replace_special_characters($content); 857 830 858 $tags_replace = array("<br>","<br/>","<br />"); 831 $content = str_replace($tags_replace," ", $content); 832 $content = strip_tags($content); 833 $content = str_replace(array("{","}"," "), " ", $content); 834 $content = trim($content); 835 $content = html_entity_decode(substr($content,0,300)); 859 $content = str_replace($tags_replace," ", nl2br($content)); 860 $content = $this->html2txt($content); 836 861 $content != "" ? $return['body'] = " - " . $content: $return['body'] = ""; 862 $return['body'] = base64_encode(mb_convert_encoding(substr($return['body'], 0, 305),'ISO-8859-1')); 837 863 return $return; 838 864 } 865 function html2txt($document){ 866 $search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript 867 '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags 868 '@<style[^>]*?>.*?</style>@siU', // Strip style tags properly 869 '@<![\s\S]*?--[ \t\n\r]*>@si' // Strip multi-line comments including CDATA 870 ); 871 $text = preg_replace($search, '', $document); 872 return html_entity_decode($text); 873 } 874 875 function ope_msg_part($params) 876 { 877 $return = array(); 878 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 839 879 880 $atObj = new attachment(); 881 $atObj->setStructureFromMail($params['msg_folder'],$params['msg_number']); 882 $mbox_stream = $this->open_mbox($params['save_folder']); 883 $return['append'] = imap_append($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$params['save_folder'], $atObj->getAttachment($params['msg_part']), "\\Seen \\Draft"); 884 $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$params['save_folder'], SA_UIDNEXT); 840 885 886 $return['msg_folder'] = $params['save_folder']; 887 $return['msg_number'] = $status->uidnext - 1; 888 889 return $return; 890 891 } 841 892 842 893 function get_info_msg($params) … … 846 897 $msg_folder = urldecode($params['msg_folder']); 847 898 848 if(preg_match(' (.+)(_[a-zA-Z0-9]+)',$msg_number,$matches)) { //Verifies if it comes from a tab diferent of the main one.899 if(preg_match('/(.+)(_[a-zA-Z0-9]+)/',$msg_number,$matches)) { //Verifies if it comes from a tab diferent of the main one. 849 900 $msg_number = $matches[1]; 850 901 $plus_id = $matches[2]; … … 879 930 $return['attachments'] = $return_get_body['attachments']; 880 931 $return['thumbs'] = $return_get_body['thumbs']; 881 $return['signature'] = $return_get_body['signature'];932 //$return['signature'] = $return_get_body['signature']; 882 933 } 883 934 $pattern = '/^[ \t]*Disposition-Notification-To:[ ]*<?[[:alnum:]\._-]+@[[:alnum:]_-]+[\.[:alnum:]]+>?/sm'; … … 906 957 $return['msg_folder'] = $msg_folder; 907 958 908 $date_msg = gmdate("d/m/Y",$header->udate); 909 if (date("d/m/Y") == $date_msg) 910 $return['udate'] = gmdate("H:i",$header->udate); 911 else 912 $return['udate'] = $date_msg; 959 960 961 $msgTimesTamp = $header->udate + $this->functions->CalculateDateOffset(); //Aplica offset do usuario 962 $date_msg = gmdate("d/m/Y",$msgTimesTamp); 963 964 // Removido codigo pois a o método send_nofication precisa da data completa. 965 // if (date("d/m/Y") == $date_msg) 966 // $return['udate'] = gmdate("H:i",$header->udate); 967 // else 968 969 // Passa o a data completa para mensagem. 970 $return['udate'] = $header->udate; 913 971 914 972 $return['msg_day'] = $date_msg; 915 $return['msg_hour'] = gmdate("H:i",$ header->udate);973 $return['msg_hour'] = gmdate("H:i",$msgTimesTamp); 916 974 917 975 if (date("d/m/Y") == $date_msg) //no dia 918 976 { 919 $return['fulldate'] = gmdate("d/m/Y H:i",$header->udate); 920 $return['smalldate'] = gmdate("H:i",$header->udate); 921 922 $timestamp_now = strtotime("now") + $offset; 923 $timestamp_msg_time = $header->udate; 977 $return['fulldate'] = gmdate("d/m/Y H:i",$msgTimesTamp); 978 $return['smalldate'] = gmdate("H:i",$msgTimesTamp); 979 980 981 $timestamp_now = strtotime("now"); 982 // removido offset nao esta sendo parametrizado 983 // $timestamp_now = strtotime("now") + $offset; 984 985 986 $timestamp_msg_time = $msgTimesTamp; 924 987 // $timestamp_now is GMT and $timestamp_msg_time is MailDate TZ. 925 988 // The variable $timestamp_diff is calculated without MailDate TZ. … … 945 1008 } 946 1009 else{ 947 $return['fulldate'] = gmdate("d/m/Y H:i",$ header->udate);948 $return['smalldate'] = gmdate("d/m/Y",$ header->udate);1010 $return['fulldate'] = gmdate("d/m/Y H:i",$msgTimesTamp); 1011 $return['smalldate'] = gmdate("d/m/Y",$msgTimesTamp); 949 1012 } 950 1013 951 1014 $from = $header->from; 952 1015 $return['from'] = array(); 953 $return['from']['name'] = $this->decode_string($from[0]->personal);1016 $return['from']['name'] = isset($sender[0]->personal) ? $this->decode_string($from[0]->personal) : ''; 954 1017 $return['from']['email'] = $this->decode_string($from[0]->mailbox . "@" . $from[0]->host); 955 1018 if ($return['from']['name']) … … 966 1029 $sender = $header->sender; 967 1030 $return['sender'] = array(); 968 $return['sender']['name'] = $this->decode_string($sender[0]->personal);1031 $return['sender']['name'] = isset($sender[0]->personal) ? $this->decode_string($sender[0]->personal): ''; 969 1032 $return['sender']['email'] = $this->decode_string($sender[0]->mailbox . "@" . $sender[0]->host); 1033 970 1034 if ($return['sender']['name']) 971 1035 { … … 1014 1078 $return['toaddress2'] = ""; 1015 1079 } 1016 1080 if(isset($header->cc)) 1017 1081 $cc = $header->cc; 1018 1082 $return['cc'] = ""; … … 1027 1091 $return['cc'] .= " "; 1028 1092 $return['cc'] .= "<"; 1093 if ($tmp_cc->host != 'unspecified-domain') 1029 1094 $return['cc'] .= $tmp_cc->mailbox . "@" . $tmp_cc->host; 1095 else 1096 $return['cc'] .= $tmp_cc->mailbox; 1097 //$return['cc'] .= $tmp_cc->mailbox . "@" . $tmp_cc->host; 1030 1098 $return['cc'] .= ">"; 1031 1099 $return['cc'] .= ", "; … … 1033 1101 else 1034 1102 { 1103 if ($tmp_cc->host != 'unspecified-domain') 1035 1104 $return['cc'] .= $tmp_cc->mailbox . "@" . $tmp_cc->host; 1105 else 1106 $return['cc'] .= $tmp_cc->mailbox; 1107 //$return['cc'] .= $tmp_cc->mailbox . "@" . $tmp_cc->host; 1036 1108 $return['cc'] .= ", "; 1037 1109 } … … 1049 1121 # @BRIEF Adding the BCC field. 1050 1122 ## 1051 1123 if(isset($header->bcc)){ 1052 1124 $bcc = $header->bcc; 1125 } 1053 1126 $return['bcc'] = ""; 1054 1127 if (!empty($bcc)) … … 1062 1135 $return['bcc'] .= " "; 1063 1136 $return['bcc'] .= "<"; 1137 if ($tmp_bcc->host != 'unspecified-domain') 1064 1138 $return['bcc'] .= $tmp_bcc->mailbox . "@" . $tmp_bcc->host; 1139 else 1140 $return['bcc'] .= $tmp_bcc->mailbox; 1065 1141 $return['bcc'] .= ">"; 1066 1142 $return['bcc'] .= ", "; … … 1068 1144 else 1069 1145 { 1146 if ($tmp_bcc->host != 'unspecified-domain') 1070 1147 $return['bcc'] .= $tmp_bcc->mailbox . "@" . $tmp_bcc->host; 1148 else 1149 $return['bcc'] .= $tmp_bcc->mailbox; 1150 //$return['bcc'] .= $tmp_bcc->mailbox . "@" . $tmp_bcc->host; 1071 1151 $return['bcc'] .= ", "; 1072 1152 } … … 1107 1187 $return['reply_to'] = $this->decode_string($return['reply_to']); 1108 1188 $return['subject'] = $this->decode_string($header->fetchsubject); 1189 1190 if($return['subject'] == $this->functions->getLang("(no subject) ")){ 1191 $return['subject'] = str_replace(" ","", $return['subject']); 1192 } 1193 if($return['subject'] == '' || $return['subject'] == null){ 1194 $return['subject'] = $this->functions->getLang("(no subject) "); 1195 } 1109 1196 $return['Size'] = $header->Size; 1110 1197 $return['reply_toaddress'] = $header->reply_toaddress; … … 1115 1202 $return['reply_toaddress'] = $header->reply_toaddress; 1116 1203 1204 if(($return['from']['email'] == '@unspecified-domain' || $return['sender']['email'] == null) && $return['msg_folder'] == 'INBOX/Drafts'){ 1205 $return['from']['email'] = "Rascunho"; 1206 } 1207 if($return['toaddress2'] == 'undisclosed-recipients@, @'){ 1208 $return['toaddress2'] = $this->functions->getLang('without destination'); 1209 } 1117 1210 return $return; 1118 1211 } 1119 1212 1120 1213 1121 /** 1214 /* 1122 1215 * Converte textos utf8 para o padrão html. 1123 * 1124 * @license http://www.gnu.org/copyleft/gpl.html GPL 1125 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 1126 * @sponsor Caixa Econômica Federal 1216 * Modificado por Cristiano Corrêa Schmidt 1217 * @link http://php.net/manual/en/function.utf8-decode.php 1127 1218 * @author luka8088 <luka8088@gmail.com> 1128 * @param $data1129 1219 */ 1130 1220 function utf8_to_html ($data) … … 1138 1228 foreach((str_split(strrev(chr((ord($data{0}) % 252 % 248 % 240 % 224 % 192) + 128) . substr($data, 1)))) as $k => $v) 1139 1229 $ret += (ord($v) % 128) * pow(64, $k); 1140 return "&#$ret;";1230 return html_entity_decode("&#$ret;" , ENT_QUOTES); 1141 1231 } 1142 1232 //------------------------------------------------------------------------------// 1143 1233 1144 1234 1145 1146 1147 1235 /** 1148 * Decodifica a parte do email 1149 * 1150 * @license http://www.gnu.org/copyleft/gpl.html GPL 1151 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 1152 * @sponsor Caixa Econômica Federal 1153 * @param $part 1154 * @param $encode 1155 * @param $html 1236 * Decodifica uma part da mensagem para iso-8859-1 1237 * @param <type> $part parte do email 1238 * @param <type> $encode codificação da parte 1239 * @return <type> string decodificada 1156 1240 */ 1157 1241 function decodeMailPart($part, $encode, $html = true) … … 1164 1248 1165 1249 case 'utf-8': 1166 if ($html) 1167 return $this->utf8_to_html($part); 1168 else 1169 return utf8_decode ($part); 1250 if ($html) return $this->utf8_to_html($part); 1251 else return utf8_decode ($part); 1170 1252 break; 1171 1253 … … 1185 1267 require_once $_SESSION['rootPath'].'/library/mime/mimeDecode.php'; 1186 1268 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 1187 1269 //include_once("class.message_components.inc.php"); 1188 1270 //--------------------------------------------------------------------// 1189 1271 1190 1272 $return = array(); 1191 1273 1192 $msg = &new message_components($this->mbox);1193 1274 // $msg = new message_components($this->mbox); 1275 // $msg->fetch_structure($msg_number); 1194 1276 1195 1277 $content = ''; 1196 1278 1197 $rawMessageData = $this->getRawHeader($msg_number).$this->getRawBody($msg_number); 1279 /* 1280 * Chamada original $this->getRawHeader($msg_number)."\r\n".$this->getRawBody($msg_number); 1281 * Inserido replace para corrigir um bug que acontece raramente em mensagens vindas do outlook com muitos destinatarios 1282 */ 1283 $rawMessageData = str_replace("\r\n\t", '', $this->getRawHeader($msg_number))."\r\n".$this->getRawBody($msg_number); 1198 1284 1199 1285 $decoder = new Mail_mimeDecode($rawMessageData); … … 1202 1288 $params['decode_bodies'] = true; 1203 1289 $params['decode_headers'] = true; 1290 if(array_key_exists('nested_messages_are_shown', $_SESSION['phpgw_info']['user']['preferences']['expressoMail']) && ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['nested_messages_are_shown'] == '1')) 1291 $params['rfc_822bodies'] = true; 1204 1292 $structure = $decoder->decode($params); 1205 1293 … … 1227 1315 { 1228 1316 $return['thumbs'] = $this->get_thumbs($images,$msg_number,$msg_folder); 1229 1317 // $return['signature'] = $this->get_signature($msg,$msg_number,$msg_folder); 1230 1318 } 1231 1319 … … 1241 1329 1242 1330 $msg_subtype = strtolower($structure->ctype_secondary); 1331 if(isset($structure->disposition)) 1243 1332 $disposition = strtolower($structure->disposition); 1333 else 1334 $disposition = ''; 1244 1335 1245 1336 if(($msg_subtype == "html" || $msg_subtype == 'plain') && ($disposition != 'attachment')) 1246 1337 { 1247 1248 1249 1338 if(strtolower($msg_subtype) == 'plain') 1250 1339 { 1340 if(isset($structure->ctype_parameters['charset'])) 1251 1341 $content = $this->decodeMailPart($structure->body, $structure->ctype_parameters['charset'],false); 1342 else 1343 $content = $this->decodeMailPart($structure->body, null,false); 1252 1344 $content = str_replace( array( '<', '>' ), array( ' #$<$# ', ' #$>$# ' ), $content ); 1253 1345 $content = htmlentities( $content ); … … 1260 1352 $content = $this->decodeMailPart($structure->body, $structure->ctype_parameters['charset']); 1261 1353 } 1354 if(strtolower($structure->ctype_secondary) == 'calendar') 1355 $content .= $this->builderMsgCalendar($structure->body); 1262 1356 1263 1357 break; 1264 1358 1265 1359 case 'multipart': 1266 $this-> 1360 $this->builderMsgBody($structure , $content); 1267 1361 1268 1362 break; 1269 1363 1270 1364 case 'message': 1365 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['nested_messages_are_shown'] != 1) 1366 { 1271 1367 if(!is_array($structure->parts)) 1272 1368 { … … 1277 1373 else 1278 1374 $this->builderMsgBody($structure , $content,true); 1279 1375 } 1280 1376 break; 1281 1377 1378 case 'application': 1379 if(strtolower($structure->ctype_secondary) == 'x-pkcs7-mime') 1380 { 1381 // $return['body']='isCripted'; 1382 // return $return; 1383 1384 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 1385 $rawMessageData2 = $this->extractSignedContents($rawMessageData); 1386 if($rawMessageData2 === false){ 1387 $return['body']='isCripted'; 1388 return $return; 1389 } 1390 $decoder2 = new Mail_mimeDecode($rawMessageData2); 1391 $structure2 = $decoder2->decode($params); 1392 $this-> builderMsgBody($structure2 , $content); 1393 1394 $attachmentManager->setStructure($structure2); 1395 /* 1396 * Monta informações dos anexos para o cabecarios 1397 */ 1398 $attachments = $attachmentManager->getAttachmentsInfo(); 1399 $return['attachments'] = $attachments; 1400 1401 //----------------------------------------------// 1402 1403 /* 1404 * Monta informações das imagens 1405 */ 1406 $images = $attachmentManager->getEmbeddedImagesInfo(); 1407 //----------------------------------------------// 1408 1409 if(!$this->has_cid){ 1410 $return['thumbs'] = $this->get_thumbs($images,$msg_number,$msg_folder); 1411 $return['signature'] = $this->get_signature($msg,$msg_number,$msg_folder); 1412 } 1413 } 1414 /////////////////////////////////////////////////////////////////////////////////////////// 1282 1415 default: 1283 1416 if(count($attachments) > 0) 1284 1417 $content .= ''; 1285 else1286 {1287 $content .= $this->functions->getLang('Message not supported') . '. ';1288 $content .= $this->functions->getLang('Type') . ': ' . $structure->ctype_primary . '/' . $structure->ctype_secondary;1289 }1290 1418 break; 1291 1419 } … … 1301 1429 } 1302 1430 1431 1432 //TODO: Descartar código após atualização do módulo de segurança da SERPRO 1433 function extractSignedContents( $data ) 1434 { 1435 $pipes_desc = array( 1436 0 => array('pipe', 'r'), 1437 1 => array('pipe', 'w') 1438 ); 1439 1440 $fp = proc_open( 'openssl smime -verify -noverify -nochain', $pipes_desc, $pipes); 1441 if (!is_resource($fp)) { 1442 return false; 1443 } 1444 1445 $output = ''; 1446 1447 /* $pipes[0] => writeable handle connected to child stdin 1448 $pipes[1] => readable handle connected to child stdout */ 1449 fwrite($pipes[0], $data); 1450 fclose($pipes[0]); 1451 1452 while (!feof($pipes[1])) { 1453 $output .= fgets($pipes[1], 1024); 1454 } 1455 fclose($pipes[1]); 1456 proc_close($fp); 1457 1458 return $output; 1459 } 1460 /////////////////////////////////////////////////////////////////////////////////////// 1461 1462 function builderMsgCalendar($calendar) 1463 { 1464 $icalService = ServiceLocator::getService('ical'); 1465 1466 $codificao = mb_detect_encoding($calendar.'x', 'UTF-8, ISO-8859-1'); 1467 if($codificao == 'UTF-8') 1468 $calendar = utf8_decode($calendar); 1469 1470 if($icalService->setIcal($calendar)) 1471 { 1472 $content = ''; 1473 1474 switch ($icalService->getMethod()) { 1475 1476 case 'REPLY': 1477 include_once($_SESSION['rootPath'].'/header.inc.php'); 1478 include_once($_SESSION['rootPath'].'/calendar/inc/class.boicalendar.inc.php'); 1479 $boicalendar = new boicalendar(); 1480 1481 $ical = $icalService->getComponent('vevent'); 1482 $content.= '<b>'.$this->functions->getLang('Event Calendar').'</b><br /><br />'; 1483 $content.= '<span style="font-size: 12" >'; 1484 $notExist = false; 1485 1486 foreach ($ical['attendee'] as $attendee) 1487 { 1488 if($attendee['params']['PARTSTAT'] == 'ACCEPTED') 1489 { 1490 if($boicalendar->updateExParticipantState($ical['uid']['value'],$attendee['value'],'ACCEPTED',$attendee['params']['CN'])) 1491 { 1492 $content.= $this->functions->getLang('User').' '; 1493 if($attendee['params']['CN']) 1494 $content.= '<b>'.$attendee['params']['CN'].'</b> '; 1495 else 1496 $content.= '<b>'.$attendee['value'].'</b> '; 1497 1498 $content.= $this->functions->getLang('accepted your event'); 1499 } 1500 else 1501 $notExist = true; 1502 } 1503 1504 if($attendee['params']['PARTSTAT'] == 'TENTATIVE') 1505 { 1506 if($boicalendar->updateExParticipantState($ical['uid']['value'],$attendee['value'],'TENTATIVE',$attendee['params']['CN'])) 1507 { 1508 $content.= $this->functions->getLang('User').' '; 1509 if($attendee['params']['CN']) 1510 $content.= '<b>'.$attendee['params']['CN'].'</b> '; 1511 else 1512 $content.= '<b>'.$attendee['value'].'</b> '; 1513 1514 if($ical['description']['value']) 1515 $content.= ' <br /> '.str_replace('\n','<br />',nl2br($ical['description']['value'])); 1516 else 1517 $content.= $this->functions->getLang('provisionally accepted you event'); 1518 } 1519 else 1520 $notExist = true; 1521 } 1522 1523 if($attendee['params']['PARTSTAT'] == 'DECLINED') 1524 { 1525 if($boicalendar->updateExParticipantState($ical['uid']['value'],$attendee['value'],'DECLINED',$attendee['params']['CN'])) 1526 { 1527 $content.= $this->functions->getLang('User').' '; 1528 if($attendee['params']['CN']) 1529 $content.= '<b>'.$attendee['params']['CN'].'</b> '; 1530 else 1531 $content.= '<b>'.$attendee['value'].'</b> '; 1532 1533 if($ical['description']['value']) 1534 $content.= ' <br /> '.str_replace('\n','<br />',nl2br($ical['description']['value'])); 1535 else 1536 $content.= $this->functions->getLang('provisionally decline you event'); 1537 } 1538 else 1539 $notExist = true; 1540 } 1541 } 1542 if($notExist) 1543 $content.= '<b><span style="color:red">'.$this->functions->getLang('This event does not exist on its agenda').'.</span></b>'; 1544 $content.= '</span><br /><br />'; 1545 1546 break; 1547 1548 case 'CANCEL': 1549 1550 $ical = $icalService->getComponent('vevent'); 1551 $content.= '<b>'.$this->functions->getLang('Event Calendar').'</b><br /><br />'; 1552 $content.= '<span style="font-size: 12" >'; 1553 $content.= '<b><span style="color:red">'.$this->functions->getLang('Your event has been canceled').'</span></b>'; 1554 1555 if($ical['description']['value']) 1556 $content.= ' <br /> <br /> '.str_replace('\n','<br />',nl2br($ical['description']['value'])); 1557 1558 $content.= '<br /><b>* '.$this->functions->getLang('To remove the event from your calendar to import the iCal file attached').'.</b>'; 1559 $content.= '</span><br /><br />'; 1560 break; 1561 1562 case 'REQUEST': 1563 1564 $ical = $icalService->getComponent('vevent'); 1565 if($ical['dtstart']['value']['tz'] == 'Z') 1566 { 1567 $tz = $_SESSION['phpgw_info']['user']['preferences']['common']['tz_offset']; 1568 $ical['dtstart']['value']['hour'] += $tz; 1569 $ical['dtend']['value']['hour'] += $tz; 1570 } 1571 1572 $content.= '<b>'.$this->functions->getLang('Event Calendar').'</b><br />'. 1573 ' <br /> <b>'.$this->functions->getLang('Title').': </b>'.$ical['summary']['value']. 1574 ' <br /> <b>'.$this->functions->getLang('Location').': </b>'.$ical['location']['value']. 1575 ' <br /> <b>'.$this->functions->getLang('Details').': </b>'. str_replace('\n','<br />',nl2br($ical['description']['value'])); 1576 $content.= ' <br /> <b>'.$this->functions->getLang('Start') . ': </b>' . $ical['dtstart']['value']['day'] . "/" . $ical['dtstart']['value']['month'] . "/" . $ical['dtstart']['value']['year'] . " - " . $ical['dtstart']['value']['hour'] . ":" . $ical['dtstart']['value']['min'] ; 1577 $content.= ' <br /> <b>'.$this->functions->getLang('End') . ': </b>' . $ical['dtend']['value']['day'] . "/" . $ical['dtend']['value']['month'] . "/" . $ical['dtend']['value']['year'] . " - " . $ical['dtend']['value']['hour'] . ":" . $ical['dtend']['value']['min'] ; 1578 1579 if($ical['organizer']['params']['CN']) 1580 $content.= ' <br /> <b>'.$this->functions->getLang('Organizer').': </b>'.$ical['organizer']['params']['CN'].' - <a href="MAILTO:'.$ical['organizer']['value'].'">'.$ical['organizer']['value'].'</a></li>' ; 1581 else 1582 $content.= ' <br /> <b>'.$this->functions->getLang('Organizer').': </b> <a href="MAILTO:'.$ical['organizer']['value'].'">'.$ical['organizer']['value'].'</a>' ; 1583 1584 if($ical['attendee']) 1585 { 1586 $att = ' <br /> <b>'.$this->functions->getLang('Participants').': </b>'; 1587 $att .= '<ul> '; 1588 foreach ($ical['attendee'] as $attendee) 1589 { 1590 if($attendee['params']['CN']) 1591 $att .= '<li>'.$attendee['params']['CN'].' - <a href="MAILTO:'.$attendee['value'].'">'.$attendee['value'].'</a></li>' ; 1592 else 1593 $att .= '<li><a href="MAILTO:'.$attendee['value'].'">'.$attendee['value'].'</a></li>' ; 1594 } 1595 $att .= '</ul> <br />' ; 1596 } 1597 $content.= $att; 1598 1599 break; 1600 default: 1601 break; 1602 } 1603 1604 } 1605 return $content; 1606 } 1607 1303 1608 function htmlfilter($body) 1304 1609 { … … 1454 1759 $image['cid'] = eregi_replace("<", "", $image['cid']); 1455 1760 $image['cid'] = eregi_replace(">", "", $image['cid']); 1761 //if is Draft Ticket #1256 1762 $image['cid'] = str_replace("@localhost", "@prognus.org", $image['cid']); 1456 1763 $body = eregi_replace("<br/>", "", $body); 1457 $body = str_replace("src=\"cid:".$image['cid']."\"", " src=\"./inc/show_embedded_attach.php?msg_folder=$msg_folder&msg_num=$msgno&msg_part=".$image['pid']."\" ", $body); 1458 $body = str_replace("src='cid:".$image['cid']."'", " src=\"./inc/show_embedded_attach.php?msg_folder=$msg_folder&msg_num=$msgno&msg_part=".$image['pid']."\" ", $body); 1459 $body = str_replace("src=cid:".$image['cid'], " src=\"./inc/show_embedded_attach.php?msg_folder=$msg_folder&msg_num=$msgno&msg_part=".$image['pid']."\" ", $body); 1764 1765 $body = str_replace("src=\"cid:".$image['cid']."\"", " src=\"./inc/get_archive.php?msgFolder=$msg_folder&msgNumber=$msgno&indexPart=".$image['pid']."\" ", $body); 1766 $body = str_replace("src='cid:".$image['cid']."'", " src=\"./inc/get_archive.php?msgFolder=$msg_folder&msgNumber=$msgno&indexPart=".$image['pid']."\"", $body); 1767 $body = str_replace("src=cid:".$image['cid'], " src=\"./inc/get_archive.php?msgFolder=$msg_folder&msgNumber=$msgno&indexPart=".$image['pid']."\"", $body); 1460 1768 } 1461 1769 return $body; … … 1474 1782 $body = @mb_eregi_replace("POSITION: ABSOLUTE;","",$body); 1475 1783 1784 //Remove Comentario Expresso 1785 $findExpCom[] = '<!-- TAG <'; 1786 $findExpCom[] = '> Removed by ExpressoMail -->'; 1787 $body = str_replace($findExpCom, '', $body); 1788 ///--------------------------------// 1789 1476 1790 // tags to be removed doe to security reasons 1477 1791 $tag_list = Array( 1478 ' head','blink','object','frame','iframe',1792 'blink','object','frame','iframe', 1479 1793 'layer','ilayer','plaintext','script', 1480 1794 'applet','embed','frameset','xml','xmp' … … 1482 1796 1483 1797 foreach($tag_list as $index => $tag) { 1484 $body = @mb_eregi_replace("<$tag\\b[^>]*>(.*?)</$tag>", "<!-- TAG <$tag> Removed by ExpressoMail -->", $body); 1485 } 1798 $body = @mb_eregi_replace("<$tag\\b[^>]*>(.*?)</$tag>", '', $body); 1799 } 1800 1801 $body = @mb_eregi_replace("<meta[^>]*>", '', $body); 1802 $body = @mb_eregi_replace("<base[^>]*>", '', $body); 1486 1803 1487 1804 //try to wrap CSS code instead of remove STYLE tags … … 1492 1809 $regs_found = array(); 1493 1810 $tags_found = @mb_eregi("<style\b[^>]*>(.*?)</style>", $body, $regs_found); 1811 $wrapper_class = 'ExpressoCssWrapper'.time(); 1494 1812 1495 1813 foreach ($regs_found as $block_found) { … … 1504 1822 1505 1823 $prefix = ".$wrapper_class "; 1824 if( isset($css->css[41]) && count($css->css[41] > 0)) 1506 1825 foreach ($css->css[41] as $key => $value) { 1507 1826 //explode multiple selectors per block … … 1541 1860 //--------------------------------------------------------------------------------------------// 1542 1861 1543 //$body = $this->replace_links($body);1544 1545 1862 //Remoção de tags <span></span> para correção de erro no firefox 1546 // if($_SESSION['phpgw_session']['phpgw_app_sessions']['phpgwapi']['browser_agent']['content'] != 'IE'){ 1547 // $body = mb_eregi_replace("<span><span>","",$body); 1548 // $body = mb_eregi_replace("</span></span>","",$body); 1549 // } 1550 1551 $body = mb_ereg_replace("(<p[^>]*)(text-indent:[^>;]*-[^>;]*;)([^>]*>)","\\1\\3",$body); 1552 $body = mb_ereg_replace("(<p[^>]*)(margin-right:[^>;]*-[^>;]*;)([^>]*>)","\\1\\3",$body); 1553 $body = mb_ereg_replace("(<p[^>]*)(margin-left:[^>;]*-[^>;]*;)([^>]*>)","\\1\\3",$body); 1554 //Correção para compatibilização com Outlook, ao visualizar a mensagem 1863 //Comentado pois estes replaces geram erros no html da msg, não se pode garantir que o os </span></span> sejam realmente os fechamentos dos <span><span>. 1864 //Caso realmente haja a nescessidade de remover estes spans deve ser repensado a forma de como faze-lo. 1865 // $body = mb_eregi_replace("<span><span>","",$body); 1866 // $body = mb_eregi_replace("</span></span>","",$body); 1867 1868 //Correção para compatibilização com Outlook, ao visualizar a mensagem 1555 1869 $body = mb_ereg_replace('<!--\[','<!-- [',$body); 1556 1870 $body = mb_ereg_replace('<!\[endif\]-->', '<![endif]-->', $body); 1557 $body = mb_ereg_replace('<!\[endif\]-->', '<!--[endif]--->', $body);1558 $body = str_replace("\x00", '', $body);1559 1871 1560 1872 return "<div class=\"$wrapper_class\"><span>".$body.'</span></div>'; 1561 } 1562 1563 1564 1873 1874 } 1565 1875 1566 /**1567 * Substitui os links do callback1568 *1569 * @license http://www.gnu.org/copyleft/gpl.html GPL1570 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)1571 * @sponsor Caixa Econômica Federal1572 * @param $matches1573 */1574 1876 function replace_links_callback($matches) 1575 1877 { … … 1595 1897 $replacement = '<a href="://$4$5" target="_blank">$4$5</a>'; 1596 1898 $body = preg_replace_callback($pattern,array( &$this, 'replace_links_callback'), $body); 1597 // E-mail address in the text should create a new e-mail on ExpressoMail1598 $pattern = '/( |<|<|>)([A-Za-z0-9\.~?\/_=#\-]*@[A-Za-z0-9\.~?\/_=#\-]*)( |>|>|<)/im';1599 $replacement = '$1<a href="mailto:$2">$2</a>$3';1600 $body = preg_replace( $pattern, $replacement, $body );1601 1899 1602 1900 } … … 1716 2014 { 1717 2015 1718 $thumbs_array = array(); 1719 $i = 0; 1720 1721 foreach ($images as $x => $image) 1722 { 1723 if($x && $x == 'names') 1724 continue; 1725 1726 $img = "<img id='".$msg_folder.";;".$msg_number.";;".$i.";;".$image['pid'].";;".$image['encoding']."' title='".$this->functions->getLang("Click here do view (+)")."'src=./inc/show_thumbs.php?&msg_num=".$msg_number."&msg_folder=".$msg_folder."&msg_part=".$image['pid']." />"; 1727 $href = "./inc/show_img.php?msg_num=".$msg_number."&msg_folder=".$msg_folder."&msg_part=".$image['pid']; 1728 $anchor = "<a class=\"expressomail-thumbs-link\" onMouseDown='save_image(event,this,\"".$image['type']."\")' href=\"".$href."\" onclick=\"window.open('".$href."','mywindow','width=700,height=600,scrollbars=yes');return false;\">". $img ."</a>"; 1729 $thumbs_array[] = $anchor; 1730 $i++; 2016 if (!count($images)) return ''; 1731 2017 2018 foreach ($images as $key => $value) { 2019 $images[$key]['width'] = 160; 2020 $images[$key]['height'] = 120; 2021 $images[$key]['url'] = "inc/get_archive.php?msgFolder=".$msg_folder."&msgNumber=".$msg_number."&indexPart=".$image['pid']."&image=true"; 1732 2022 } 1733 return $thumbs_array; 2023 2024 return json_encode($images); 1734 2025 } 1735 2026 … … 1755 2046 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 1756 2047 $msgs_number = explode(",",$params['msgs_number']); 2048 if(array_key_exists('border_ID' ,$params)) 1757 2049 $border_ID = $params['border_ID']; 1758 2050 else 2051 $border_ID = ''; 1759 2052 $return = array(); 1760 2053 1761 if ( $params['get_previous_msg']){2054 if (array_key_exists('get_previous_msg' , $params) && $params['get_previous_msg']){ 1762 2055 $return['previous_msg'] = $this->get_info_previous_msg($params); 1763 2056 // Fix problem in unserialize function JS. … … 1786 2079 { 1787 2080 2081 $return = array(); 2082 $return['new_msgs'] = 0; 1788 2083 $folder = $params['folder']; 1789 2084 $msg_range_begin = $params['msg_range_begin']; … … 1799 2094 return array(); 1800 2095 2096 $return['new_msgs'] = imap_num_recent($this->mbox); 1801 2097 $num_msgs = (count($msgs_in_the_server) - imap_num_recent($this->mbox)); 2098 1802 2099 $msgs_in_the_client = explode(",", $msgs_existent); 1803 2100 1804 2101 $msg_to_insert = array_diff($msgs_in_the_server, $msgs_in_the_client); 2102 2103 if(count($msg_to_insert) > 0 && $return['new_msgs'] == 0 && $msgs_in_the_client[0] != ""){ 2104 $aux = 0; 2105 while(array_key_exists($aux, $msg_to_insert)){ 2106 if($msg_to_insert[$aux] > $msgs_in_the_client[0]){ 2107 $return['new_msgs'] += 1; 2108 } 2109 $aux++; 2110 } 2111 }else if(count($msg_to_insert) > 0 && $msgs_in_the_server && $msgs_in_the_client[0] != "" && $return['new_msgs'] == 0){ 2112 $aux = 0; 2113 while(array_key_exists($aux, $msg_to_insert)){ 2114 if($msg_to_insert[$aux] == $msgs_in_the_server[$aux]){ 2115 $return['new_msgs'] += 1; 2116 } 2117 $aux++; 2118 } 2119 }else if($num_msgs < $msg_range_end && $return['new_msgs'] == 0 && count($msg_to_insert) > 0){ 2120 $return['tot_msgs'] = $num_msgs; 2121 } 2122 1805 2123 $msg_to_delete = array_diff($msgs_in_the_client, $msgs_in_the_server); 1806 1807 2124 $msgs_to_exec = array(); 1808 2125 foreach($msg_to_insert as $msg_number) 1809 2126 $msgs_to_exec[] = $msg_number; 1810 2127 //sort($msgs_to_exec); 1811 1812 $return = array();1813 $return['new_msgs'] = imap_num_recent($this->mbox);1814 2128 $i = 0; 1815 2129 foreach($msgs_to_exec as $msg_number) … … 1864 2178 $return[$i]['from']['email'] = $from[0]->mailbox . "@" . $from[0]->host; 1865 2179 //$return[$i]['from']['full'] ='"' . $return[$i]['from']['name'] . '" ' . '<' . $return[$i]['from']['email'] . '>'; 1866 if(!$return[$i]['from']['name'] )2180 if(!$return[$i]['from']['name'] || trim($return[$i]['from']['name']) === '') 1867 2181 $return[$i]['from']['name'] = $return[$i]['from']['email']; 1868 2182 … … 1873 2187 $to = $header->to; 1874 2188 $return[$i]['to'] = array(); 2189 if(isset($to[0]->personal)) 1875 2190 $tmp = imap_mime_header_decode($to[0]->personal); 2191 if(trim($return[$i]['to']['name']) === '') 2192 $return[$i]['to']['name'] = $to[0]->mailbox . "@" . $to[0]->host; 2193 else 1876 2194 $return[$i]['to']['name'] = $tmp[0]->text; 1877 2195 $return[$i]['to']['email'] = $to[0]->mailbox . "@" . $to[0]->host; 1878 2196 $return[$i]['to']['full'] ='"' . $return[$i]['to']['name'] . '" ' . '<' . $return[$i]['to']['email'] . '>'; 2197 if(isset($header->cc)) 1879 2198 $cc = $header->cc; 1880 if ( ($cc) && (!$return[$i]['to']['name']) ){ 2199 2200 if ( isset($cc) && (!$return[$i]['to']['name'] || $return[$i]['to']['name'] == '@') ){ 1881 2201 $return[$i]['to']['name'] = $cc[0]->personal; 1882 2202 $return[$i]['to']['email'] = $cc[0]->mailbox . "@" . $cc[0]->host; 1883 2203 } 1884 $return[$i]['subject'] = $this->decode_string($header->fetchsubject); 1885 2204 $return[$i]['subject'] = ( isset( $header->fetchsubject ) ) ? $this->decode_string($header->fetchsubject) : ''; 2205 if($return[$i]['subject'] == "" || $return[$i]['subject'] == '' || $return[$i]['subject'] == null ){ 2206 $return[$i]['subject'] = $this->functions->getLang("(no subject) "); 2207 } 1886 2208 $return[$i]['Size'] = $header->Size; 1887 2209 $return[$i]['reply_toaddress'] = $header->reply_toaddress; 1888 2210 2211 if($return[$i]['to']['email'] == '@' || $return[$i]['to']['email'] =='undisclosed-recipients@' || $return[$i]['to']['name'] =='undisclosed-recipients@' 2212 || $return[$i]['to']['name'] == null){ 2213 $return[$i]['to']['email'] = $return[$i]['from']['email']; 2214 $return[$i]['to']['name'] = $return[$i]['from']['name']; 2215 $return[$i]['to']['full'] = $return[$i]['reply_toaddress']; 2216 } 2217 1889 2218 $return[$i]['attachment'] = array(); 1890 2219 if (!isset($imap_attachment)) … … 1949 2278 { 1950 2279 $mbox_stream = $this->open_mbox(); 1951 if($params && $params['onload'] && $_SESSION['phpgw_info']['expressomail']['server']['certificado']){2280 if($params && array_key_exists('onload', $params) && $params['onload'] && $_SESSION['phpgw_info']['expressomail']['server']['certificado']){ 1952 2281 $this->delete_mailbox(array("del_past" => "INBOX".$this->imap_delimiter."decifradas")); 1953 2282 } 1954 2283 1955 2284 $inbox = 'INBOX'; 2285 $drafts = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; 2286 $sent = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']; 2287 $spam = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']; 1956 2288 $trash = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']; 1957 $drafts = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; 1958 $spam = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']; 1959 $sent = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']; 2289 if(array_key_exists('uid2cn', $_SESSION['phpgw_info']['user']['preferences']['expressoMail'] )) 1960 2290 $uid2cn = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']; 2291 else 2292 $uid2cn = false; 1961 2293 // Free others requests 1962 2294 session_write_close(); … … 1964 2296 $serverString = "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}"; 1965 2297 1966 if ( $params && $params['noSharedFolders'])2298 if ( $params && isset($params['noSharedFolders']) ) 1967 2299 $folders_list = array_merge(imap_getmailboxes($mbox_stream, $serverString, 'INBOX' ), imap_getmailboxes($mbox_stream, $serverString, 'INBOX/*' ) ); 1968 2300 else … … 1973 2305 $tmp = array(); 1974 2306 $resultMine = array(); 2307 $resultSharedMine = array(); 1975 2308 $resultDefault = array(); 2309 $resultSharedDefault = array(); 2310 $aux = ""; 2311 $qtd = -1 ; 1976 2312 1977 2313 if (is_array($folders_list)) { … … 1994 2330 if( $folderUser != "INBOX" && $folderUser != "" ) 1995 2331 { 1996 $Permission = imap_getacl( $mbox_stream, $folderUser );2332 $Permission = @imap_getacl( $mbox_stream, $folderUser ); 1997 2333 } 1998 1999 if( $Permission )2000 {2001 2334 $tmp_folder_id[1] = mb_convert_encoding( $tmp_folder_id[1], "ISO-8859-1", "UTF7-IMAP" ); 2002 2335 … … 2005 2338 continue; 2006 2339 } 2340 2341 if(isset($status->unseen)) 2007 2342 $result[$i]['folder_unseen'] = $status->unseen; 2343 2008 2344 $folder_id = $tmp_folder_id[1]; 2009 2345 $result[$i]['folder_id'] = $folder_id; … … 2027 2363 else 2028 2364 $result[$i]['folder_hasChildren'] = 0; 2029 2365 $user = explode($this->imap_delimiter , $tmp_folder_id[1]); 2030 2366 switch ($tmp_folder_id[1]) { 2031 2367 case $inbox: 2368 case $drafts: 2032 2369 case $sent: 2033 case $drafts:2034 2370 case $spam: 2035 2371 case $trash: 2036 2372 $resultDefault[]=$result[$i]; 2037 2373 break; 2374 case "user". $this->imap_delimiter . $user[1]: 2375 case "user". $this->imap_delimiter . $user[1] . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']: 2376 case "user". $this->imap_delimiter . $user[1] . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']: 2377 case "user". $this->imap_delimiter . $user[1] . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']: 2378 case "user". $this->imap_delimiter . $user[1] . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']: 2379 if($aux != $user[1]){ 2380 $aux = $user[1]; 2381 $qtd += 1; 2382 } 2383 if( isset($resultSharedDefault[$qtd]) && !is_array($resultSharedDefault[$qtd])) 2384 $resultSharedDefault[$qtd] = array(); 2385 $resultSharedDefault[$qtd][]=$result[$i]; 2386 break; 2038 2387 default: 2388 if($user[0] == $inbox) 2039 2389 $resultMine[]=$result[$i]; 2390 else{ 2391 if($aux != $user[1]){ 2392 $aux = $user[1]; 2393 $qtd += 1; 2394 } 2395 if(!is_array($resultSharedDefault[$qtd])) 2396 $resultSharedMine[$qtd] = array(); 2397 $resultSharedMine[$qtd][]=$result[$i]; 2040 2398 } 2041 2399 … … 2045 2403 } 2046 2404 2047 if ( $params && ! $params['noQuotaInfo']) {2405 if ( $params && !array_key_exists('noQuotaInfo',$params) ) { 2048 2406 //Get quota info of current folder 2049 2407 $current_folder = "INBOX"; 2050 if($params && $params['folder'])2408 if($params && isset($params['folder'])) 2051 2409 $current_folder = $params['folder']; 2052 2410 … … 2078 2436 $resultDefault2[0] = $resultDefault[$key]; 2079 2437 break; 2080 case $ sent:2438 case $drafts: 2081 2439 $resultDefault2[1] = $resultDefault[$key]; 2082 2440 break; 2083 case $ drafts:2441 case $sent: 2084 2442 $resultDefault2[2] = $resultDefault[$key]; 2085 2443 break; … … 2093 2451 } 2094 2452 2095 if ( $params && $params['folderType'] && $params['folderType'] == 'default' ) 2453 $shareds = array(); 2454 if(!empty($resultSharedDefault)) 2455 for($i = 0; $i <= $qtd; $i++){ 2456 foreach ($resultSharedDefault[$i] as $key => $folder_id) 2457 { 2458 $user = explode($this->imap_delimiter , $resultSharedDefault[$i][$key]['folder_id']); 2459 2460 switch ($resultSharedDefault[$i][$key]['folder_id']) { 2461 case "user". $this->imap_delimiter . $user[1]: 2462 $resultSharedDefault2[0] = $resultSharedDefault[$i][$key]; 2463 break; 2464 case "user". $this->imap_delimiter . $user[1]. $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']: 2465 $resultSharedDefault2[1] = $resultSharedDefault[$i][$key]; 2466 break; 2467 case "user". $this->imap_delimiter . $user[1]. $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']: 2468 $resultSharedDefault2[2] = $resultSharedDefault[$i][$key]; 2469 break; 2470 case "user". $this->imap_delimiter . $user[1]. $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']: 2471 $resultSharedDefault2[3] = $resultSharedDefault[$i][$key]; 2472 break; 2473 case "user". $this->imap_delimiter . $user[1] . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']: 2474 $resultSharedDefault2[4] = $resultSharedDefault[$i][$key]; 2475 break; 2476 } 2477 } 2478 if($resultDefault2 != null) 2479 $shareds = array_merge($shareds, $resultSharedDefault2); 2480 if(isset($resultSharedMine[$i]) && $resultSharedMine[$i] != null) 2481 $shareds = array_merge($shareds, $resultSharedMine[$i]); 2482 $resultSharedDefault2 = array(); 2483 } 2484 if ( $params && isset($params['folderType']) && $params['folderType'] == 'default' ) 2096 2485 return array_merge($resultDefault2, $arr_quota_info); 2097 2486 2098 if ( $params && $params['folderType']&& $params['folderType'] == 'personal' )2487 if ( $params && array_key_exists('folderType', $params) && $params['folderType'] == 'personal' ) 2099 2488 return array_merge($result2, $arr_quota_info); 2100 2489 2101 2490 // Merge default folders and personal 2102 2491 $result2 = array_merge($resultDefault2, $result2); 2103 2492 if(!empty($shareds)) 2493 $result2 = array_merge($result2, $shareds); 2104 2494 return array_merge($result2, $arr_quota_info); 2105 2495 } … … 2214 2604 function send_mail($params) 2215 2605 { 2216 include_once("class.phpmailer.php"); 2217 $mail = new PHPMailer(); 2606 require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php'; 2607 $mailService = ServiceLocator::getService('mail'); 2608 2218 2609 include_once("class.db_functions.inc.php"); 2219 2610 $db = new db_functions(); 2220 2611 $fromaddress = $params['input_from'] ? explode(';',$params['input_from']) : ""; 2612 $message_attachments_contents = (isset($params['message_attachments_content'])) ? $params['message_attachments_content'] : false; 2613 2221 2614 ## 2222 2615 # @AUTHOR Rodrigo Souza dos Santos … … 2238 2631 $ccaddress = implode(',',$db->getAddrs(explode(',',$params['input_cc']))); 2239 2632 $ccoaddress = implode(',',$db->getAddrs(explode(',',$params['input_cco']))); 2633 2634 $toaddress = preg_replace('/<\s+/', '<', $toaddress); 2635 $toaddress = preg_replace('/\s+>/', '>', $toaddress); 2636 2637 $ccaddress = preg_replace('/<\s+/', '<', $ccaddress); 2638 $ccaddress = preg_replace('/\s+>/', '>', $ccaddress); 2639 2640 $ccoaddress = preg_replace('/<\s+/', '<', $ccoaddress); 2641 $ccoaddress = preg_replace('/\s+>/', '>', $ccoaddress); 2642 2240 2643 $replytoaddress = $params['input_replyto']; 2241 2644 $subject = $params['input_subject']; … … 2246 2649 $signed = $params['input_return_digital']; 2247 2650 2248 if($params['smime']) 2651 $message_attachments = $params['message_attachments']; 2652 2653 if(substr($params['input_to'],-1) == ',') 2654 $params['input_to'] = substr($params['input_to'],0,-1); 2655 2656 if(substr($params['input_cc'],-1) == ',') 2657 $params['input_cc'] = substr($params['input_cc'],0,-1); 2658 2659 if(substr($params['input_cco'],-1) == ',') 2660 $params['input_cco'] = substr($params['input_cco'],0,-1); 2661 2662 2663 // Valida numero Maximo de Destinatarios 2664 if($_SESSION['phpgw_info']['expresso']['expressoMail']['expressoAdmin_maximum_recipients'] > 0) 2665 { 2666 $sendersNumber = count(explode(',',$params['input_to'])); 2667 2668 if($params['input_cc']) 2669 $sendersNumber += count(explode(',',$params['input_cc'])); 2670 if($params['input_cco']) 2671 $sendersNumber += count(explode(',',$params['input_cco'])); 2672 2673 $userMaxmimumSenders = $db->getMaximumRecipientsUser($this->username); 2674 if($userMaxmimumSenders) 2675 { 2676 if($sendersNumber > $userMaxmimumSenders) 2677 return $this->functions->getLang('Number of recipients greater than allowed'); 2678 } 2679 else 2680 { 2681 $ldap = new ldap_functions(); 2682 $groupsToUser = $ldap->get_user_groups($this->username); 2683 2684 $groupMaxmimumSenders = $db->getMaximumRecipientsGroup($groupsToUser); 2685 2686 if($groupMaxmimumSenders > 0) 2687 { 2688 if($sendersNumber > $groupMaxmimumSenders) 2689 return $this->functions->getLang('Number of recipients greater than allowed'); 2690 } 2691 else 2692 { 2693 if($sendersNumber > $_SESSION['phpgw_info']['expresso']['expressoMail']['expressoAdmin_maximum_recipients']) 2694 return $this->functions->getLang('Number of recipients greater than allowed'); 2695 } 2696 } 2697 2698 } 2699 //Fim Valida numero maximo de destinatarios 2700 2701 2702 //Valida envio de email para shared accounts 2703 if($_SESSION['phpgw_info']['expresso']['expressoMail']['expressoMail_block_institutional_comunication'] == 'true') 2704 { 2705 $ldap = new ldap_functions(); 2706 $arrayF = explode(';', $params['input_from']); 2707 2708 /* 2709 * Verifica se o remetente n?o ? uma conta compartilhada 2710 */ 2711 if(!$ldap->isSharedAccountByMail($arrayF[1])) 2712 { 2713 $groupsToUser = $ldap->get_user_groups($this->username); 2714 $sharedAccounts = $ldap->returnSharedsAccounts($toaddress, $ccaddress, $ccoaddress); 2715 2716 /* 2717 * Pega o UID do remetente 2718 */ 2719 $uidFrom = $ldap->mail2uid($arrayF[1]); 2720 2721 /* 2722 * Remove a conta compartilhada caso o uid do remetente exista na conta compartilhada 2723 */ 2724 foreach ($sharedAccounts as $key => $value) 2725 { 2726 if($value) 2727 $acl = $this->getaclfrombox($value); 2728 2729 if (array_key_exists($uidFrom, $acl)) 2730 unset($sharedAccounts[$key]); 2731 2732 } 2733 2734 /* 2735 * Caso ainda exista contas compartilhadas, verifica se existe alguma exce??o para estas contas 2736 */ 2737 if(count($sharedAccounts) > 0) 2738 $accountsBlockeds = $db->validadeSharedAccounts($this->username, $groupsToUser, $sharedAccounts); 2739 2740 /* 2741 * Retorna as contas compartilhadas bloqueadas 2742 */ 2743 if(count($accountsBlockeds) > 0) 2744 { 2745 $return = ''; 2746 2747 foreach ($accountsBlockeds as $accountBlocked) 2748 $return.= $accountBlocked.', '; 2749 2750 $return = substr($return,0,-2); 2751 2752 return $this->functions->getLang('you are blocked from sending mail to the following addresses').': '.$return; 2753 } 2754 } 2755 } 2756 // Fim Valida envio de email para shared accounts 2757 2758 2759 // TODO - implementar tratamento SMIME no novo serviço de envio de emails e retirar o AND false abaixo 2760 if($params['smime'] AND false) 2249 2761 { 2250 2762 $body = $params['smime']; … … 2285 2797 else 2286 2798 { 2287 $body = $params['body'];2288 2799 //Compatibilização com Outlook, ao encaminhar a mensagem 2289 $body = mb_ereg_replace('<!--\[','<!-- [',$body);2800 $body = mb_ereg_replace('<!--\[', '<!-- [', $params['body']); 2290 2801 } 2291 //echo "<script language=\"javascript\">javascript:alert('".$body."');</script>"; 2802 2292 2803 $attachments = $_FILES; 2293 2804 $forwarding_attachments = $params['forwarding_attachments']; … … 2298 2809 //build shared folder path 2299 2810 $newfolder = "user".$this->imap_delimiter.$fromaddress[3].$this->imap_delimiter.$this->imap_sentfolder; 2300 if( $this->folder_exists($newfolder) ) $folder = $newfolder; 2301 else $folder = $params['folder']; 2811 if($this->folder_exists($newfolder)) 2812 $folder = $newfolder; 2813 else 2814 $folder = $params['folder']; 2815 2302 2816 } else { 2303 2817 $folder = $params['folder']; 2304 2818 } 2305 2819 2306 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"); 2820 $folder = mb_convert_encoding($folder, 'UTF7-IMAP','ISO_8859-1'); 2821 $folder = preg_replace('/INBOX[\/.]/i', 'INBOX'.$this->imap_delimiter, $folder); 2307 2822 $folder_name = $params['folder_name']; 2308 // Fix problem with cyrus delimiter changes. 2309 // Dots in names: enabled/disabled. 2310 $folder = @eregi_replace("INBOX/", "INBOX".$this->imap_delimiter, $folder); 2311 $folder = @eregi_replace("INBOX.", "INBOX".$this->imap_delimiter, $folder); 2312 // End Fix. 2313 if ($folder != 'null'){ 2314 $mail->SaveMessageInFolder = $folder; 2315 } 2316 //////////////////////////////////////////////////////////////////////////////////////////////////// 2317 $mail->SMTPDebug = false; 2318 2319 if($signed && !$params['smime']) 2823 2824 // TODO - tratar assinatura e remover o AND false 2825 if($signed && !$params['smime'] AND false) 2320 2826 { 2321 2827 $mail->Mailer = "smime"; 2322 2828 $mail->SignedBody = true; 2323 2829 } 2324 else 2325 $mail->IsSMTP(); 2326 2327 $mail->Host = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpServer'];2328 $mail->Port = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpPort']; 2329 $mail->From = $_SESSION['phpgw_info']['expressomail']['user']['email'];2330 $mail->FromName = $_SESSION['phpgw_info']['expressomail']['user']['fullname'];2331 if($fromaddress){2332 $mail->Sender = $mail->From;2333 $mail->SenderName = $mail->FromName;2334 $mail->FromName = $fromaddress[0];2335 $mail->From = $fromaddress[1];2336 }2337 2338 $this->add_recipients("to", $toaddress, &$mail);2339 $this->add_recipients("cc", $ccaddress, &$mail);2830 2831 2832 if($fromaddress) 2833 $mailService->setFrom ('"'.$fromaddress[0].'" <'.$fromaddress[1].'>'); 2834 else 2835 $mailService->setFrom ('"'.$_SESSION['phpgw_info']['expressomail']['user']['firstname'].' '.$_SESSION['phpgw_info']['expressomail']['user']['lastname'].'" <'.$_SESSION['phpgw_info']['expressomail']['user']['email'].'>'); 2836 //$mailService->addTo($toaddress); 2837 //$mailService->addCc($ccaddress); 2838 $bol = $this->add_recipients('to', $toaddress, $mailService); 2839 if(!$bol){ 2840 return $this->parse_error("Invalid Mail:", $toaddress); 2841 } 2842 $bol = $this->add_recipients('cc', $ccaddress, $mailService); 2843 if(!$bol){ 2844 return $this->parse_error("Invalid Mail:", $ccaddress); 2845 } 2340 2846 $allow = $_SESSION['phpgw_info']['server']['expressomail']['allow_hidden_copy']; 2341 2847 2342 if( $allow)2848 if($allow) 2343 2849 { 2344 $this->add_recipients("cco", $ccoaddress, &$mail); 2850 //$mailService->addBcc($ccoaddress); 2851 $bol = $this->add_recipients('cco', $ccoaddress, $mailService); 2852 2853 if(!$bol){ 2854 return $this->parse_error("Invalid Mail:", $ccoaddress); 2855 } 2345 2856 } 2346 $mail->AddReplyTo($replytoaddress); 2347 $mail->Subject = $subject; 2348 $mail->IsHTML( ( array_key_exists( 'type', $params ) && in_array( strtolower( $params[ 'type' ] ), array( 'html', 'plain' ) ) ) ? strtolower( $params[ 'type' ] ) != 'plain' : true ); 2349 $mail->Body = $body; 2350 2351 if (($encrypt && $signed && $params['smime']) || ($encrypt && !$signed)) // a msg deve ser enviada cifrada... 2857 2858 $mailService->setSubject($subject); 2859 $isHTML = ( (array_key_exists('type', $params) && in_array(strtolower($params['type']), array('html', 'plain')) ) ? 2860 strtolower($params['type']) != 'plain' : true ); 2861 2862 2863 // TODO - tratar mensagem criptografada e remover o AND false abaixo 2864 if (($encrypt && $signed && $params['smime']) || ($encrypt && !$signed) AND false) // a msg deve ser enviada cifrada... 2352 2865 { 2353 2866 $email = $this->add_recipients_cert($toaddress . ',' . $ccaddress. ',' .$ccoaddress); … … 2440 2953 $mail->Certs_crypt = $aux_mails; 2441 2954 } 2442 // Build CID images 2443 $this->buildEmbeddedImages($mail,$msg_uid,$forwarding_attachments); 2955 2956 if( count($forwarding_attachments) > 0 )// Build CID images 2957 $this->buildEmbeddedImages($mailService,$msg_uid,$forwarding_attachments, $body); 2444 2958 2445 2959 // Build Uploading Attachments!!! … … 2447 2961 { 2448 2962 $total_uploaded_size = 0; 2449 $upload_max_filesize = str_replace("M","",$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) * 1024 * 1024;2450 2963 foreach ($attachments as $attach) 2451 2964 { … … 2454 2967 if($attach['name']=='Unknown') 2455 2968 continue; 2456 $mail ->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $this->get_file_type($attach['name'])); // optional name2969 $mailService->addFileAttachment($attach['tmp_name'], $attach['name'], $this->get_file_type($attach['name']), 'base64', 'attachment'); 2457 2970 $total_uploaded_size = $total_uploaded_size + $attach['size']; 2458 2971 } 2459 if( $total_uploaded_size > $upload_max_filesize){ 2972 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) 2973 { 2974 2975 $upload_max_filesize = str_replace('M','',$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) * 1024 * 1024; 2976 if( $total_uploaded_size > $upload_max_filesize) 2460 2977 return $this->parse_error("message file too big"); 2461 2978 } … … 2464 2981 2465 2982 $total_uploaded_size = 0; 2466 $upload_max_filesize = str_replace("M","",ini_get('upload_max_filesize')) * 1024 * 1024;2983 2467 2984 foreach($local_attachments as $local_attachment) { 2468 2985 $file_description = unserialize(rawurldecode($local_attachment)); … … 2471 2988 $tmp[$i] = eregi_replace('\'*\'','',$descriptor); 2472 2989 } 2473 $mail ->AddAttachment($_FILES[$tmp[1]]['tmp_name'], $tmp[2], "base64", $this->get_file_type($tmp[2])); // optional name2990 $mailService->addFileAttachment($_FILES[$tmp[1]]['tmp_name'], $tmp[2], $this->get_file_type($tmp[2]), 'base64', 'attachment'); 2474 2991 $total_uploaded_size = $total_uploaded_size + $_FILES[$tmp[1]]['size']; 2475 2992 } 2476 if( $total_uploaded_size > $upload_max_filesize) 2477 return 'false'; 2478 } 2479 //////////////////////////////////////////////////////////////////////////////////////////////////// 2993 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) 2994 { 2995 $upload_max_filesize = str_replace('M','',$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) * 1024 * 1024; 2996 if( $total_uploaded_size > $upload_max_filesize) 2997 return $this->parse_error("message file too big"); 2998 } 2999 } 3000 2480 3001 // Build Forwarding Attachments!!! 2481 3002 if (count($forwarding_attachments) > 0) … … 2490 3011 foreach($forwarding_attachments as $forwarding_attachment) 2491 3012 { 2492 $file_description = unserialize(rawurldecode($forwarding_attachment)); 2493 $tmp = array_values($file_description); 2494 foreach($file_description as $i => $descriptor){ 2495 $tmp[$i] = eregi_replace('\'*\'','',$descriptor); 3013 $file_description = unserialize(rawurldecode($forwarding_attachment)); 3014 $tmp = array_values($file_description); 3015 foreach($file_description as $i => $descriptor){ 3016 $tmp[$i] = eregi_replace('\'*\'','',$descriptor); 3017 } 3018 $file_description = $tmp; 3019 $fileContent = $this->get_forwarding_attachment($file_description[0], $file_description[1], $file_description[3],$file_description[4]); 3020 $fileName = $file_description[2]; 3021 if(!array_search(trim($fileName),$name_cid_files)) { 3022 $filename_dec = html_entity_decode(rawurldecode($fileName)); 3023 $mailService->addStringAttachment($fileContent, $filename_dec, $this->get_file_type($file_description[2]), $file_description[4] ); 3024 3025 } 3026 } 3027 } 3028 3029 //Build Message Attachments!!! 3030 if(count($message_attachments) > 0 ) 3031 { 3032 foreach($message_attachments as $folder_name => $messages) 3033 { 3034 foreach ($messages as $message_number => $message_subject) 3035 { 3036 if (!$message_subject) 3037 $message_subject = 'no title.eml'; 3038 else 3039 $message_subject .= '.eml'; 3040 3041 if( $message_attachments_contents && isset($message_attachments_contents[$folder_name]) ) 3042 $rawmsg = base64_decode( $message_attachments_contents[$folder_name][$message_number] ); 3043 else{ 3044 $mbox_stream = $this->open_mbox($folder_name); 3045 $rawmsg = $this->getRawHeader($message_number) . "\r\n\r\n" . $this->getRawBody($message_number); 2496 3046 } 2497 $file_description = $tmp; 2498 $fileContent = $this->get_forwarding_attachment($file_description[0], $file_description[1], $file_description[3],$file_description[4]); 2499 $fileName = $file_description[2]; 2500 if(!array_search(trim($fileName),$name_cid_files)) { 2501 $mail->AddStringAttachment($fileContent,html_entity_decode(rawurldecode($fileName)), $file_description[4], $this->get_file_type($file_description[2])); 2502 } 2503 } 2504 } 2505 2506 //////////////////////////////////////////////////////////////////////////////////////////////////// 2507 // Important message 3047 3048 $return_forward[] = array( 'name' => $message_subject, 'size' => mb_strlen($rawmsg)); 3049 $mailService->addStringAttachment($rawmsg, $message_subject, 'message/rfc822', '7bit', 'attachment' ); 3050 } 3051 } 3052 } 3053 3054 $message_size_total += strlen($params['body']); /* Tamanho do corpo da mensagem. */ 3055 $message_size_total += $total_uploaded_size; /* Incrementa com os anexos da nova mensagem, se houver. */ 3056 3057 //////////////////////////////////////////////////////////////////////////////////////////////////// 3058 /** 3059 * Faz a validação pelo tamanho máximo de mensagem permitido para o usuário. Se o usuário não estiver em nenhuma regra, usa o tamanho padrão. 3060 */ 3061 $default_max_size_rule = $db->get_default_max_size_rule(); 3062 if(!$default_max_size_rule) 3063 { 3064 $default_max_size_rule = str_replace("M","",ini_get('upload_max_filesize')) * 1024 * 1024; /* hack para não bloquear o envio de email quando não for configurado um tamanho padrão */ 3065 } 3066 else 3067 { 3068 foreach($default_max_size_rule as $i=>$value) 3069 { 3070 $default_max_size_rule = $value['config_value']; 3071 } 3072 } 3073 3074 $default_max_size_rule = $default_max_size_rule * 1024 * 1024; /* Tamanho da regra padrão, em bytes */ 3075 $id_user = $_SESSION['phpgw_info']['expressomail']['user']['userid']; 3076 3077 3078 $ldap = new ldap_functions(); 3079 $groups_user = $ldap->get_user_groups($id_user); 3080 3081 $size_rule_by_group = array(); 3082 foreach($groups_user as $k=>$value_) 3083 { 3084 $rule_in_group = $db->get_rule_by_user_in_groups($k); 3085 if ($rule_in_group != "") 3086 array_push($size_rule_by_group, $rule_in_group); 3087 } 3088 3089 $n_rule_groups = 0; 3090 $maior_valor_regra_grupo = 0; 3091 foreach($size_rule_by_group as $i=>$value) 3092 { 3093 if(is_array($value[0])) 3094 { 3095 $n_rule_groups++; 3096 if($value[0]['email_max_recipient'] > $maior_valor_regra_grupo) 3097 $maior_valor_regra_grupo = $value[0]['email_max_recipient']; 3098 } 3099 } 3100 3101 if($default_max_size_rule) 3102 { 3103 $size_rule = $db->get_rule_by_user($_SESSION['phpgw_info']['expressomail']['user']['userid']); 3104 3105 if(!$size_rule && $n_rule_groups == 0) /* O usuário não está em nenhuma regra por usuário nem por grupo. Vai usar a regra padrão. */ 3106 { 3107 if($message_size_total > $default_max_size_rule) 3108 return $this->functions->getLang("Message size greateruler than allowed (Default rule)"); 3109 } 3110 3111 else 3112 { 3113 if(count($size_rule) > 0) /* Verifica se existe regra por usuário. Se houver, ela vai se sobresair das regras por grupo. */ 3114 { 3115 $regra_mais_permissiva = 0; 3116 foreach($size_rule as $i=>$value) 3117 { 3118 if($regra_mais_permissiva < $value['email_max_recipient']) 3119 $regra_mais_permissiva = $value['email_max_recipient']; 3120 } 3121 $regra_mais_permissiva = $regra_mais_permissiva * 1024 * 1024; 3122 if($message_size_total > $regra_mais_permissiva) 3123 return $this->functions->getLang("Message size greater than allowed (Rule By User)"); 3124 } 3125 else /* Regra por grupo */ 3126 { 3127 $maior_valor_regra_grupo = $maior_valor_regra_grupo * 1024 * 1024; 3128 if($message_size_total > $maior_valor_regra_grupo) 3129 return $this->functions->getLang("Message size greater than allowed (Rule By Group)"); 3130 3131 3132 } 3133 } 3134 } 3135 /** 3136 * Fim da validação do tamanho da regra do tamanho de mensagem. 3137 */ 3138 //////////////////////////////////////////////////////////////////////////////////////////////////// 3139 3140 3141 3142 3143 3144 if($isHTML) 3145 $mailService->setBodyHtml($body); 3146 else 3147 $mailService->setBodyText($body); 3148 2508 3149 if($is_important) 2509 $mail->isImportant(); 2510 2511 //////////////////////////////////////////////////////////////////////////////////////////////////// 2512 // Disposition-Notification-To 2513 if ($return_receipt) 2514 $mail->ConfirmReadingTo = $_SESSION['phpgw_info']['expressomail']['user']['email']; 2515 //////////////////////////////////////////////////////////////////////////////////////////////////// 2516 2517 $sent = $mail->Send(); 2518 2519 if(!$sent) 2520 { 2521 return $this->parse_error($mail->ErrorInfo); 3150 $mailService->addHeaderField('Importance','High'); 3151 3152 if($return_receipt) 3153 $mailService->addHeaderField('Disposition-Notification-To', $_SESSION['phpgw_info']['expressomail']['user']['email']); 3154 3155 3156 if ($folder != 'null'){ 3157 $mbox_stream = $this->open_mbox($folder); 3158 @imap_append($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, $mailService->getMessage(), "\\Seen"); 3159 } 3160 3161 $sent = $mailService->send(); 3162 3163 if($sent !== true) 3164 { 3165 return $this->parse_error($sent); 2522 3166 } 2523 3167 else … … 2536 3180 error_log("$now - $userip - $sent [$subject] - $userid => $addrs\r\n", 3, "/home/expressolivre/mail_senders.log"); 2537 3181 } 2538 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['number_of_contacts'] && 2539 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) { 3182 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_dynamic_contacts']) { 2540 3183 $contacts = new dynamic_contacts(); 2541 3184 $new_contacts = $contacts->add_dynamic_contacts($toaddress.",".$ccaddress.",".$ccoaddress); … … 2554 3197 * @param $forwarding_attachments anexos 2555 3198 */ 2556 function buildEmbeddedImages(&$mail,$msg_uid,&$forwarding_attachments) 3199 3200 function buildEmbeddedImages(&$mail,$msg_uid,&$forwarding_attachments ,&$body) 2557 3201 { 2558 // Build CID for embedded Images!!!2559 $pattern = '/src= "([^"]*?show_embedded_attach.php\?msg_folder=(.+)?&(amp;)?msg_num=(.+)?&(amp;)?msg_part=(.+)?)"/isU';3202 //Procura e retorna em $cids_imgs imagens embarcadas no corpo do e-mail 3203 $pattern = '/src=("[^"]*?get_archive.php\?msgFolder=(.+)?&(amp;)?msgNumber=(.+)?&(amp;)?indexPart=(.+)?")/isU'; 2560 3204 $cid_imgs = ''; 2561 preg_match_all($pattern,$mail->Body,$cid_imgs,PREG_PATTERN_ORDER); 2562 $cid_array = array(); 2563 2564 foreach($cid_imgs[6] as $j => $val){ 2565 if ( !array_key_exists($cid_imgs[4][$j].$val, $cid_array) ) 2566 { 2567 $cid_array[$cid_imgs[4][$j].$val] = base_convert(microtime(), 10, 36); 2568 } 2569 $cid = $cid_array[$cid_imgs[4][$j].$val]; 2570 2571 $mail->Body = str_replace($cid_imgs[1][$j], "cid:".$cid, $mail->Body); 2572 3205 preg_match_all( $pattern , $body , $cid_imgs , PREG_PATTERN_ORDER ); 3206 //-------------------------------------------------------------------// 3207 3208 $attPostions = array(); //Array que linka a possição da imagem com o indice que esta se encontra no array $forwarding_attachments 3209 3210 foreach ($forwarding_attachments as $i => $v){ // Monta o array de link 3211 $desc = unserialize(rawurldecode($v)); 3212 $attPostions[$desc[3]] = $i; 3213 } 3214 3215 //Intera as imagens encontradas 3216 foreach($cid_imgs[6] as $j => $val) 3217 { 3218 $cid = base_convert(microtime().$j, 10, 36); //Gera um cid 3219 $body = str_replace($cid_imgs[1][$j], '"cid:'.$cid.'@'.$_SESSION['phpgw_info']['expressomail']['server']['domain_name'].'"', $body ); //tira o src da imagem e coloca o cid, ele e concatenado com o domain do servidor por que a biblioteaca mime faz isso na hora de gerar o mime. 2573 3220 $count = strlen($cid_imgs[6][$j]); 2574 $position = substr($cid_imgs[6][$j], 2, $count);2575 $position--;2576 3221 2577 $attach_img = $forwarding_attachments[$ position];3222 $attach_img = $forwarding_attachments[$attPostions['\''.$cid_imgs[6][$j].'\'']]; 2578 3223 $file_description = unserialize(rawurldecode($attach_img)); 2579 3224 2580 3225 if (is_array($file_description)) 2581 3226 foreach($file_description as $i => $descriptor) 2582 $file_description[$i] = eregi_replace('\'*\'','',$descriptor);3227 $file_description[$i] = mb_ereg_replace('\'*\'','',$descriptor); 2583 3228 2584 3229 // The image is not in the same mail? 2585 3230 if ($msg_uid != $cid_imgs[4][$j]) 2586 3231 { 2587 $fileContent = $this->get_forwarding_attachment($cid_imgs[2][$j], $cid_imgs[4][$j], $cid_imgs[6][$j], 'base64'); 2588 $fileName = ($msg_uid != 'undefined') ? "image_".($j).".jpg" : $file_description[2]; 2589 $fileCode = "base64"; 2590 $fileType = "image/jpg"; 3232 $fa = $this->get_forwarding_attachment2($cid_imgs[2][$j], $cid_imgs[4][$j], $cid_imgs[6][$j], 'base64'); 3233 $fileContent = &$fa['binary']; 3234 $fileName = $fa['name']; 3235 $fileCode = $fa['encoding']; 3236 $fileType = $fa['type']; 2591 3237 $file_attached[0] = $cid_imgs[2][$j]; 2592 3238 $file_attached[1] = $cid_imgs[4][$j]; 2593 3239 $file_attached[2] = $fileName; 2594 $file_attached[3] = '0.'.( $j+1);3240 $file_attached[3] = '0.'.(string)($j+1); 2595 3241 $file_attached[4] = 'base64'; 2596 3242 $file_attached[5] = strlen($fileContent); //Size of file … … 2599 3245 2600 3246 if ($file_attached[3] == $file_description[3] || $msg_uid == 'undefined') 2601 unset($forwarding_attachments[$ position]);3247 unset($forwarding_attachments[$attPostions['\''.$cid_imgs[6][$j].'\'']]); 2602 3248 2603 3249 } … … 2607 3253 $fileName = $file_description[2]; 2608 3254 $fileCode = $file_description[4]; 2609 $file_description[3] = '0.'.( $j+1);3255 $file_description[3] = '0.'.(string)($j+1); 2610 3256 $file_description[6] = $cid_imgs[6][$j]; 2611 3257 $fileType = $this->get_file_type($file_description[2]); 2612 unset($forwarding_attachments[$ position]);3258 unset($forwarding_attachments[$attPostions['\''.$cid_imgs[6][$j].'\'']]); 2613 3259 if (!empty($file_description)) 2614 3260 { … … 2617 3263 } 2618 3264 } 2619 $tempDir = '/tmp';2620 $file = "cidimage_".$_SESSION[ 'phpgw_session' ][ 'session_id' ].$cid_imgs[6][$j].".dat";2621 $f = fopen($tempDir.'/'.$file,"w");2622 fputs($f,$fileContent);2623 fclose($f);2624 3265 2625 3266 if ($fileContent) 2626 $mail-> AddEmbeddedImage($tempDir.'/'.$file, $cid, $fileName, $fileCode, $fileType);3267 $mail->addStringImage($fileContent,$fileType,$fileName, $cid); 2627 3268 } 2628 3269 … … 2654 3295 $full_address = preg_replace("/, ?,/",",",$full_address); 2655 3296 $parse_address = imap_rfc822_parse_adrlist($full_address, ""); 3297 $bolean = true; 2656 3298 foreach ($parse_address as $val) 2657 3299 { … … 2665 3307 { 2666 3308 case "to": 2667 $mail->Add Address($val->mailbox."@".$val->host);3309 $mail->AddTo($val->mailbox."@".$val->host); 2668 3310 break; 2669 3311 case "cc": 2670 $mail->AddC C($val->mailbox."@".$val->host);3312 $mail->AddCc($val->mailbox."@".$val->host); 2671 3313 break; 2672 3314 case "cco": 2673 $mail->AddB CC($val->mailbox."@".$val->host);3315 $mail->AddBcc($val->mailbox."@".$val->host); 2674 3316 break; 2675 3317 } … … 2680 3322 { 2681 3323 case "to": 2682 $mail->Add Address($val->mailbox."@".$val->host, $val->personal);3324 $mail->AddTo($val->mailbox."@".$val->host, $val->personal); 2683 3325 break; 2684 3326 case "cc": 2685 $mail->AddC C($val->mailbox."@".$val->host, $val->personal);3327 $mail->AddCc($val->mailbox."@".$val->host, $val->personal); 2686 3328 break; 2687 3329 case "cco": 2688 $mail->AddB CC($val->mailbox."@".$val->host, $val->personal);3330 $mail->AddBcc($val->mailbox."@".$val->host, $val->personal); 2689 3331 break; 2690 3332 } 2691 3333 } 2692 } 2693 return true; 3334 if($val->mailbox == "UNEXPECTED_DATA_AFTER_ADDRESS"){ 3335 $bolean = false; 3336 } 3337 3338 } 3339 return $bolean; 2694 3340 } 2695 3341 2696 3342 function get_forwarding_attachment($msg_folder, $msg_number, $msg_part, $encoding) 3343 { 3344 include_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 3345 $attachment = new attachment(); 3346 $attachment->decodeConf['rfc_822bodies'] = true; //Forçar a não decodificação de mensagens em anexo. 3347 $attachment->setStructureFromMail($msg_folder, $msg_number); 3348 return $attachment->getAttachment($msg_part); 3349 } 3350 3351 function get_forwarding_attachment2($msg_folder, $msg_number, $msg_part, $encoding) 2697 3352 { 2698 3353 include_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 2699 3354 $attachment = new attachment(); 2700 3355 $attachment->setStructureFromMail($msg_folder, $msg_number); 2701 return $attachment->getAttachment($msg_part); 3356 $return = $attachment->getAttachmentInfo($msg_part); 3357 $return['binary'] = $attachment->getAttachment($msg_part); 3358 return $return; 2702 3359 } 2703 3360 … … 2762 3419 else 2763 3420 $from = $header->from; 2764 3421 if(isset($from[0]->personal)) 2765 3422 $tmp = imap_mime_header_decode($from[0]->personal); 2766 2767 if ($tmp[0]->text != "") 3423 else 3424 $tmp = null; 3425 if (isset($tmp[0]->text)) 2768 3426 $sort[$iuid] = $tmp[0]->text; 2769 3427 else … … 2786 3444 $sort = array_reverse($sort,true); 2787 3445 } 2788 2789 if(!is_array($sort)) 3446 if(empty($sort) or !is_array($sort)){ 2790 3447 $sort = array(); 3448 } 3449 3450 2791 3451 2792 3452 … … 2836 3496 $folder = $params['folder']; 2837 3497 $mbox_stream = $this->open_mbox($folder); 2838 $newmailbox = urldecode($params['new_folder']);3498 $newmailbox = ($params['new_folder']); 2839 3499 $newmailbox = mb_convert_encoding($newmailbox, "UTF7-IMAP","ISO_8859-1"); 2840 $new_folder_name = urldecode($params['new_folder_name']);3500 $new_folder_name = $params['new_folder_name']; 2841 3501 $msgs_number = $params['msgs_number']; 2842 3502 $return = array('msgs_number' => $msgs_number, … … 2866 3526 } 2867 3527 //Este bloco tem a finalidade de transformar o CPF das pastas compartilhadas em common name 3528 if(array_key_exists('uid2cn', $_SESSION['phpgw_info']['user']['preferences']['expressoMail'])){ 2868 3529 if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']){ 2869 3530 if (substr($new_folder_name,0,4) == 'user'){ … … 2877 3538 } 2878 3539 } 3540 } 2879 3541 2880 3542 // Caso estejamos no box principal, nao eh necessario pegar a informacao da mensagem anterior. … … 2883 3545 $return['previous_msg'] = $this->get_info_previous_msg($params); 2884 3546 // Fix problem in unserialize function JS. 3547 if(array_key_exists('body', $return['previous_msg'])) 2885 3548 $return['previous_msg']['body'] = str_replace(array('{','}'), array('{','}'), $return['previous_msg']['body']); 2886 3549 } … … 2941 3604 } 2942 3605 3606 2943 3607 function save_msg($params) 2944 3608 { 2945 2946 include_once("class.phpmailer.php"); 2947 $mail = new PHPMailer(); 2948 include_once("class.db_functions.inc.php"); 2949 $toaddress = $params['input_to']; 2950 $ccaddress = $params['input_cc']; 2951 $ccoaddress = $params['input_cco']; 3609 require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php'; 3610 $mailService = ServiceLocator::getService('mail'); 3611 2952 3612 $return_receipt = $params['input_return_receipt']; 2953 3613 $is_important = $params['input_important_message']; 2954 $subject = $params['input_subject'];3614 2955 3615 $msg_uid = $params['msg_id']; 2956 3616 $body = $params['body']; 2957 3617 $body = str_replace("%nbsp;"," ",$body); 2958 3618 $body = preg_replace("/\n/"," ",$body); 2959 $body = preg_replace("/\r/","",$body); 3619 $body = preg_replace("/\r/","" ,$body); 3620 $body = html_entity_decode ( $body, ENT_QUOTES , 'ISO-8859-1' ); 2960 3621 $forwarding_attachments = $params['forwarding_attachments']; 3622 $message_attachments = $params['message_attachments']; 2961 3623 $attachments = $params['FILES']; 2962 3624 $return_files = $params['FILES']; 3625 $message_attachments_contents = (isset($params['message_attachments_content'])) ? $params['message_attachments_content'] : false; 2963 3626 2964 3627 if(is_array($params['local_attachments'])){ 2965 3628 foreach ($params['local_attachments'] as $key => $local_attach) { 2966 3629 $tmp = unserialize(urldecode($local_attach)); 2967 $attachments[$key]['name'] = $tmp[2];2968 $return_files[$key]['name'] = $tmp[2];3630 $attachments[$key]['name'] = urldecode($tmp[2]); 3631 $return_files[$key]['name'] = urldecode($tmp[2]); 2969 3632 } 2970 3633 } 2971 3634 2972 2973 $folder = $params['folder']; 2974 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO_8859-1"); 2975 // Fix problem with cyrus delimiter changes. 2976 // Dots in names: enabled/disabled. 2977 $folder = @eregi_replace("INBOX/", "INBOX".$this->imap_delimiter, $folder); 2978 $folder = @eregi_replace("INBOX.", "INBOX".$this->imap_delimiter, $folder); 2979 // End Fix. 2980 2981 $mail->SaveMessageInFolder = $folder; 2982 $mail->SMTPDebug = false; 2983 2984 $mail->IsSMTP(); 2985 $mail->Host = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpServer']; 2986 $mail->Port = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpPort']; 2987 $mail->From = $_SESSION['phpgw_info']['expressomail']['user']['email']; 2988 $mail->FromName = $_SESSION['phpgw_info']['expressomail']['user']['fullname']; 2989 2990 $mail->Sender = $mail->From; 2991 $mail->SenderName = $mail->FromName; 2992 $mail->FromName = $_SESSION['phpgw_info']['expressomail']['user']['fullname']; 2993 $mail->From = $_SESSION['phpgw_info']['expressomail']['user']['email']; 2994 2995 $this->add_recipients("to", $toaddress, &$mail); 2996 $this->add_recipients("cc", $ccaddress, &$mail); 2997 $this->add_recipients("cco", $ccoaddress, &$mail); 2998 $mail->AddReplyTo($replytoaddress); 2999 $mail->Subject = $subject; 3000 $mail->IsHTML(true); 3001 $mail->Body = $body; 3002 3003 $return_forward = $this->buildEmbeddedImages($mail,$msg_uid,$forwarding_attachments); 3635 $folder = mb_convert_encoding($params['folder'], "UTF7-IMAP","ISO_8859-1"); 3636 $folder = @eregi_replace("INBOX[/.]", "INBOX".$this->imap_delimiter, $folder); 3637 3638 $mailService->setFrom ('"'.$fromaddress[0].'" <'.$fromaddress[1].'>'); 3639 $mailService->addTo($params['input_to']); 3640 $mailService->addCc( $params['input_cc']); 3641 $mailService->addBcc($params['input_cco']); 3642 $mailService->setSubject($params['input_subject']); 3643 3644 if($is_important){ 3645 $mailService->addHeaderField('Importance','High'); 3646 } 3647 3648 if($return_receipt) 3649 $mailService->addHeaderField('Disposition-Notification-To', $_SESSION['phpgw_info']['expressomail']['user']['email']); 3650 3651 $isHTML = ( ( array_key_exists( 'type', $params ) && in_array( strtolower( $params[ 'type' ] ), array( 'html', 'plain' ) ) ) ? strtolower( $params[ 'type' ] ) != 'plain' : true ); 3652 3653 3654 if( count($forwarding_attachments) > 0 ) 3655 $return_forward = $this->buildEmbeddedImages($mailService, $msg_uid, $forwarding_attachments , $body); 3656 3657 //Build Message Attachments!!! 3658 if(count($message_attachments) > 0 ) 3659 { 3660 foreach($message_attachments as $folder_name => $messages) 3661 { 3662 foreach ($messages as $message_number => $message_subject) 3663 { 3664 if (!$message_subject) 3665 $message_subject = 'no title.eml'; 3666 else 3667 $message_subject .= '.eml'; 3668 3669 if( $message_attachments_contents && isset($message_attachments_contents[$folder_name]) ) 3670 $rawmsg = base64_decode( $message_attachments_contents[$folder_name][$message_number] ); 3671 else{ 3672 $mbox_stream = $this->open_mbox($folder_name);$mbox_stream = $this->open_mbox($folder_name); 3673 $rawmsg = $this->getRawHeader($message_number) . "\r\n\r\n" . $this->getRawBody($message_number); 3674 } 3675 3676 $return_forward[] = array( 'name' => $message_subject, 'size' => mb_strlen($rawmsg)); 3677 $mailService->addStringAttachment($rawmsg, $message_subject, 'message/rfc822', '7bit', 'attachment' ); 3678 } 3679 } 3680 } 3681 3004 3682 $imagesParts = array(); 3005 3683 3684 if(count($return_forward) > 0 ) 3006 3685 foreach ($return_forward as $value) 3007 3686 $imagesParts[$value[6]] = $value[3]; 3008 3687 3009 // Build Forwarding Attachments!!! 3688 //Build Forwarding Attachments!!! 3689 if(count($forwarding_attachments) > 0 ) 3690 { 3010 3691 foreach($forwarding_attachments as $forwarding_attachment) 3011 3692 { 3012 3693 $file_description = unserialize(rawurldecode($forwarding_attachment)); 3694 3695 3013 3696 $file_description = array_values($file_description); 3014 3697 3015 foreach($file_description as $i => $descriptor) {3698 foreach($file_description as $i => $descriptor) 3016 3699 $file_description[$i] = eregi_replace('\'*\'','',$descriptor); 3017 }3700 3018 3701 $fileContent = $this->get_forwarding_attachment($file_description[0], $file_description[1], $file_description[3],$file_description[4]); 3019 $file Name = $file_description[2];3702 $file_description[2] = html_entity_decode($file_description[2]); 3020 3703 3021 3704 $file_description[5] = strlen($fileContent); //Size of file 3022 3705 $return_forward[] = $file_description; 3023 3024 $mail->AddStringAttachment($fileContent, $fileName, $file_description[4], $this->get_file_type($file_description[2]));3706 $mailService->addStringAttachment($fileContent, $file_description[2], $this->get_file_type($file_description[2]), $file_description[4] ); 3707 } 3025 3708 } 3026 3709 3027 3710 if ((count($return_forward) > 0) && (count($return_files) > 0)) 3028 {3029 3711 $return_files = array_merge_recursive($return_forward,$return_files); 3030 }3031 3712 else if (count($return_files) < 1) 3032 {3033 3713 $return_files = $return_forward; 3034 } 3035 3036 // Build Uploading Attachments!!! 3714 3715 //Build Uploading Attachments!!! 3037 3716 $sizeof_attachments = count($attachments); 3038 3717 if ($sizeof_attachments) 3039 {3040 3718 foreach ($attachments as $numb => $attach) 3041 { 3042 if ($numb == ($sizeof_attachments-1) && $params['insertImg'] == 'true') 3043 { // Auto-resize image 3044 list($width, $height,$image_type) = getimagesize($attach['tmp_name']); 3045 switch ($image_type) 3046 { 3047 // Do not corrupt animated gif 3048 //case 1: $image_big = imagecreatefromgif($attach['tmp_name']);break; 3049 case 2: 3050 $image_big = imagecreatefromjpeg($attach['tmp_name']); break; 3051 case 3: 3052 $image_big = imagecreatefrompng($attach['tmp_name']); break; 3053 case 6: 3054 require_once("gd_functions.php"); 3055 $image_big = imagecreatefrombmp($attach['tmp_name']); break; 3056 default: 3057 $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $this->get_file_type($attach['name'])); 3058 break; 3059 } 3060 header('Content-type: image/jpeg'); 3061 $max_resolution = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['image_size']; 3062 $max_resolution = ($max_resolution==""?'65536':$max_resolution); 3063 if ($width < $max_resolution && $height < $max_resolution) 3064 { 3065 $new_width = $width; 3066 $new_height = $height; 3067 } 3068 else if ($width > $max_resolution) 3069 { 3070 $new_width = $max_resolution; 3071 $new_height = $height*($new_width/$width); 3072 } 3073 else 3074 { 3075 $new_height = $max_resolution; 3076 $new_width = $width*($new_height/$height); 3077 } 3078 $image_new = imagecreatetruecolor($new_width, $new_height); 3079 imagecopyresampled($image_new, $image_big, 0, 0, 0, 0, $new_width, $new_height, $width, $height); 3080 $tmpDir = '/tmp'; 3081 3082 // $tmpDir = ini_get("session.save_path"); 3083 $_file = "/cidimage_".$_SESSION[ 'phpgw_session' ][ 'session_id' ].".dat"; 3084 imagejpeg($image_new,$tmpDir.$_file, 85); 3085 $mail->AddAttachment($tmpDir.$_file, $attach['name'], "base64", $this->get_file_type($tmpDir.$_file)); 3086 }else{ 3087 $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $this->get_file_type($attach['name'])); 3088 }// optional name 3089 } 3090 } 3091 3092 if(!empty($mail->AltBody)) 3093 $mail->ContentType = "multipart/alternative"; 3094 3095 $mail->error_count = 0; // reset errors 3096 $mail->SetMessageType(); 3097 $header = $mail->CreateHeader(); 3098 $body = $mail->CreateBody(); 3719 $mailService->addFileAttachment($attach['tmp_name'], $attach['name'],$attach['type'], 'base64', 'attachment'); 3720 3721 3722 if (!$body) 3723 $body = ' '; 3724 3725 if($isHTML) 3726 $mailService->setBodyHtml($body); 3727 else 3728 $mailService->setBodyText($body); 3729 3099 3730 3100 3731 $mbox_stream = $this->open_mbox($folder); 3101 $new_header = str_replace("\n", "\r\n", $header); 3102 $new_body = str_replace("\n", "\r\n", $body); 3103 $return['append'] = imap_append($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, $new_header . $new_body, "\\Seen \\Draft"); 3732 $return['append'] = imap_append($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, $mailService->getMessage(), "\\Seen \\Draft"); 3733 3104 3734 $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, SA_UIDNEXT); 3105 3735 $return['msg_no'] = $status->uidnext - 1; … … 3110 3740 imap_close($mbox_stream); 3111 3741 3112 if (is_array($return_files)) 3742 $returnFiles = array(); 3743 $ii = 0; 3744 3745 if(count($return_files) > 0) 3113 3746 { 3114 3747 foreach ($return_files as $index => $_attachment) … … 3116 3749 if (array_key_exists("name", $_attachment)) 3117 3750 { 3118 unset($return_files[$index]); 3119 $return_files[$index] = $_attachment['name']."_SIZE_".$return_files[$index][1] = $_attachment['size']; 3120 } 3121 else 3751 $returnFiles[$ii]['name'] = base64_encode($_attachment['name']); 3752 $returnFiles[$ii]['size'] = $_attachment['size']; 3753 $ii++; 3754 } 3755 else if($_attachment[2]) 3122 3756 { 3123 unset($return_files[$index]); 3124 $return_files[$index] = $_attachment[2]."_SIZE_". $return_files[$index][1] = $_attachment[5]; 3125 } 3126 } 3127 } 3128 3129 $return['files'] = serialize($return_files); 3130 $return["subject"] = $subject; 3131 3132 if (!$return['append']) 3133 $return['append'] = imap_last_error(); 3134 3757 $returnFiles[$ii]['name'] = base64_encode($_attachment[2]); 3758 $returnFiles[$ii]['size'] = $_attachment[5]; 3759 $ii++; 3760 } 3761 } 3762 } 3763 $return['files'] = serialize($returnFiles); 3764 $return["subject"] = $params['input_subject']; 3765 if (!$return['append']) $return['append'] = imap_last_error(); 3135 3766 return $return; 3136 3767 } … … 3139 3770 { 3140 3771 $folder = $params['folder']; 3141 $ rowids_to_set = $params['msgs_to_set']; // contains the row ids3772 $msgs_to_set = $params['msgs_to_set']; 3142 3773 $flag = $params['flag']; 3143 3774 $return = array(); 3144 $return[" rowids_to_set"] = $rowids_to_set;3775 $return["msgs_to_set"] = $msgs_to_set; 3145 3776 $return["flag"] = $flag; 3146 3147 $msgs_to_set = '';3148 foreach (explode(',',$rowids_to_set) as $msg) {//extracting message ids3149 $pos = strpos($msg,'_');3150 if ($pos===false)3151 $msgs_to_set .= ','.$msg;3152 else3153 $msgs_to_set .= ','.substr($msg,0,$pos);3154 }3155 $msgs_to_set = substr($msgs_to_set,1);3156 $return["msgs_to_set"] = $msgs_to_set;3157 3777 3158 3778 if(!$this->mbox && !is_resource($this->mbox)) … … 3213 3833 $file_name = strtolower($file_name); 3214 3834 $strFileType = strrev(substr(strrev($file_name),0,4)); 3835 if ($strFileType == ".eml") 3836 return "message/rfc822"; 3215 3837 if ($strFileType == ".asf") 3216 3838 return "video/x-ms-asf"; … … 3710 4332 { 3711 4333 $filter .= '"'.$filter_array[1].'"'; 3712 } 3713 if(trim($filter_array[0]) == 'BEFORE' ) 3714 { 4334 }else if(trim($filter_array[0]) == 'BEFORE' ){ 3715 4335 $filter .= '"'.$this->make_search_date($filter_array[1],true).'"'; 3716 4336 }else{ … … 3721 4341 } 3722 4342 3723 $name_box = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO _8859-1" );4343 $name_box = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO-8859-1" ); 3724 4344 $filter = $this->remove_accents($filter); 3725 4345 … … 3737 4357 } 3738 4358 else 3739 $folder_name = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO _8859-1" );4359 $folder_name = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO-8859-1" ); 3740 4360 3741 4361 if(!is_resource($mbox_stream)) … … 3760 4380 { 3761 4381 $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 3762 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO _8859-1", "UTF7-IMAP" );4382 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO-8859-1", "UTF7-IMAP" ); 3763 4383 $elem['uid'] = $new_search; 3764 4384 /* compare dates in ordering */ … … 3770 4390 } 3771 4391 else{ 4392 $search_criteria = imap_search($mbox_stream, $filter, SE_UID); 3772 4393 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) 3773 4394 { … … 3785 4406 } 3786 4407 } 3787 3788 $new_filter = trim(preg_replace('/UNFLAGGED|FLAGGED/','',$filter)); 3789 3790 $search_without_flagged = imap_search($mbox_stream, $new_filter, SE_UID); 3791 3792 if (strpos($filter,"UNFLAGGED") === false) 4408 if((count($flagged_msgs) >0) && (strpos($filter,"UNFLAGGED") === false)) 3793 4409 { 3794 $search_criteria = array_intersect($search_without_flagged, $flagged_msgs); 3795 } 3796 else 4410 $arry_diff = is_array($search_criteria) ? array_diff($flagged_msgs,$search_criteria):$flagged_msgs; 4411 foreach($arry_diff as $msg) 3797 4412 { 3798 $search_criteria = array_diff($search_without_flagged,$flagged_msgs);4413 $search_criteria[] = $msg; 3799 4414 } 3800 4415 } 3801 else 4416 else if((count($flagged_msgs) >0) && (is_array($search_criteria)) && (!strpos($filter,"UNFLAGGED") === false)) 3802 4417 { 3803 $search_criteria = imap_search($mbox_stream, $filter, SE_UID);4418 $search_criteria = array_diff($search_criteria,$flagged_msgs); 3804 4419 } 3805 4420 } 3806 else3807 {3808 $search_criteria = imap_search($mbox_stream, $filter, SE_UID);3809 4421 } 3810 4422 … … 3814 4426 { 3815 4427 $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 3816 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO_8859-1", "UTF7-IMAP" ); 4428 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO-8859-1", "UTF7-IMAP" ); 3817 4429 $elem['uid'] = $new_search; 3818 4430 /* compare dates in ordering */ … … 4036 4648 $mbox_acl = imap_getacl($mbox_stream, 'user'.$this->imap_delimiter.$user); 4037 4649 else 4038 $mbox_acl = imap_getacl($mbox_stream, $user); 4650 $mbox_acl = @imap_getacl($mbox_stream, $user); 4651 if(isset($mbox_acl[$this->username])) 4039 4652 return $mbox_acl[$this->username]; 4653 else 4654 return ''; 4040 4655 } 4041 4656 … … 4166 4781 4167 4782 4783 /** 4784 * Descrição do método 4785 * 4786 * @license http://www.gnu.org/copyleft/gpl.html GPL 4787 * @author 4788 * @sponsor Caixa Econômica Federal 4789 * @author 4790 * @param <tipo> <$msg_number> <Número da mensagem> 4791 * @return <cabeçalho da mensagem> 4792 * @access <public> 4793 */ 4168 4794 function get_header($msg_number) 4169 4795 { … … 4172 4798 return false; 4173 4799 4174 if($header->Flagged != "F" && $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']) {4800 if($header->Flagged != "F" ) { 4175 4801 $flag = preg_match('/importance *: *(.*)\r/i', 4176 4802 imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) … … 4191 4817 $imap_port = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort']; 4192 4818 $imap_options = '/notls/novalidate-cert'; 4819 4820 4821 $folder = mb_convert_encoding( $folder, "UTF7-IMAP","ISO-8859-1"); 4822 4193 4823 $mbox_stream = imap_open("{".$imap_server.":".$imap_port.$imap_options."}".$folder, $username, $password); 4194 if(imap_last_error())4195 {4824 4825 if(imap_last_error() === 'Mailbox already exists') 4196 4826 imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}".$folder)); 4197 }4198 4827 if($timestamp){ 4199 4828 $pdate = date_parse(date('r')); // pega a data atual do servidor (TODO: pegar a data da mensagem local) … … 4205 4834 fputs($f,base64_encode($source)); 4206 4835 fclose($f); 4207 $command = "python ".$_SESSION['rootPatch']."/expressoMail1_2/imap.py ".escapeshellarg($imap_server)." ".escapeshellarg($imap_port)." ".escapeshellarg($username)." ".escapeshellarg($password)." ".escapeshellarg($timestamp)." ".escapeshellarg($folder)." ".escapeshellarg($file);4208 $return['command']= exec(escapeshellcmd($command));4836 $command = "python ".$_SESSION['rootPath']."/expressoMail1_2/imap.py \"$imap_server\" \"$imap_port\" \"$username\" \"$password\" \"$timestamp\" \"$folder\" \"$file\""; 4837 $return['command']= exec($command); 4209 4838 }else{ 4210 4839 $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$folder, $source, "\\Seen"); … … 4230 4859 imap_setflag_full($mbox_stream, $return['msg_no'], $flags_fixed, ST_UID); 4231 4860 } 4861 4862 //Ignorando erro de AUTH=Plain 4863 if($return['error'] === 'SECURITY PROBLEM: insecure server advertised AUTH=PLAIN') 4864 $return['error'] = false; 4865 4232 4866 if($mbox_stream) 4233 4867 imap_close($mbox_stream); … … 4235 4869 } 4236 4870 4237 function show_decript($params){4871 function show_decript($params,$dec=0){ 4238 4872 $source = $params['source']; 4239 //error_log("source: $source\nversao: " . PHP_VERSION, 3, '/tmp/teste.log');4240 $source = str_replace(" ", "+", $source,$i);4241 4873 4874 //error_log("source: $source\nversao: " . PHP_VERSION); 4875 if ($dec == 0) 4876 { 4877 $source = str_replace(" ", "+", $source,$i); 4242 4878 if (version_compare(PHP_VERSION, '5.2.0', '>=')){ 4243 4879 if(!$source = base64_decode($source,true)) 4244 return "error ".$source."Espaços ".$i;4880 return "error ".$source."Espaï¿?os ".$i; 4245 4881 4246 4882 } 4247 4883 else { 4248 4884 if(!$source = base64_decode($source)) 4249 return "error ".$source."Espaços ".$i;4250 4885 return "error ".$source."Espaï¿?os ".$i; 4886 } 4251 4887 } 4252 4888 … … 4316 4952 $dest_folder = $params['folder']; 4317 4953 $sources = explode("#@#@#@",$params['source']); 4318 $timestamps = explode("#@#@#@",$params['timestamp']); 4954 //Add user timeszone 4955 $timestamps = $params['timestamp'] + $this->functions->CalculateDateOffset(); 4319 4956 $flags = explode("#@#@#@",$params['flags']); 4320 4957 4321 foreach($sources as $index=>$src) 4322 { 4323 if($src!="") 4324 { 4958 foreach($sources as $index=>$src) { 4959 if($src!=""){ 4325 4960 $source = $this->treat_base64_from_post($src); 4326 $insert = $this->insert_email($source,$dest_folder,$timestamps[$index],$flags[$index]); 4961 $insert = $this->insert_email($source, mb_convert_encoding( $dest_folder,"ISO-8859-1","UTF-8"), $timestamps,$flags[$index]); 4327 4962 } 4328 4963 } 4329 4330 4964 return $insert; 4331 4965 } … … 4357 4991 $msg_user = "Sem mensagem!"; 4358 4992 4359 $toaddresses = $_SESSION['phpgw_info']['expressomail']['server']['sugestoes_email_to'];4360 $toaddress = explode(",", $toaddresses);4361 4362 for($i=0; $i<count($toaddress); $i++)4363 $toaddress[$i] = trim($toaddress[$i]);4364 4365 4993 $toname = $_SESSION['phpgw_info']['expressomail']['user']['fullname']; 4366 4994 … … 4372 5000 "$msg_user</body><br><br><hr>"; 4373 5001 5002 require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php'; 4374 5003 $mailService = ServiceLocator::getService('mail'); 4375 $mailService->add Attachment($mail_content, 'report.eml', 'application/text');4376 $mailService->send ($toaddress, $GLOBALS['phpgw_info']['user']['email'], $title, $body);5004 $mailService->addStringAttachment($mail_content, 'report.eml', 'application/text'); 5005 $mailService->sendMail($_SESSION['phpgw_info']['expressomail']['server']['sugestoes_email_to'], $GLOBALS['phpgw_info']['user']['email'], $title, $body); 4377 5006 } 4378 5007 5008 function array_msort($array, $cols) 5009 { 5010 $colarr = array(); 5011 foreach ($cols as $col => $order) { 5012 $colarr[$col] = array(); 5013 foreach ($array as $k => $row) { $colarr[$col]['_'.$k] = strtolower($row[$col]); } 5014 } 5015 $params = array(); 5016 foreach ($cols as $col => $order) { 5017 $params[] =& $colarr[$col]; 5018 $params = array_merge($params, (array)$order); 5019 } 5020 call_user_func_array('array_multisort', $params); 5021 $ret = array(); 5022 $keys = array(); 5023 $first = true; 5024 foreach ($colarr as $col => $arr) { 5025 foreach ($arr as $k => $v) { 5026 if ($first) { $keys[$k] = substr($k,1); } 5027 $k = $keys[$k]; 5028 if (!isset($ret[$k])) $ret[$k] = $array[$k]; 5029 $ret[$k][$col] = $array[$k][$col]; 5030 } 5031 $first = false; 5032 } 5033 5034 return $ret; 5035 5036 } 5037 5038 function parseCriteriaSearchMail($search) 5039 { 5040 $criteria = ''; 5041 $searchArray = explode(' ', $search); 5042 5043 foreach ($searchArray as $v) 5044 if(trim($v) !== '' ) 5045 $criteria .= 'TEXT "'.$v.'" ' ; 5046 5047 return $criteria; 5048 } 5049 5050 function quickSearchMail( $params ) 5051 { 5052 $return = array(); 5053 $return['folder'] = $params['folder']; 5054 if(!is_array($params['folder'])) 5055 $params['folder'] = array( $params['folder'] ); 5056 5057 if(!isset($params['sort'])) 5058 $params['sort'] = SORTDATE; 5059 5060 $params['search'] = mb_convert_encoding($params['search'], 'UTF-8',mb_detect_encoding($params['search'].'x', 'UTF-8, ISO-8859-1')); 5061 5062 $i = 0; 5063 if(!isset($params['page'])) $params['page'] = 0; 5064 $end = ($this->prefs['max_email_per_page'] * ((int)$params['page'] + 1)); 5065 $ini = $end - $this->prefs['max_email_per_page'] ; 5066 $count = 0; 5067 5068 $search = $this->parseCriteriaSearchMail($params['search']); 5069 5070 foreach ($params['folder'] as $folder) 5071 { 5072 $imap = $this->open_mbox( $folder ) ; 5073 $msgIds = imap_sort( $imap , SORTDATE , 0 , SE_UID , $search ,'UTF-8'); 5074 5075 $count += count($msgIds); 5076 5077 foreach ($msgIds as $ii => $v) 5078 { 5079 $msg = imap_headerinfo ( $imap, imap_msgno($imap, $v) ); 5080 $return['msgs'][$i]['from'] = ''; 5081 5082 $from = $msg->from[0]->mailbox; 5083 if($msg->from[0]->personal != "") 5084 $from = $msg->from[0]->personal; 5085 $return['msgs'][$i]['from'] = mb_convert_encoding($this->decode_string($from), 'UTF-8'); 5086 5087 $return['msgs'][$i]['subject'] = ' '; 5088 5089 $subject = imap_mime_header_decode($msg->subject); 5090 foreach ($subject as $tmp) 5091 $return['msgs'][$i]['subject'] .= mb_convert_encoding($tmp->text, 'UTF-8'); 5092 5093 $return['msgs'][$i]['flag'] = ' '; 5094 $return['msgs'][$i]['flag'] .= $msg->Unseen ? $msg->Unseen : ''; 5095 $return['msgs'][$i]['flag'] .= $msg->Recent ? $msg->Recent : ''; 5096 $return['msgs'][$i]['flag'] .= $msg->Flagged ? $msg->Flagged : ''; 5097 $return['msgs'][$i]['flag'] .= $msg->Draft ? $msg->Draft : ''; 5098 $return['msgs'][$i]['flag'] .= $msg->Answered ? $msg->Answered : ''; 5099 $return['msgs'][$i]['flag'] .= $msg->Deleted ? $msg->Deleted : ''; 5100 5101 $return['msgs'][$i]['udate'] = gmdate("d/m/Y",$msg->udate + $this->functions->CalculateDateOffset()); 5102 $return['msgs'][$i]['udatecomp'] = substr ($return['msgs'][$i]['udate'], -4) ."-". substr ($return['msgs'][$i]['udate'], 3, 2) ."-". substr ($return['msgs'][$i]['udate'], 0, 2); 5103 $return['msgs'][$i]['date'] = $msg->udate; 5104 $return['msgs'][$i]['size'] = $msg->Size; 5105 $return['msgs'][$i]['boxname'] = $folder; 5106 $return['msgs'][$i]['uid'] = $v; 5107 $i++; 5108 } 5109 } 5110 5111 $return['num_msgs'] = $count; 5112 5113 if(!isset($return['msgs'])) 5114 $return['msgs'] = array(); 5115 5116 define('SORTBOX', 69); 5117 define('SORTWHO', 2); 5118 define('SORTBOX_REVERSE', 69); 5119 define('SORTWHO_REVERSE', 2); 5120 define('SORTDATE_REVERSE', 0); 5121 define('SORTSUBJECT_REVERSE', 3); 5122 define('SORTSIZE_REVERSE', 6); 5123 5124 switch (constant( $params['sort'] )){ 5125 case 0 : $sA = 'date'; break; 5126 case 2 : $sA = 'from'; break; 5127 case 69 : $sA = 'boxname'; break; 5128 case 3 : $sA = 'subject'; break; 5129 case 6 : $sA = 'size'; break; 5130 } 4379 5131 5132 $return['msgs'] = $this->array_msort($return['msgs'] , array( $sA => SORT_ASC)); 5133 5134 if(strpos($params['sort'],'REVERSE') !== false) 5135 $return['msgs'] = array_reverse($return['msgs']); 5136 5137 5138 $k = -1; 5139 $nMsgs = array(); 5140 5141 foreach ($return['msgs'] as $v) 5142 { 5143 $k++; 5144 if($k < $ini || $k >= $end ) continue; 5145 $nMsgs[] = $v; 5146 } 5147 $return['msgs'] = $nMsgs; 5148 $return = json_encode($return); 5149 $return = base64_encode($return); 5150 5151 return $return; 5152 } 4380 5153 4381 5154 function get_quota_folders(){ … … 4416 5189 return $data; 4417 5190 } 5191 5192 function getaclfrombox($mail) 5193 { 5194 $mailArray = explode('@', $mail); 5195 $boxacl = $mailArray[0]; 5196 $return = array(); 5197 5198 if(!$this->mbox) 5199 $this->open_mbox(); 5200 5201 $mbox_acl = imap_getacl($this->mbox, 'user' . $this->imap_delimiter . $boxacl); 5202 5203 foreach ($mbox_acl as $user => $acl) 5204 { 5205 if ($user != $boxacl ) 5206 $return[$user] = $acl; 5207 } 5208 return $return; 5209 } 4418 5210 } 4419 5211 ?> -
trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
r5075 r5134 24 24 @include("../contactcenter/setup/external_catalogs.inc.php"); 25 25 $this->ldapService = ServiceLocator::getService('ldap'); 26 if(isset($external_srcs)) 26 27 $this->external_srcs = $external_srcs; 27 28 $this->max_result = $this->ldapService->limit; … … 65 66 ldap_set_option($ds, LDAP_OPT_REFERRALS, $refer); 66 67 if ($refer) 67 ldap_set_rebind_proc($ds, ldapRebind);68 ldap_set_rebind_proc($ds, 'rebind'); 68 69 @ldap_bind($ds, $_SESSION['phpgw_info']['expressomail']['ldap_server']['acc'],$_SESSION['phpgw_info']['expressomail']['ldap_server']['pw']); 69 70 … … 88 89 $functions = new functions; 89 90 90 // $search_for = utf8_encode($params['search_for']);91 //Testa se a busca foi realizada com aspas92 $search_for = utf8_encode($params['search_for']);93 $search_len = (strlen($search_for)) - 1;94 $quote_status=false;95 96 if((($search_for{0}) == "\"") && (($search_for{$search_len}) == "\"")){97 $search_for{0} = " ";98 $search_for{$search_len} = " ";99 $quote_status=true;100 }101 102 103 104 91 $field = $params['field']; 105 92 $ID = $params['ID']; … … 118 105 if ($this->ds) 119 106 { 120 if (($field != 'null') && ($ID != 'null')) 121 { 122 $filter="(& (&(|(phpgwAccountType=u)(phpgwAccountType=g)(phpgwAccountType=l))(mail=*)) (|(cn=*$search_for*)(mail=*$search_for*)) (!(phpgwaccountvisible=-1)) )"; 123 if($extendedinfo) 124 $justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible", "uid", "employeeNumber", "ou"); 125 else 126 $justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible", "uid"); 127 } 128 else 129 { 130 if($quote_status){ 131 $filter="(& (phpgwAccountType=u) (|(cn=* $search_for *)(cn=$search_for *)(cn=* $search_for)) (!(phpgwaccountvisible=-1)) )"; 132 } 133 else{ 134 $filter="(& (phpgwAccountType=u)(cn=*$search_for*) (!(phpgwaccountvisible=-1)) )"; 135 } 136 // $filter="(& (phpgwAccountType=u)(cn=*$search_for*) (!(phpgwaccountvisible=-1)) )"; 137 if($extendedinfo) 138 $justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible","jpegPhoto", "uid", "employeeNumber", "ou"); 139 else 140 $justthese = array("cn", "mail", "telephoneNumber", "mobile", "phpgwAccountVisible","jpegPhoto", "uid"); 141 } 142 $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese, 0, $this->max_result + 1); 143 if(!$sr) 144 return null; 145 $count_entries = ldap_count_entries($this->ds,$sr); 107 $ldapService->connection = $this->ds; 146 108 147 109 $justthese = array("cn", "mail", "telephonenumber", "mobile", "phpgwaccountvisible", "uid", "employeenumber", "ou"); … … 301 263 302 264 include_once $_SESSION['rootPath']. '/header.inc.php'; 303 304 305 if (stripos( $params['search_for'] , '@' ) !== false)306 $params['search_for'] = substr($params['search_for'], 0 , stripos( $params['search_for'] , '@' ) );307 308 265 309 266 if($modal) … … 383 340 $results['type_catalog'] = "P"; 384 341 $results['search_for'] = $params['search_for']; 342 343 foreach($results as $i=>$value) 344 $results[$i]['type_contact'] = "P"; 345 385 346 return $results; 386 347 } … … 408 369 if (is_numeric($parts[3]) && $parts[1]=='attribute') 409 370 { 410 if($parts[2] == 'searchable' && $value == 'true')371 if($parts[2] == 'searchable' /*&& $value == 'true'*/) 411 372 $searchable_fields[$all_data['cc_attribute_ldapname_' . $parts[3]]] = $all_data['cc_attribute_name_' . $parts[3]]; 412 373 } … … 485 446 $info_return['search_for'] = $params['search_for']; 486 447 $info_return['extra_ldap_fields'] = $campos_extras; 448 449 foreach($info_return as $i=>$value) 450 $info_return[$i]['type_contact'] = "G"; 487 451 return $info_return; 488 452 } … … 640 604 $_SESSION['phpgw_info']['expressomail']['server']['ldap_root_pw']); 641 605 642 $groups = $ldapService->accountSearch($params['filter'], array("gidNumber","cn"), $params['context'] , 'g', 'cn'); 643 $users = $ldapService->accountSearch($params['filter'], array("uidNumber","cn"), $params['context'] , 'u', 'cn'); 606 $groups = $ldapService->accountSearch($params['filter'], array("gidNumber","cn", 'uid'), $params['context'] , 'g', 'cn'); 607 $users = $ldapService->accountSearch($params['filter'], array("uidNumber","cn", 'uid'), $params['context'] , 'u', 'cn'); 608 $compartilhadas = $ldapService->accountSearch($params['filter'], array("uidNumber","cn",'uid'), $params['context'] , 's', 'cn'); 609 610 644 611 $group_options = array(); 645 612 $user_options = array(); 613 $shared_options = array(); 614 646 615 foreach($groups as $group) 647 616 { 648 $group_options[] = '"'.$group['gidNumber'].'U'.'":"'.$group['cn'].'"';617 $group_options[] = '"'.$group['gidnumber'].'U'.'":"'.$group['cn'].' ('.$group['uid'].')"'; 649 618 } 650 651 619 foreach($users as $user) 652 620 { 653 if($owner != $user['uidNumber']) 654 $user_options[] = '"'.$user['uidNumber'].'U'.'":"'.$user['cn'].'"'; 621 if($owner != $user['uidnumber']) 622 $user_options[] = '"'.$user['uidnumber'].'U'.'":"'.$user['cn'].' ('.$user['uid'].')"'; 623 } 624 foreach($compartilhadas as $shared) 625 { 626 if($owner != $shared['uidnumber']) 627 $shared_options[] = '"'.$shared['uidnumber'].'U'.'":"'.$shared['cn'].' ('.$shared['uid'].')"'; 655 628 } 656 629 657 630 $user_options = '{'.implode( ',', $user_options ).'}'; 658 631 $group_options = '{'.implode( ',', $group_options ).'}'; 659 660 return array("users" => $user_options, "groups" => $group_options); 632 $shared_options = '{'.implode( ',', $shared_options ).'}'; 633 634 return '{"users":'.$user_options.',"groups":'.$group_options.',"shared":'. $shared_options .'}'; 661 635 } 662 636 … … 996 970 return false; 997 971 } 972 973 function get_user_groups($uid) 974 { 975 976 $organizations = array(); 977 978 $this->ldapRootConnect(); 979 980 $justthese = array("gidnumber","cn"); 981 $filter="(&(phpgwAccountType=g)(memberuid=".$uid."))"; 982 983 $search = ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 984 985 $result = array(); 986 $entries = ldap_get_entries($this->ds, $search); 987 988 989 for ($i=0; $i<$entries['count']; $i++) 990 { 991 $result[ $entries[$i]['gidnumber'][0] ] = $entries[$i]['cn'][0]; 992 } 993 994 return $result; 995 } 996 997 function getMailByUid($pUid) 998 { 999 // do not follow the referral 1000 $this->ldapRootConnect(false); 1001 if ($this->ds) 1002 { 1003 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=s)(phpgwAccountType=l))(uid=$pUid))"; 1004 $justthese = array("mail"); 1005 $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 1006 if(!$sr) 1007 return false; 1008 $info = ldap_get_entries($this->ds, $sr); 1009 1010 1011 return utf8_decode($info[0]["mail"][0]); 1012 } 1013 return false; 1014 } 1015 1016 function mail2uid($mail) 1017 { 1018 if(!$this-ds) 1019 $this->ldapRootConnect(false); 1020 1021 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=s)(phpgwAccountType=i)(phpgwAccountType=g))(mail=$mail))"; 1022 $justthese = array("uid"); 1023 $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 1024 if(!$sr) 1025 return false; 1026 $info = ldap_get_entries($this->ds, $sr); 1027 return $info[0]["uid"][0]; 1028 } 1029 1030 1031 /** 1032 * Retorna as contas compartilhas 1033 * @param string $toaddress emails 1034 * @param string $ccaddress emails 1035 * @param string $ccoaddress emails 1036 * @param array $groups array com os grupos que o usuario pertence 1037 * @return array 1038 */ 1039 function returnSharedsAccounts($toaddress,$ccaddress,$ccoaddress) 1040 { 1041 1042 $arrayAllAddres = array(); 1043 $arrayAllAddres = array_merge($arrayAllAddres , explode(',',$toaddress)); 1044 $arrayAllAddres = array_merge($arrayAllAddres, explode(',',$ccaddress)); 1045 $arrayAllAddres = array_merge($arrayAllAddres, explode(',',$ccoaddress)); 1046 1047 $mailsArray = array(); 1048 1049 foreach ($arrayAllAddres as $toAddres) 1050 { 1051 1052 if(strchr($toAddres,'@') && strchr($toAddres,'<') && strchr($toAddres,'>')) 1053 { 1054 $alias = substr($toAddres, strpos($toAddres,'<'), strpos($toAddres,'>')); 1055 $alias = str_replace('<','', str_replace('>','',$alias)); 1056 array_push($mailsArray, $alias); 1057 } 1058 else if(strchr($toAddres,'@')) 1059 { 1060 array_push($mailsArray, $toAddres); 1061 } 1062 } 1063 $arraySharedAccounts = array(); 1064 1065 $conexao = $this->ldapConnect2(true); 1066 1067 1068 $mailFilter = ''; 1069 1070 foreach ($mailsArray as $mail) 1071 $mailFilter .= '(|(mail='.$mail.')(mailAlternateAddress='.$mail.'))'; 1072 1073 1074 $filter = '(&(phpgwAccountType=s)(|'.$mailFilter.') )'; 1075 $ldap_context = $_SESSION['phpgw_info']['expressomail']['server']['ldap_context']; 1076 $justthese = array('cn','uid','mail'); 1077 1078 if ($conexao) 1079 { 1080 $search = @ldap_search($conexao, $ldap_context, $filter, $justthese); 1081 if($search) 1082 { 1083 $results = ldap_get_entries($conexao, $search); 1084 1085 foreach ($results as $result) 1086 { 1087 if($result['mail'][0]) 1088 array_push($arraySharedAccounts, $result['mail'][0]); 1089 } 1090 } 1091 1092 } 1093 1094 return $arraySharedAccounts; 1095 } 1096 /** 1097 * Verifica se um email é uma conta compartilhada 1098 * 1099 * @license http://www.gnu.org/copyleft/gpl.html GPL 1100 * @author Cons?rcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 1101 * @author Cristiano Corrêa Schmidt 1102 * @param String $mail Email a ser verificado 1103 * @return bolean 1104 * @access public 1105 */ 1106 function isSharedAccountByMail($mail) 1107 { 1108 $return = false; 1109 $conexao = $this->ldapConnect2(true); 1110 $filter = '(&(phpgwAccountType=s)(mail='.$mail.'))'; 1111 $ldap_context = $_SESSION['phpgw_info']['expressomail']['server']['ldap_context']; 1112 $justthese = array('cn','uid','mail'); 1113 if ($conexao) 1114 { 1115 $search = @ldap_search($conexao, $ldap_context, $filter, $justthese); 1116 if(ldap_count_entries ($conexao , $search)) 1117 $return = true; 1118 } 1119 1120 return $return; 1121 } 998 1122 } 999 1123 ?> -
trunk/expressoMail1_2/inc/class.message_components.inc.php
r3858 r5134 105 105 106 106 $ftype = (empty($parts[$p]->type))? $this->data_types[0].'/'.strtolower($parts[$p]->subtype) : $this->data_types[$parts[$p]->type].'/'.strtolower($parts[$p]->subtype); 107 $encoding = (empty($parts[$p]->encoding))? $this->encoding_types[0] : $this->encoding_types[$parts[$p]->encoding]; 107 $encoding = (isset($parts[$p]->encoding) && !empty($parts[$p]->encoding) && isset($this->encoding_types[$parts[$p]->encoding]) )? $this->encoding_types[$parts[$p]->encoding] : $this->encoding_types[0]; 108 108 109 if(!preg_match("/5./",phpversion())) 109 110 $charset = $parts[$p]->parameters[0]->value; -
trunk/expressoMail1_2/inc/get_archive.php
r5069 r5134 1 1 <?php 2 /**3 *4 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)5 *6 * This program is free software; you can redistribute it and/or modify it under7 * the terms of the GNU Affero General Public License version 3 as published by8 * the Free Software Foundation with the addition of the following permission9 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED10 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE11 * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.12 *13 * This program is distributed in the hope that it will be useful, but WITHOUT14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more16 * details.17 *18 * You should have received a copy of the GNU Affero General Public License19 * along with this program; if not, see www.gnu.org/licenses or write to20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,21 * MA 02110-1301 USA.22 *23 * This code is based on the OpenXchange Connector and on the Prognus pSync24 * Connector both developed by the community and licensed under the GPL25 * version 2 or above as published by the Free Software Foundation.26 *27 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves,28 * 6731, PTI, Bl. 05, Esp. 02, Sl. 10, Foz do Iguaçu - PR - Brasil or at29 * e-mail address prognus@prognus.com.br.30 *31 *32 * @package expressoMail33 * @license http://www.gnu.org/copyleft/gpl.html GPL34 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)35 * @version 1.036 * @sponsor Caixa Econômica Federal37 */38 39 2 /* 40 3 * Definitions … … 52 15 //-----------------------// 53 16 54 /*55 * Requires56 */57 require_once 'class.attachment.inc.php';58 require_once '../../header.inc.php';59 17 //-----------------------// 60 18 … … 62 20 * Get variables 63 21 */ 64 $newFilename = urldecode($_GET['newFilename']); 65 $indexFile = $_GET['idx_file']; 22 if(array_key_exists('newFilename', $_GET ) && urldecode($_GET['newFilename']) !== 'application.octet-stream') 23 $newFilename = urldecode($_GET['newFilename']); 24 else 25 $newFilename = null; 26 if(array_key_exists('idx_file', $_GET )) 27 $indexFile = $_GET['idx_file']; 28 else 29 $indexFile = null; 30 66 31 $indexPart = $_GET['indexPart']; 67 32 $msgNumber = $_GET['msgNumber']; 68 33 $msgFolder = $_GET['msgFolder']; 34 if(array_key_exists('fileType', $_GET )) 35 $ContentType = $_GET['fileType']; 36 else 37 $ContentType = null; 38 if(array_key_exists('image', $_GET )) 39 $image = $_GET['image']; 40 else 41 $image = null; 69 42 //----------------------------------------------// 70 43 71 72 /** 73 * Método que faz o download do arquivo 74 * 75 * @license http://www.gnu.org/copyleft/gpl.html GPL 76 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 77 * @sponsor Caixa Econômica Federal 78 * @param $strFileType 79 * @param $strFileName 80 * @param $newFileName 81 * @param $fileContent 82 */ 83 function downloadFile($strFileType, $strFileName, $newFileName, $fileContent) { 84 85 $ContentType = "application/octet-stream"; 86 87 if ($strFileType == ".asf") 88 $ContentType = "video/x-ms-asf"; 89 if ($strFileType == ".avi") 90 $ContentType = "video/avi"; 91 if ($strFileType == ".doc") 92 $ContentType = "application/msword"; 93 if ($strFileType == ".zip") 94 $ContentType = "application/zip"; 95 if ($strFileType == ".xls") 96 $ContentType = "application/vnd.ms-excel"; 97 if ($strFileType == ".gif") 98 $ContentType = "image/gif"; 99 if ($strFileType == ".jpg" || $strFileType == "jpeg") 100 $ContentType = "image/jpeg"; 101 if ($strFileType == ".wav") 102 $ContentType = "audio/wav"; 103 if ($strFileType == ".mp3") 104 $ContentType = "audio/mpeg3"; 105 if ($strFileType == ".mpg" || $strFileType == "mpeg") 106 $ContentType = "video/mpeg"; 107 if ($strFileType == ".rtf") 108 $ContentType = "application/rtf"; 109 if ($strFileType == ".htm" || $strFileType == "html") 110 $ContentType = "text/html"; 111 if ($strFileType == ".xml") 112 $ContentType = "text/xml"; 113 if ($strFileType == ".xsl") 114 $ContentType = "text/xsl"; 115 if ($strFileType == ".css") 116 $ContentType = "text/css"; 117 if ($strFileType == ".php") 118 $ContentType = "text/php"; 119 if ($strFileType == ".asp") 120 $ContentType = "text/asp"; 121 if ($strFileType == ".pdf") 122 $ContentType = "application/pdf"; 123 if ($strFileType == ".txt") 124 $ContentType = "text/plain"; 125 if ($strFileType == ".log") 126 $ContentType = "text/plain"; 127 if ($strFileType == ".wmv") 128 $ContentType = "video/x-ms-wmv"; 129 if ($strFileType == ".sxc") 130 $ContentType = "application/vnd.sun.xml.calc"; 131 if ($strFileType == ".odt") 132 $ContentType = "application/vnd.oasis.opendocument.text"; 133 if ($strFileType == ".stc") 134 $ContentType = "application/vnd.sun.xml.calc.template"; 135 if ($strFileType == ".sxd") 136 $ContentType = "application/vnd.sun.xml.draw"; 137 if ($strFileType == ".std") 138 $ContentType = "application/vnd.sun.xml.draw.template"; 139 if ($strFileType == ".sxi") 140 $ContentType = "application/vnd.sun.xml.impress"; 141 if ($strFileType == ".sti") 142 $ContentType = "application/vnd.sun.xml.impress.template"; 143 if ($strFileType == ".sxm") 144 $ContentType = "application/vnd.sun.xml.math"; 145 if ($strFileType == ".sxw") 146 $ContentType = "application/vnd.sun.xml.writer"; 147 if ($strFileType == ".sxq") 148 $ContentType = "application/vnd.sun.xml.writer.global"; 149 if ($strFileType == ".stw") 150 $ContentType = "application/vnd.sun.xml.writer.template"; 151 if ($strFileType == ".ps") 152 $ContentType = "application/postscript"; 153 if ($strFileType == ".pps") 154 $ContentType = "application/vnd.ms-powerpoint"; 155 if ($strFileType == ".odt") 156 $ContentType = "application/vnd.oasis.opendocument.text"; 157 if ($strFileType == ".ott") 158 $ContentType = "application/vnd.oasis.opendocument.text-template"; 159 if ($strFileType == ".oth") 160 $ContentType = "application/vnd.oasis.opendocument.text-web"; 161 if ($strFileType == ".odm") 162 $ContentType = "application/vnd.oasis.opendocument.text-master"; 163 if ($strFileType == ".odg") 164 $ContentType = "application/vnd.oasis.opendocument.graphics"; 165 if ($strFileType == ".otg") 166 $ContentType = "application/vnd.oasis.opendocument.graphics-template"; 167 if ($strFileType == ".odp") 168 $ContentType = "application/vnd.oasis.opendocument.presentation"; 169 if ($strFileType == ".otp") 170 $ContentType = "application/vnd.oasis.opendocument.presentation-template"; 171 if ($strFileType == ".ods") 172 $ContentType = "application/vnd.oasis.opendocument.spreadsheet"; 173 if ($strFileType == ".ots") 174 $ContentType = "application/vnd.oasis.opendocument.spreadsheet-template"; 175 if ($strFileType == ".odc") 176 $ContentType = "application/vnd.oasis.opendocument.chart"; 177 if ($strFileType == ".odf") 178 $ContentType = "application/vnd.oasis.opendocument.formula"; 179 if ($strFileType == ".odi") 180 $ContentType = "application/vnd.oasis.opendocument.image"; 181 if ($strFileType == ".ndl") 182 $ContentType = "application/vnd.lotus-notes"; 183 if ($strFileType == ".eml") 184 $ContentType = "text/plain"; 185 186 header ("Content-Type: $ContentType"); 187 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 188 header("Pragma: public"); 189 header("Expires: 0"); // set expiration time 190 header ("Content-Disposition: attachment; filename=\"". addslashes($newFileName)."\""); 191 192 if($fileContent) 44 /* 45 * Requires 46 */ 47 if( $indexFile ) 48 require_once '../../header.inc.php'; 49 else 50 require_once '../../header.session.inc.php'; 51 52 53 /* 54 * Functions 55 */ 56 57 function unhtmlentities($string) 58 { 59 $string = utf8_encode($string); 60 61 static $trans_tbl; 62 63 $string = preg_replace('~&#x([0-9a-f]+);~ei', 'code2utf(hexdec("\\1"))', $string); 64 $string = preg_replace('~&#([0-9]+);~e', 'code2utf(\\1)', $string); 65 66 if (!isset($trans_tbl)) 193 67 { 194 echo $fileContent; 68 $trans_tbl = array(); 69 70 foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) 71 $trans_tbl[$key] = utf8_encode($val); 195 72 } 196 else 197 { 198 $tempDir = $GLOBALS['phpgw_info']['server']['download_temp_dir']; 199 if (preg_match("#^".$tempDir."/(".$GLOBALS['phpgw']->session->sessionid."/)*[A-z0-9_]+_".$GLOBALS['phpgw']->session->sessionid."[A-z0-9]*(\.[A-z]{3,4})?$#",$strFileName)) 200 { 201 //avoid stuck request 202 session_write_close(); 203 204 //reset time limit for big files 205 set_time_limit(0); 206 ob_end_flush(); 207 208 if ($fp = fopen ($strFileName, 'rb')) 209 { 210 $bufferSize=1024; 211 for ($i=$bufferSize; $i<=(filesize($strFileName)+$bufferSize); $i+=$bufferSize) 73 return strtr($string, $trans_tbl); 74 } 75 76 function code2utf($num) 77 { 78 if ($num < 128) return chr($num); 79 if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128); 80 if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); 81 if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); 82 return ''; 83 } 84 85 //-----------------------// 86 87 /* 88 * Main 89 */ 90 91 92 if($msgNumber != 'null' && $indexPart !== null && $msgFolder) 93 { 94 require_once $_SESSION['rootPath'].'/expressoMail1_2/inc/class.attachment.inc.php'; 95 96 $attachment = new attachment(); 97 $attachment->setStructureFromMail($msgFolder, $msgNumber); 98 $fileContent = $attachment->getAttachment($indexPart); 99 $info = $attachment->getAttachmentInfo($indexPart); 100 $filename = $newFilename ? $newFilename : $info['name']; 101 $filename = unhtmlentities($filename); 102 } 103 else 104 { 105 if( $image && $_SESSION['phpgw_info']['expressomail']['contact_photo'] ) 212 106 { 213 echo fread($fp, $i); 214 flush(); 215 } 216 fclose ($fp); 217 } 218 219 //removendo pelo php, garante a suportabilidade cross-platform 220 cleanup( dirname( $strFileName ) ); 221 107 $image = "thumbnail"; 108 109 $photo = array( 'width' => 60, 'height' => 80, 'quality' => 100 ); 110 111 $fileContent = $_SESSION['phpgw_info']['expressomail']['contact_photo'][0]; 112 unset( $_SESSION['phpgw_info']['expressomail']['contact_photo'] ); 222 113 } 114 115 $filename = $indexFile; 116 } 117 118 $filename = $filename ? $filename : "attachment.bin"; 119 $newFilename = $newFilename ? $newFilename : $filename; 120 $newFilename = unhtmlentities($newFilename); 121 $disposition = $image ? "inline" : "attachment; filename=\"". addslashes($newFilename)."\""; 122 123 if( !$ContentType || $ContentType == 'application/octet-stream') 124 { 125 126 if( strstr($_SERVER['HTTP_USER_AGENT'],'MSIE') && $disposition != 'inline' ) 127 $ContentType = 'application-download'; 223 128 else 224 129 { 225 if (preg_match("#^".dirname( __FILE__ ) . '/../tmpLclAtt'."/source_#",$strFileName)) { 226 readfile($strFileName); 130 function guessContentType( $fileName ) 131 { 132 $strFileType = strtolower(substr ( $fileName , strrpos($fileName, '.') )); 133 134 switch( $strFileType ) 135 { 136 case ".asf": return "video/x-ms-asf"; 137 case ".avi": return "video/avi"; 138 case ".doc": return "application/msword"; 139 case ".zip": return "application/zip"; 140 case ".xls": return "application/vnd.ms-excel"; 141 case ".gif": return "image/gif"; 142 case ".bmp": return "image/bmp"; 143 case ".jpeg": 144 case ".jpg": return "image/jpeg"; 145 case ".wav": return "audio/wav"; 146 case ".mp3": return "audio/mpeg3"; 147 case ".mpeg": 148 case ".mpg": return "video/mpeg"; 149 case ".rtf": return "application/rtf"; 150 case ".html": 151 case ".htm": return "text/html"; 152 case ".xml": return "text/xml"; 153 case ".xsl": return "text/xsl"; 154 case ".css": return "text/css"; 155 case ".php": return "text/php"; 156 case ".asp": return "text/asp"; 157 case ".pdf": return "application/pdf"; 158 case ".png": return "image/png"; 159 case ".txt": return "text/plain"; 160 case ".log": return "text/plain"; 161 case ".wmv": return "video/x-ms-wmv"; 162 case ".sxc": return "application/vnd.sun.xml.calc"; 163 case ".odt": return "application/vnd.oasis.opendocument.text"; 164 case ".stc": return "application/vnd.sun.xml.calc.template"; 165 case ".sxd": return "application/vnd.sun.xml.draw"; 166 case ".std": return "application/vnd.sun.xml.draw.template"; 167 case ".sxi": return "application/vnd.sun.xml.impress"; 168 case ".sti": return "application/vnd.sun.xml.impress.template"; 169 case ".sxm": return "application/vnd.sun.xml.math"; 170 case ".sxw": return "application/vnd.sun.xml.writer"; 171 case ".sxq": return "application/vnd.sun.xml.writer.global"; 172 case ".stw": return "application/vnd.sun.xml.writer.template"; 173 case ".pps": return "application/vnd.ms-powerpoint"; 174 case ".odt": return "application/vnd.oasis.opendocument.text"; 175 case ".ott": return "application/vnd.oasis.opendocument.text-template"; 176 case ".oth": return "application/vnd.oasis.opendocument.text-web"; 177 case ".odm": return "application/vnd.oasis.opendocument.text-master"; 178 case ".odg": return "application/vnd.oasis.opendocument.graphics"; 179 case ".otg": return "application/vnd.oasis.opendocument.graphics-template"; 180 case ".odp": return "application/vnd.oasis.opendocument.presentation"; 181 case ".otp": return "application/vnd.oasis.opendocument.presentation-template"; 182 case ".ods": return "application/vnd.oasis.opendocument.spreadsheet"; 183 case ".ots": return "application/vnd.oasis.opendocument.spreadsheet-template"; 184 case ".odc": return "application/vnd.oasis.opendocument.chart"; 185 case ".odf": return "application/vnd.oasis.opendocument.formula"; 186 case ".odi": return "application/vnd.oasis.opendocument.image"; 187 case ".ndl": return "application/vnd.lotus-notes"; 188 case ".eml": return "text/plain"; 189 case ".ps" : return "application/postscript"; 190 default : return "application/octet-stream"; 227 191 } 228 192 } 193 194 $ContentType = guessContentType( $filename ); 229 195 } 230 196 } 231 197 232 233 /** 234 * Método que limpa o diretório 235 * 236 * @license http://www.gnu.org/copyleft/gpl.html GPL 237 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 238 * @sponsor Caixa Econômica Federal 239 * @param $dir 240 */ 241 function cleanup( $dir ) 242 { 198 header("Content-Type: $ContentType"); 199 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 200 header("Pragma: public"); 201 header("Expires: 0"); // set expiration time 202 header("Content-Disposition: $disposition"); 203 204 if( $fileContent ) 205 { 206 header("Content-transfer-encoding: ".$info["encoding"] ); 207 208 if( $image === "thumbnail" ) 209 { 210 $pic = imagecreatefromstring( $fileContent ); 211 212 if( $pic ) 213 { 214 $width = imagesx($pic); 215 $height = imagesy($pic); 216 217 if(!isset($photo)) 218 $photo = array( 'width' => 160, 'height' => max( ( 160 * $height / $width ), 1 ) ); 219 220 $thumb = imagecreatetruecolor( $photo['width'], $photo['height'] ); 221 222 if(array_key_exists('quality', $photo) && $photo['quality'] ) 223 imagecopyresampled($thumb, $pic, 0, 0, 0, 0, $photo['width'], $photo['height'], $width, $height); 224 else 225 imagecopyresized($thumb, $pic, 0, 0, 0, 0, $photo['width'], $photo['height'], $width, $height); # resize image into thumb 226 227 imagejpeg( $thumb,"", 100 ); # Thumbnail as JPEG 228 } 229 } 230 else 231 echo $fileContent; 232 } 233 else 234 { 235 /** 236 * Delete Diretorio 237 * @param string $dir 238 */ 239 function cleanup( $dir ) 240 { 243 241 if ( is_dir( $dir ) ) 244 242 { … … 260 258 } 261 259 262 } 263 //-----------------------// 264 265 /* 266 * Main 267 */ 268 269 270 if($msgNumber != 'null' && $indexPart !== null && $msgFolder) 271 { 272 273 $attachment = new attachment(PHPGW_INCLUDE_ROOT); 274 $attachment->setStructureFromMail($msgFolder, $msgNumber); 275 $fileContent = $attachment->getAttachment($indexPart); 276 277 if($newFilename) 278 $filename = $newFilename; 260 } 261 262 $tempDir = $GLOBALS['phpgw_info']['server']['download_temp_dir']; 263 264 if (preg_match("#^".$tempDir."/(".$GLOBALS['phpgw']->session->sessionid."/)*[A-z0-9_]+_".$GLOBALS['phpgw']->session->sessionid."[A-z0-9]*(\.[A-z]{3,4})?$#",$filename)) 265 { 266 session_write_close(); 267 set_time_limit(0); 268 ob_clean(); 269 flush(); 270 readfile($filename); 271 272 //removendo pelo php, garante a suportabilidade cross-platform 273 cleanup( $filename ); 274 275 } 279 276 else 280 277 { 281 $info = $attachment->getAttachmentInfo($indexPart); 282 $filename = $info['name']; 283 } 284 285 286 } 287 else 288 $filename = $indexFile; 289 290 291 $filename = $filename ? $filename : "attachment.bin"; 292 $newFilename = $newFilename ? $newFilename : $filename; 293 294 295 $strFileType = strrev(substr(strrev(strtolower($filename)),0,4)); 296 297 downloadFile($strFileType, $filename, $newFilename, $fileContent) 278 if (preg_match("#^".dirname( __FILE__ ) . '/../tmpLclAtt'."/source_#",$filename)) { 279 readfile($filename); 280 } 281 } 282 } 283 298 284 //-----------------------// 299 285 -
trunk/expressoMail1_2/inc/gotodownload.php
r4842 r5134 50 50 $newfilename = $newfilename ? $newfilename : $filename; 51 51 $strFileType = strrev(substr(strrev(strtolower($filename)),0,4)); 52 if(strpos($strFileType ,"." )===false)53 $strFileType = strrev(substr(strrev(strtolower($newfilename)),0,4));54 52 55 53 downloadFile($strFileType, $filename, $newfilename, $fileContent, $encoding); -
trunk/expressoMail1_2/inc/hook_settings.inc.php
r5083 r5134 19 19 * option) any later version. * 20 20 \**************************************************************************/ 21 21 //include_once("fckeditor.php"); 22 //include_once("class.functions.inc.php"); 22 23 $type = isset($_GET['type']) ? $_GET['type']:$GLOBALS['type']; // FIX ME 23 24 24 25 //if ($type == 'user' || $type == ''){ 26 global $prefs; 27 // create_select_box('Signature Type','',$default,'','','','onchange="javascript:changeType(this.value);"'); 25 28 create_script('function exibir_ocultar() 26 29 { 27 30 var type = ("'.$type.'" == "") ? "user" : "'.$type.'"; 28 var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; 31 var use_signature_digital_cripto = null; 32 33 if (document.all) 34 { 35 // is_ie 36 use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[1]; 37 } 38 else 39 { 40 // not_ie 41 use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; 42 } 43 29 44 var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'"; 30 45 … … 287 302 document.getElementById( "user_signature" + counter ).value = old_signature; 288 303 } 289 }'); 304 } 305 '); 290 306 //} 291 307 $default = false; 308 create_check_box('Do you want to show common name instead of UID?','uid2cn',$default, 309 'Do you want to show common name instead of UID?'); 310 create_check_box('Do you want to automatically display the message header?','show_head_msg_full',$default,''); 292 311 $default = array( 293 312 '25' => '25', … … 297 316 ); 298 317 299 // Cria nova opção nas preferências do ExpressoMail 318 create_select_box('What is the maximum number of messages per page?','max_email_per_page',$default,'This is the number of messages shown in your mailbox per page'); 319 300 320 create_check_box('View the user name in the header of the messages printed?', 'show_name_print_messages', 'Displays the user name in the header print email'); 301 321 302 create_select_box('What is the maximum number of messages per page?','max_email_per_page',$default,'This is the number of messages shown in your mailbox per page'); 322 //$default = 0; 323 create_check_box('Preview message text within subject column','preview_msg_subject','this exhibits a sample of message within the message subject column'); 324 325 //$default = 0; 326 create_check_box('Preview message text within a tool-tip box','preview_msg_tip','this exhibits a sample of message within a tool-tip box'); 327 328 create_check_box('View extended information about users','extended_info','This exhibits employeenumber and ou from LDAP in searchs'); 303 329 create_check_box('Save deleted messages in trash folder?','save_deleted_msg','When delete message, send it automatically to trash folder'); 304 330 $default = array( … … 310 336 ); 311 337 338 $arquived_messages = array(true => lang("Copy"), false => lang("Move")); 339 312 340 create_select_box('Delete trash messages after how many days?','delete_trash_messages_after_n_days',$default,'Delete automatically the messages in trash folder in how many days'); 313 341 create_check_box('Would you like to use local messages?','use_local_messages','Enabling this options you will be able to store messages in your local computer'); 314 create_check_box('Would you like to keep archived messages?','keep_archived_messages','After store email in your local computer delete it from server'); 342 create_select_box('Desired action to archive messages to local folders','keep_archived_messages',$arquived_messages,'After store email in your local computer delete it from server'); 343 create_check_box('Automaticaly create Default local folders?','auto_create_local','Enable this option if you want to automaticaly create the Inbox, Draft, Trash and Sent folders'); 315 344 create_check_box('Show previous message, after delete actual message?','delete_and_show_previous_message','Enable this option if you want to read the next message everytime you delete a message'); 316 345 create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed'); … … 318 347 create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages'); 319 348 create_check_box('Do you want to use important flag in email editor?','use_important_flag','It allow you to send emails with important flag, but you can receive unwanted messages with important flag'); 320 349 create_check_box('Do you want to use SpellChecker in email editor?','use_SpellChecker','It allow you to check the spelling of your emails'); 321 350 //Use user folders from email 351 352 require_once('class.imap_functions.inc.php'); 353 $boemailadmin = CreateObject('emailadmin.bo'); 354 $emailadmin_profile = $boemailadmin->getProfileList(); 355 $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); 356 $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; 357 $e_server = $_SESSION['phpgw_info']['expressomail']['email_server']; 358 $imap = CreateObject('expressoMail1_2.imap_functions'); 359 322 360 if ($type != "" && $type != "user"){ 361 323 362 $trash = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']; 324 363 $drafts = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; … … 328 367 $default = Array( 329 368 'INBOX' => lang('INBOX'), 330 'INBOX' .$delimiter.$trash => $trash,331 'INBOX' .$delimiter.$drafts => $drafts,332 'INBOX' .$delimiter.$spam => $spam,333 'INBOX' .$delimiter.$sent => $sent369 'INBOX' . $imap->imap_delimiter . $drafts => lang($drafts), 370 'INBOX' . $imap->imap_delimiter . $spam => lang($spam), 371 'INBOX' . $imap->imap_delimiter . $trash => lang($trash), 372 'INBOX' . $imap->imap_delimiter . $sent => lang($sent) 334 373 ); 335 374 } 336 375 else 337 376 { 338 require_once('class.imap_functions.inc.php');339 $boemailadmin = CreateObject('emailadmin.bo');340 $emailadmin_profile = $boemailadmin->getProfileList();341 $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);342 $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];343 $e_server = $_SESSION['phpgw_info']['expressomail']['email_server'];344 $imap = CreateObject('expressoMail1_2.imap_functions');345 377 $save_in_folder_selected = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']; 346 378 … … 378 410 } 379 411 create_select_box('Save sent messages in folder','save_in_folder',$default,'Save automatically sent messages in selected folder'); 412 create_check_box('Show TO: in place of FROM: only in Automatic SEND folder','from_to_sent','Show TO: in place of FROM: only in Automatic SEND folder'); 413 414 380 415 create_check_box('Hide menu folders?','hide_folders','You can use it if your screen does not have good resolution'); 416 417 418 $default = array( 419 '50' => '50', 420 '100' => '100', 421 '150' => '150', 422 '200' => '200', 423 '300' => '300', 424 '400' => '400', 425 '65536' => lang('unlimited') 426 ); 427 428 create_select_box('What is the maximum number of results in an e-mail search?','search_result_number',$default,''); 381 429 382 430 $default = array( … … 390 438 create_select_box('What is the minimum number of characters in searching contacts?','search_characters_number',$default,'what is the minimum number of characters in searching contacts'); 391 439 392 $default = array( 440 $default = array( 393 441 '20' => lang('normal'), 394 442 '30' => lang('medium'), 395 443 '40' => lang('big') 396 ); 444 ); 445 397 446 398 447 create_select_box('What is the height of the lines in the list of messages?','line_height',$default,''); 448 create_check_box('Increases th maximum size of show messages?','max_msg_size','Increases the maximum size of show emails from 100kb to 1mb'); 399 449 create_check_box('Use dynamic contacts?','use_dynamic_contacts','Store your\'s most used contacts'); 400 create_check_box('Use shortcuts?','use_shortcuts',' ');450 create_check_box('Use shortcuts?','use_shortcuts','n key (Open new message)<br>ESC key (Close tab)<br>i key (print)<br>e key (forward)<br>r key (reply)<br>DELETE key (delete the current message)<br>Ctrl + up (go to previous message)<br>Ctrl + down (go to next message)<br>Shift + up or down (select multiple messages)<br>F9 key (search at catalog)<br>'); 401 451 create_check_box('Auto save draft','auto_save_draft','When you are away from computer it saves automatically the message you are writing'); 452 create_check_box('Send messages with return recipient option by default','return_recipient_deafault','With this option every new email will get the return recipient option marked'); 453 454 unset($default); 455 $functions = new functions(); 456 $zones = $functions->getTimezones(); 457 $default = array(sprintf("%s", array_search('America/Sao_Paulo', $zones)) => 'America/Sao_Paulo'); 458 create_select_box('What is your timezone?', 'timezone', $zones, 'The Timezone you\'re in.', $default); 459 460 $default = array( 461 '1' => lang('contacts'), 462 '2' => lang('email') 463 ); 464 465 create_select_box('Where should the quick search be performed by default?','quick_search_default',$default,'It is where the keyword should be searched when the user executes a quick search.'); 466 402 467 $default = array( 403 468 '65536' => lang('unlimited'), … … 416 481 'personal' => lang("Personal catalog"), 417 482 'all' => lang("All catalogs") 418 ); 419 420 create_select_box('The dynamic search will use the catalog','catalog_search',$default,'Seleciona o catálogo que será usado para fazer a busca'); 421 483 ); 484 485 create_select_box('The dynamic search will use the catalog','catalog_search',$default,'Seleciona o catálogo que será usado para fazer a busca'); 486 $default = false; 487 create_check_box('Display default fields on the quick search screen?','default_fields_quick_search', $default, 'Mostrar o nome, email e telefone do contato por padrão'); 422 488 423 489 … … 441 507 'html' => lang('rich text') 442 508 ); 509 create_check_box('Auto close the first tab on reaching the maximum number of tabs?','auto_close_first_tab',''); 443 510 create_check_box('Insert signature automatically in new messages?','use_signature',''); 444 511 512 $default = array('0' => lang('nested in the same tab of the main message'), '1' => lang('in your own tab, one for each attached message')); 513 create_select_box('Nested messages are shown','nested_messages_are_shown', $default,'How to show nested messages'); 514 515 $default = array( 516 'Arial' => 'Arial', 517 'Verdana' => 'Verdana', 518 'Times new roman' => 'Times New Roman', 519 'Tahoma' => 'Tahoma', 520 ); 521 create_select_box( 'Default font editor' , 'font_family_editor' , $default ); 522 523 $default = array( 524 '8pt' => '8', 525 '9pt' => '9', 526 '10pt' => '10', 527 '11pt' => '11', 528 '12pt' => '12', 529 '14pt' => '14', 530 '16pt' => '16', 531 '18pt' => '18', 532 '20pt' => '20', 533 '22pt' => '22', 534 '24pt' => '24', 535 '26pt' => '26', 536 '28pt' => '28', 537 '36pt' => '36', 538 '48pt' => '48', 539 '72pt' => '72', 540 ); 541 542 create_select_box( 'Default font size editor' , 'font_size_editor' , $default ); 543 445 544 if ($type == 'user' || $type == ''){ 446 447 global $prefs;448 // create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);"');449 450 545 $vars = $GLOBALS['phpgw']->preferences->user['expressoMail']; 451 546 452 create_html_code("signature","<script src='../library/jquery/jquery.js' language='javascript'></script> 547 548 create_html_code("signature","<script src='../library/jquery/jquery.js' language='javascript'></script> 453 549 <script src='../library/ckeditor/ckeditor.js' language='javascript'></script> 454 550 <script src='../library/ckeditor/adapters/jquery.js' language='javascript'></script> 551 455 552 <input type='hidden' id='counter' value='0'> 456 553 <input type='hidden' id='signatures' name='user[signatures]' value='". $vars['signatures']."'> 457 554 <input type='hidden' id='signature_default' name='user[signature_default]' value='".$vars['signature_default']."'> 458 <input type='hidden' id='type_signature' name='user[type_signature]' value='".$vars['type_signature']."'>459 555 <input type='hidden' id='signature' name='user[signature]' value='","' > 460 556 <input type='hidden' id='signature_types' name='user[signature_types]' value='".$vars['signature_types']."'> … … 503 599 504 600 document.getElementById( 'counter' ).value = ++counter; 505 601 } 506 602 507 603 function removeSignature( el ) … … 513 609 514 610 return( false ); 515 611 } 516 612 </script> 517 613 <input id='add_signature' type='button' onclick='addSignature();' value='Adicionar Assinatura'> 518 614 "); 519 }else{520 create_select_box('Signature Type','type_signature',$default,'','','','');521 522 615 } 523 616 ?> -
trunk/expressoMail1_2/index.php
r5083 r5134 20 20 <script src='../library/ckeditor/ckeditor.js' language='javascript'></script> 21 21 <script src='../library/ckeditor/adapters/jquery.js' language='javascript'></script> 22 <script src='js/rich_text_editor.js' type='text/javascript'></script>"; 22 <script src='js/rich_text_editor.js' type='text/javascript'></script> 23 <script src='js/base64.js' type='text/javascript'></script>"; 23 24 //---------------------------// 24 25 echo '<link href="js/lert/lert.css" rel="stylesheet" type="text/css"/>'; … … 26 27 echo "<script src='js/globals.js?".$update_version."' type='text/javascript'></script>"; 27 28 echo "<script src='js/sniff_browser.js?".$update_version."' type='text/javascript'></script>"; 29 echo "<script src='js/QuickCatalogSearch.js' type='text/javascript'></script>"; 28 30 echo "<style type='text/css'>@import url(../phpgwapi/js/jscalendar/calendar-win2k-1.css);</style>"; 29 31 echo "<script src='../phpgwapi/js/jscalendar/calendar.js?".$update_version."' type='text/javascript'></script>"; … … 33 35 <script type="text/javascript" src="../phpgwapi/js/dJSWin/dJSWin.js?'.$update_version.'"></script>'; 34 36 37 echo ' 38 <script type="text/javascript" src="../prototype/app/plugins/view/jquerymx-1.0.custom.min.js"></script> 39 <script type="text/javascript" src="../prototype/app/plugins/treeview/jquery.treeview.js"></script> 40 <script type="text/javascript" src="../prototype/app/plugins/block/jquery.blockUI.js"></script> 41 42 <link rel="stylesheet" href="../prototype/app/plugins/treeview/jquery.treeview.css" type="text/css" media="screen" /> 43 <script src="../prototype/app/plugins/jqgrid/js/i18n/grid.locale-pt-br.js" type="text/javascript"></script> 44 <script src="../prototype/app/plugins/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script> 45 <link rel="stylesheet" href="../prototype/app/plugins/jqgrid/css/ui.jqgrid.css" type="text/css" /> 46 <link rel="stylesheet" href="../prototype/app/plugins/jqgrid/themes/prognusone/jquery-ui-1.8.2.custom.css" type="text/css" /> 47 48 <script src="../prototype/app/plugins/countdown/jquery.countdown.min.js" type="text/javascript"></script> 49 <script src="../prototype/app/plugins/countdown/jquery.countdown-pt-BR.js" type="text/javascript"></script> 50 '; 35 51 36 52 /* 37 * TODO: implementar o controle como prefer ência do usuário53 * TODO: implementar o controle como preferência do usuário 38 54 * 39 55 */ 40 56 $jcarousel = false; 41 57 if ($jcarousel) { 42 //jquery43 echo "\n".'<script src="../library/jquery/jquery-1.6.1.min.js" type="text/javascript"></script>';44 58 //jcarousel 59 echo "\n".'<link rel="stylesheet" type="text/css" href="../library/jcarousel/skins/default/skin.css" />'; 45 60 echo "\n".'<script src="../library/jcarousel/lib/jquery.jcarousel.min.js" type="text/javascript"></script>'; 46 echo "\n".'<link rel="stylesheet" type="text/css" href="../library/jcarousel/skins/default/skin.css" />'; 61 47 62 //fancybox 63 echo "\n".'<link rel="stylesheet" type="text/css" href="../library/fancybox/jquery.fancybox-1.3.4.css" />'; 48 64 echo "\n".'<script src="../library/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>'; 49 echo "\n".'<script src="../library/fancybox/jquery.easing-1.4.pack.js" type="text/javascript"></script>'; 50 echo "\n".'<script src="../library/fancybox/jquery.mousewheel-3.0.4.pack.js" type="text/javascript"></script>'; 51 echo "\n".'<link rel="stylesheet" type="text/css" href="../library/fancybox/jquery.fancybox-1.3.4.css" />'; 52 } 65 } 66 67 echo "<div id='overlay' style='background-color: #AAAAAAA; opacity: .50; filter:Alpha(Opacity=50); height: 100%; width: 100%; position: absolute; top: 0; left: 0; visibility: hidden; z-index: 30000000000000000000000'></div>"; 53 68 54 69 … … 83 98 $current_config = $c->config_data; 84 99 100 //Carrega Configuração global do expressoMail 101 $_SESSION['phpgw_info']['expresso']['expressoMail'] = $current_config; 102 85 103 $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); 86 104 // $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; … … 114 132 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['keep_after_auto_archiving'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_after_auto_archiving'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_after_auto_archiving'] : "0"; 115 133 116 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size'] = $current_config['expressoMail_Max_attachment_size'] ? $current_config['expressoMail_Max_attachment_size']."M" : ini_get('upload_max_filesize');134 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size'] = $current_config['expressoMail_Max_attachment_size'] ? $current_config['expressoMail_Max_attachment_size']."M" : ''; 117 135 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_msg_size'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_msg_size'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['max_msg_size'] : "0"; 118 136 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['imap_max_folders'] = $current_config['expressoMail_imap_max_folders']; -
trunk/expressoMail1_2/js/DropDownContacts.js
r4304 r5134 79 79 var REG_EXP = /^[^\#|^\$|^\%|^\!|^\?|^\"|^\']+$/; 80 80 var match_cont = ""; 81 for (var i=0; i<match_contacts.length; i++) 81 var limit_index; 82 83 match_contacts.length > 30? limit_index = 30 : limit_index = match_contacts.length; 84 85 for (var i=0; i<limit_index; i++) 82 86 { 83 87 match_contacts[i] = unescape(match_contacts[i]); … … 95 99 } 96 100 97 98 if (document.getElementById('tipDiv')){ 99 document.getElementById('tipDiv').focus(); 100 } 101 101 //Removido pois retirava o focus no ie a cada letra digitada 102 //if (document.getElementById('tipDiv')){ 103 // document.getElementById('tipDiv').focus(); 104 //} 102 105 103 106 // treat especials keys -
trunk/expressoMail1_2/js/QuickCatalogSearch.js
r5075 r5134 7 7 } 8 8 9 /* showlist */ 9 10 emQuickCatalogSearch.prototype.showList = function(data, begin, end, ID, field) 10 11 { … … 16 17 17 18 keypress_read(data); 18 init_results(data);19 19 configure_slider(data); 20 create_list(data, true); 20 21 details_results(data); 21 22 22 connector.loadScript("ccQuickAdd");23 24 if(preferences.use_shortcuts == '0'){25 connector.loadScript("shortcut");26 }27 28 23 id = '1'; 29 24 _this = this; … … 46 41 47 42 48 function keypress_read(data) 49 { 50 $("#dialog-modal").keypress(function (e) 51 { 52 var keyCode = e.keyCode || e.which, 53 arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13, esc: 27 }; 43 /* Leitura das teclas de atalho */ 44 function keypress_read(data) { 45 $("#dialog-modal").keydown(function (e) { 46 var keyCode = e.keyCode; 47 arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13, esc: 27}; 54 48 var slider = $( "#slider" ); 55 49 switch (keyCode) 56 50 { 57 51 case arrow.enter: 58 add_contact_field(document.getElementsByClassName("ui-selected")[0].getElementsByClassName("name_contact")[0].innerHTML); 52 if(!search_focus){ 53 i = $(".ui-selected:last").attr("value") + 1; 54 add_contact_field($("#contact_" + i).html()); 55 document.getElementById("busca").value = ""; 56 $("#dialog-modal").unbind('keydown'); 59 57 $("#dialog-modal").dialog("close"); 58 } 60 59 break; 61 62 60 case arrow.left: 63 slider.slider( 64 create_list(data_ );61 slider.slider("value", $( "#slider" ).slider( "value" ) - 1); 62 create_list(data_, false); 65 63 break; 66 67 64 case arrow.right: 68 if( (($( "#slider" ).slider( "value" ))) == Math.ceil(data_.length/7) ) 69 { 70 alert("Não há mais páginas"); 65 if((($( "#slider" ).slider( "value" ))) == Math.ceil(data_.length/6)) 71 66 break; 72 }73 67 slider.slider( "value", $( "#slider" ).slider( "value" ) + 1); 74 create_list(data_ );68 create_list(data_, false); 75 69 break; 76 77 70 case arrow.up: 78 id_contact = document.getElementsByClassName("ui-selected")[0].value; 79 if(id_contact == (($( "#slider" ).slider( "value" ) -1)*7)) 71 show_detail(data_, "up"); 72 break; 73 case arrow.down: 74 show_detail(data_, "down"); 80 75 break; 81 var line_contact = $('li.ui-selected');82 $('li.ui-selected').prev().removeClass("ui-selectee").addClass("ui-selected"); //css('background-color', '#72A9D3');83 line_contact.removeClass("ui-selected").addClass("ui-selectee");84 var details = $("#detalhes_contato").empty();85 $( ".ui-selected", this ).each(function() {86 if(data_['type_catalog'] == 'G')87 {88 var extra_fields = (data_['extra_ldap_fields']).split("#");89 /* Default fields */90 details.append("<strong>" + utf8_decoder(data_[this.value].cn[0]));91 details.append("<br />" + data_[this.value].mail[0]);92 details.append("<br /><br /><strong>Matrícula<br />");93 details.append(data_[this.value].employeenumber[0] + "<br />");94 details.append("<br /><strong> Telefone <br />");95 details.append(data_[this.value].telephonenumber[0] + "<br />");96 details.append(data_[this.value].telephonenumber[0]);97 for (var i=0; i<extra_fields.length-1; i++)98 {99 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1);100 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|")));101 if(data_[this.value][valor] != undefined)102 {103 details.append("<br /><br /><strong>" + campo);104 details.append("<br />" + data_[this.value][valor][0]);105 }106 76 } 77 }); 107 78 } 108 else 109 { 110 if(data_['type_catalog'] == 'P') 111 112 /* Default fields */ 113 details.append("<strong>" + utf8_decoder(data_[this.value].cn)); 114 details.append("<br />" + data_[this.value].mail); 115 if(data_[this.value].telephonenumber != "") 116 { 117 details.append("<br /><br /><br /><strong> Telefone <br />"); 118 details.append(data_[this.value].telephonenumber + "<br />"); 79 80 81 /* Mostra os detalhes do contato selecionado */ 82 function show_detail(data_, direction) { 83 id_contact = $(".ui-selected:last").attr("value"); 84 if(direction == "down") { 85 if((id_contact == (((((parseInt($( "#slider" ).slider( "value" )) - 1)*6))+6)-1)) || id_contact == data_.length - 1 || data_.length == 1) 86 return; 87 var line_contact = $('li.ui-selected'); 88 $('li.ui-selected').next().addClass("ui-selected"); 89 id_contact++; 119 90 } 91 else { 92 if(id_contact == (($( "#slider" ).slider( "value" ) -1)*6)) 93 return; 94 var line_contact = $('li.ui-selected'); 95 $('li.ui-selected').prev().addClass("ui-selected"); 96 id_contact--; 120 97 } 121 else 122 { 98 line_contact.removeClass("ui-selected").addClass("ui-selectee"); 99 var details = $("#detalhes_contato").empty(); 100 switch(data_['type_catalog']) { 101 case 'G': 123 102 var extra_fields = (data_['extra_ldap_fields']).split("#"); 124 /* Default fields */ 125 details.append("<strong>" + utf8_decoder(data_[this.value].cn)); 126 details.append("<br />" + data_[this.value].mail); 127 if(data_[this.value].telephonenumber != "") 128 { 129 details.append("<br /><br /><br /><strong> Telefone <br />"); 130 details.append(data_[this.value].telephonenumber + "<br />"); 103 if(preferences.default_fields_quick_search != 0) { 104 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn[0]) + "</label>" + '<span class="value">' + data_[id_contact].mail[0] + '</span></p>'); 105 details.append('<p><label class="attribute">Telefone </label>' + '<span class="value">' + data_[id_contact].telephonenumber[0] + '</span></p>'); 131 106 } 132 if(data_[this.value].mail[0].length > 1) 133 { 134 for (var i=0; i<extra_fields.length-1; i++) 107 for (var i=0; i<=extra_fields.length-1; i++) 135 108 { 136 109 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 137 110 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 138 if(data_[this.value][valor] != undefined) 139 { 140 details.append("<br /><br /><strong>" + campo); 141 details.append("<br />" + data_[this.value][valor][0]); 111 if(data_[id_contact][valor.toLowerCase()] != undefined) { 112 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 113 for(j=0; j<data_[id_contact][valor.toLowerCase()].length; j++) { 114 details.append(tmp_campo + '<span class="value">' + data_[id_contact][valor.toLowerCase()][j] + "</span></p>"); 115 tmp_campo = ""; 116 } 117 } 118 } 119 break; 120 case 'P': 121 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn) + '</label>' + '<span class="value">' + data_[id_contact].mail + '</span></p>'); 122 if(data_[id_contact].telephonenumber != null) 123 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data_[id_contact].telephonenumber + '</span></p>'); 124 break; 125 default: 126 var extra_fields = (data_['extra_ldap_fields']).split("#"); 127 if(preferences.default_fields_quick_search != 0 || data_[id_contact].type_contact == "P") { 128 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn) + '</label>' + '<span class="value">' + data_[id_contact].mail + '</span></p>'); 129 if(data_[id_contact].telephonenumber != null) 130 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data_[id_contact].telephonenumber + '</span></p>'); 131 } 132 if(data_[id_contact].mail[0].length > 1) { 133 for (var i=0; i<=extra_fields.length-1; i++) { 134 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 135 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 136 if(data_[id_contact][valor.toLowerCase()] != undefined) { 137 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 138 for(j=0; j<data_[id_contact][valor.toLowerCase()].length; j++) { 139 details.append(tmp_campo + '<span class="value">' + data_[id_contact][valor.toLowerCase()][j] + "</span></p>"); 140 tmp_campo = ""; 142 141 } 143 142 } 144 143 } 145 144 } 146 }147 });148 break;149 150 case arrow.down:151 id_contact = document.getElementsByClassName("ui-selected")[0].value;152 if((id_contact == (((((parseInt($( "#slider" ).slider( "value" )) - 1)*7))+7)-1)) || id_contact == data_.length - 2 || data_.length == 1)153 break;154 var line_contact = $('li.ui-selected');155 $('li.ui-selected').next().removeClass("ui-selectee").addClass("ui-selected");156 line_contact.removeClass("ui-selected").addClass("ui-selectee");157 var details = $("#detalhes_contato").empty();158 $( ".ui-selected", this ).each(function() {159 if(data_['type_catalog'] == 'G')160 {161 var extra_fields = (data_['extra_ldap_fields']).split("#");162 /* Default fields */163 details.append("<strong>" + utf8_decoder(data_[this.value].cn[0]));164 details.append("<br />" + data_[this.value].mail[0]);165 details.append("<br /><br /><strong>Matrícula<br />");166 details.append(data_[this.value].employeenumber[0] + "<br />");167 details.append("<br /><strong> Telefone <br />");168 details.append(data_[this.value].telephonenumber[0] + "<br />");169 details.append(data_[this.value].telephonenumber[0]);170 for (var i=0; i<extra_fields.length-1; i++)171 {172 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1);173 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|")));174 if(data_[this.value][valor] != undefined)175 {176 details.append("<br /><br /><strong>" + campo);177 details.append("<br />" + data_[this.value][valor][0]);178 }179 }180 }181 else182 {183 if(data_['type_catalog'] == 'P')184 {185 /* Default fields */186 details.append("<strong>" + utf8_decoder(data_[this.value].cn));187 details.append("<br />" + data_[this.value].mail);188 if(data_[this.value].telephonenumber != "")189 {190 details.append("<br /><br /><br /><strong> Telefone <br />");191 details.append(data_[this.value].telephonenumber + "<br />");192 }193 }194 else195 {196 var extra_fields = (data_['extra_ldap_fields']).split("#");197 /* Default fields */198 details.append("<strong>" + utf8_decoder(data_[this.value].cn));199 details.append("<br />" + data_[this.value].mail);200 if(data_[this.value].telephonenumber != "")201 {202 details.append("<br /><br /><br /><strong> Telefone <br />");203 details.append(data_[this.value].telephonenumber + "<br />");204 }205 if(data_[this.value].mail[0].length > 1)206 {207 for (var i=0; i<extra_fields.length-1; i++)208 {209 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1);210 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|")));211 if(data_[this.value][valor] != undefined)212 {213 details.append("<br /><br /><strong>" + campo);214 details.append("<br />" + data_[this.value][valor][0]);215 }216 }217 }218 }219 }220 });221 145 break; 222 146 } 223 });224 147 } 225 148 … … 229 152 * Método que cria a lista de contatos 230 153 */ 231 function create_list(data) 232 { 154 function create_list(data, begin, uiValue) { 155 var sliderValue = 1; 156 if(typeof($( "#slider" ).slider( "value" )) != "object") 157 sliderValue = $( "#slider" ).slider( "value" ); 158 if(uiValue) 159 sliderValue = uiValue; 233 160 $("#detalhes_contato").empty(); 234 var paginas = Math.ceil(data.length/7) - 1;161 var paginas = Math.ceil(data.length/6); 235 162 $("#title_usuarios").html( get_lang("Results") ); 236 var string_results = $( "#slider" ).slider( "value" ) + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")";237 163 var selectable = $("#selectable"); 238 164 selectable.empty(); 239 165 var Ul = document.createElement("ul"); 166 for (i=((sliderValue -1)*6)+1; i<(((sliderValue -1)*6)+1)+6; i++) { 240 167 var Op = document.createElement("li"); 241 for (i=(($( "#slider" ).slider( "value" ) -1)*7)+1; i<((($( "#slider" ).slider( "value" ) -1)*7)+1)+7; i++) 242 { 243 if(i >= data.length) 168 if(i > data.length) 244 169 break; 245 170 if (data['type_catalog'] != 'G' && (data[i-1].mail == null || data[i-1].mail == "")) 246 171 data[i-1].mail = "No mail"; 247 if(i == ((($( "#slider" ).slider( "value" ) -1)*7)+1)){ 172 173 if(i == (((sliderValue -1)*6)+1)) { 248 174 Op.setAttribute("class", "ui-selected"); 175 Op.setAttribute("className", "ui-selected"); 249 176 } 250 177 else { 251 178 Op.setAttribute("class", "ui-selectee"); 179 Op.setAttribute("className", "ui-selectee"); 252 180 } 253 181 var contact_name = utf8_decoder(data[i-1].cn); 254 if(contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) != -1)182 if(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) != -1 && data.search_for.indexOf(" ") == -1 && data.search_for.indexOf("@") == -1) 255 183 contact_name = contact_name.substring(0, contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) + "<u>" + contact_name.substr(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()), data.search_for.length) + "</u>" + contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) + data.search_for.length); 256 Op.innerHTML = '<span style="float:right; left:335px; position: absolute; z-index: 100; background-color: #EEE; padding:0"><button onClick="add_contact_field(contact_' + i + '.innerHTML)">+</button><button onClick="remove_contact_field(contact_' + i + '.innerHTML)">x</button></span><div id=contact_' + i + 'onDblClick="add_contact_field(this.innerHTML)"><div class="name_contact"><strong>' + contact_name + '</strong><em>' + utf8_decoder(data[i-1].mail) + '</em></div></div>';184 Op.innerHTML = '<span class="menu-control"><button onClick="add_contact_field(document.getElementById(\'contact_' + i + '\').innerHTML)">+</button><button onClick="remove_contact_field(document.getElementById(\'contact_' + i + '\').innerHTML)">x</button></span><div id="contact_' + i + '" onDblClick="add_contact_field(this.innerHTML)"><div class="name_contact"><strong>' + contact_name + '</strong><em>' + utf8_decoder(data[i-1].mail) + '</em></div></div>'; 257 185 $(Op).val(i - 1); 258 Ul.appendChild(Op); 259 selectable.append(Ul.innerHTML); 186 selectable.append(Op); 260 187 } 261 $( "#amount" ).val( string_results ); 262 $( "#amount" ).val( $( "#slider" ).slider( "value" ) + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"); 263 document.getElementById("amount").focus(); 188 selectable.append(Ul); 189 var first_contact; 190 begin ? first_contact = 0 : first_contact = ((sliderValue* 6) -6); 191 if(first_contact == 0) { 192 $(document).ready(function(){ 193 $('#combobox option').each(function(){ 194 if($(this).val() == preferences.catalog_search){ 195 $(this).attr('selected',true); 196 } 197 }); 198 }); 199 } 200 var details = $("#detalhes_contato").empty(); 201 switch (data['type_catalog']) { 202 case 'G': 203 var extra_fields = (data['extra_ldap_fields']).split("#"); 204 if(preferences.default_fields_quick_search != 0) { 205 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn[0]) + "</label>" + '<span class="value">' + data[first_contact].mail[0] + "</span></p>"); 206 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber[0] + '</span></p>'); 207 } 208 for (var i=0; i<=extra_fields.length-1; i++) { 209 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 210 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 211 if(data[0][valor.toLowerCase()] != undefined) 212 { 213 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 214 for(j=0; j<data[first_contact][valor.toLowerCase()].length; j++) { 215 details.append(tmp_campo + '<span class="value">' + data[first_contact][valor.toLowerCase()][j] + "</span></p>"); 216 tmp_campo = ""; 217 } 218 } 219 } 220 break; 221 case 'P': 222 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn) + '</label>' + '<span class="value">' + data[first_contact].mail + '</span></p>'); 223 if(data[first_contact].telephonenumber != null) 224 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber + '</span></p>'); 225 break; 226 default: 227 var extra_fields = (data['extra_ldap_fields']).split("#"); 228 if(preferences.default_fields_quick_search != 0 || data[first_contact].type_contact == "P") { 229 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn) + "</label>" + '<span class="value">' + data[first_contact].mail + "</span></p>"); 230 if(data[first_contact].telephonenumber != null) 231 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber + "</span></p>"); 232 } 233 if(data[first_contact].mail != "No mail") { 234 if(data[first_contact].mail[0].length > 1) { 235 for (var i=0; i<=extra_fields.length-1; i++) { 236 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 237 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 238 if(data[first_contact][valor.toLowerCase()] != undefined) { 239 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 240 for(j=0; j<data[first_contact][valor.toLowerCase()].length; j++) { 241 details.append(tmp_campo + '<span class="value">' + data[first_contact][valor.toLowerCase()][j] + "</span></p>"); 242 tmp_campo = ""; 243 } 244 } 245 } 246 } 247 } 248 break; 249 } 250 var string_results = sliderValue + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"; 251 $( "#amount-text" ).val( string_results ); 252 $("button").button(); 253 if(!is_ie) 254 document.getElementById("amount-text").focus(); 255 $("#selectable li:first button:first").focus(); 256 removeFocus(); 264 257 } 265 258 266 259 267 268 269 270 271 function details_results(data) 272 { 260 /* Método que configura os detalhes do resultado da busca */ 261 function details_results(data) { 273 262 $(function() { 274 263 $( "#selectable" ).selectable({ … … 276 265 var details = $("#detalhes_contato").empty(); 277 266 $( ".ui-selected", this ).each(function() { 278 if(data['type_catalog'] == 'G')279 { 267 switch(data['type_catalog']) { 268 case 'G': 280 269 var extra_fields = (data['extra_ldap_fields']).split("#"); 281 /* Default fields */ 282 details.append("<strong>" + utf8_decoder(data[this.value].cn[0])); 283 details.append("<br />" + data[this.value].mail[0]); 284 details.append("<br /><br /><strong>Matrícula<br />"); 285 details.append(data[this.value].employeenumber[0] + "<br />"); 286 details.append("<br /><strong> Telefone <br />"); 287 details.append(data[this.value].telephonenumber[0] + "<br />"); 288 details.append(data[this.value].telephonenumber[0]); 289 for (var i=0; i<extra_fields.length-1; i++) 290 { 270 if(preferences.default_fields_quick_search != 0) { 271 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn[0]) + "</label>" + '<span class="value">' + data[this.value].mail[0] + "</span></p>"); 272 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber[0] + "</span></p>"); 273 } 274 for (var i=0; i<=extra_fields.length-1; i++) { 291 275 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 292 276 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 293 if(data[this.value][valor] != undefined) 294 { 295 details.append("<br /><br /><strong>" + campo); 296 details.append("<br />" + data[this.value][valor][0]); 277 if(data[this.value][valor.toLowerCase()] != undefined) { 278 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 279 for(j=0; j<data[this.value][valor.toLowerCase()].length; j++) { 280 details.append(tmp_campo + '<span class="value">' + data[this.value][valor.toLowerCase()][j] + "</span></p>"); 281 tmp_campo = ""; 297 282 } 298 283 } 299 284 } 300 else 301 { 302 if(data['type_catalog'] == 'P') 303 { 304 /* Default fields */ 305 details.append("<strong>" + utf8_decoder(data[this.value].cn)); 306 details.append("<br />" + data[this.value].mail); 307 if(data[this.value].telephonenumber != "") 308 { 309 details.append("<br /><br /><br /><strong> Telefone <br />"); 310 details.append(data[this.value].telephonenumber + "<br />"); 311 } 312 } 313 else 314 { 285 break; 286 case 'P': 287 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn) + "</label>" + '<span class="value">' + data[this.value].mail + "</span></p>"); 288 if(data[this.value].telephonenumber != null) 289 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber + "</span></p>"); 290 break; 291 default: 315 292 var extra_fields = (data['extra_ldap_fields']).split("#"); 316 /* Default fields */ 317 details.append("<strong>" + utf8_decoder(data[this.value].cn)); 318 details.append("<br />" + data[this.value].mail); 319 if(data[this.value].telephonenumber != "") 320 { 321 details.append("<br /><br /><br /><strong> Telefone <br />"); 322 details.append(data[this.value].telephonenumber + "<br />"); 293 if(preferences.default_fields_quick_search != 0 || data[this.value].type_contact == "P") { 294 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn) + "</label>" + '<span class="value">' + data[this.value].mail + "</span></p>"); 295 if(data[this.value].telephonenumber != null) 296 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber + "</span></p>"); 323 297 } 324 if(data[this.value].mail[0].length > 1) 325 { 326 for (var i=0; i<extra_fields.length-1; i++) 327 { 298 if(data[this.value].mail[0].length > 1) { 299 for (var i=0; i<=extra_fields.length-1; i++) { 328 300 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 329 301 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 330 if(data[this.value][valor] != undefined) 331 { 332 details.append("<br /><br /><strong>" + campo); 333 details.append("<br />" + data[this.value][valor][0]); 302 if(data[this.value][valor.toLowerCase()] != undefined) { 303 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 304 for(j=0; j<data[this.value][valor.toLowerCase()].length; j++) { 305 details.append(tmp_campo + '<span class="value">' + data[this.value][valor.toLowerCase()][j] + "</span></p>"); 306 tmp_campo = ""; 334 307 } 335 308 } 336 309 } 337 310 } 311 break; 338 312 } 339 313 }); … … 345 319 346 320 /* 347 * Método que inicializa a tela de contatos348 */349 function init_results(data)350 {351 var Op = null;352 var Ul = null;353 var selectable = $("#selectable");354 selectable.empty();355 Ul = document.createElement("ul");356 Op = document.createElement("li");357 var limit = data.length < 7 ? data.length : 7;358 for (i=1; i<=limit; i++)359 {360 Op.setAttribute("class", "ui-selectee");361 if(i == 1)362 Op.setAttribute("class", "ui-selected");363 var contact_name = utf8_decoder(data[i-1].cn);364 if(data['type_catalog'] != 'G' && (data[i-1].mail == null || data[i-1].mail == ""))365 {366 data[i-1].mail = "No mail";367 }368 369 if(contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) != -1)370 contact_name = contact_name.substring(0, contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) + "<u>" + contact_name.substr(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()), data.search_for.length) + "</u>" + contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) + data.search_for.length);371 Op.innerHTML = '<span style="float:right; left:335px; position: absolute; z-index: 100; background-color: #EEE; padding:0"><button onClick="add_contact_field(contact_' + i + '.innerHTML)">+</button><button onClick="remove_contact_field(contact_' + i + '.innerHTML)">x</button></span><div class="id_contact_field" id=contact_' + i + ' onDblClick="add_contact_field(this.innerHTML)"><div class="name_contact"><strong>' + contact_name + '</strong><em>' + utf8_decoder(data[i-1].mail) + '</em></div></div>';372 $(Op).val(i - 1);373 Ul.appendChild(Op);374 selectable.append(Ul.innerHTML);375 }376 $("#adds").html("Foram adicionados " + quantidade_contatos + " contatos.");377 }378 379 380 /*381 321 * Método que configura o slider e os resultados 382 322 */ 383 function configure_slider(data) 384 { 385 $("#detalhes_contato").empty(); 386 var paginas = Math.ceil(data.length/7); 323 function configure_slider(data) { 324 var paginas = (Math.ceil(data.length/6)); 387 325 $("#title_usuarios").html( get_lang("Results") ); 388 326 $(function() { … … 392 330 max: paginas, 393 331 step: 1, 394 slide: function( event, ui ) 395 { 332 slide: function( event, ui ) { 333 create_list(data, false, ui.value); 396 334 var string_results = ui.value + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"; 397 var selectable = $("#selectable"); 398 selectable.empty(); 399 var Ul = document.createElement("ul"); 400 var Op = document.createElement("li"); 401 for (i=((ui.value-1)*7)+1; i<(((ui.value-1)*7)+1)+7; i++) 402 { 403 if(data['type_catalog'] != 'G' && (data[i-1].mail == null || data[i-1].mail == "")) 404 { 405 data[i-1].mail = "No mail"; 406 } 407 var contact_name = utf8_decoder(data[i].cn); 408 if(contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) != -1) 409 contact_name = contact_name.substring(0, contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) + "<u>" + contact_name.substr(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()), data.search_for.length) + "</u>" + contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) + data.search_for.length); 410 411 Op.setAttribute("class", "ui-selectee"); 412 Op.innerHTML = '<span style="float:right; left:335px; position: absolute; z-index: 100; background-color: #EEE; padding:0"><button onClick="add_contact_field(contact_' + i + '.innerHTML)">+</button><button onClick="remove_contact_field(contact_' + i + '.innerHTML)">x</button></span><div class="id_contact_field" id=contact_' + i + ' onDblClick="add_contact_field(this.innerHTML)"><div class="name_contact"><strong>' + contact_name + '</strong><em>' + utf8_decoder(data[i].mail) + '</em></div></div>'; 413 $(Op).val(i); 414 Ul.appendChild(Op); 415 selectable.append(Ul.innerHTML); 416 } 417 $( "#amount" ).val( string_results ); 418 $(this).unbind('keypress'); 419 document.getElementById("amount").focus(); 335 $( "#amount-text" ).val( string_results ); 420 336 } 421 337 }); 422 $( "#amount" ).val( $( "#slider" ).slider( "value" ) + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"); 338 $("#selectable li:first button:first").focus(); 423 339 }); 424 340 } 425 341 342 var search_focus = false; 426 343 427 428 function checkEnter(e) 429 { 344 function setFocus() {search_focus = true;return;} 345 346 function removeFocus() {search_focus = false;return;} 347 348 function checkEnter(e) { 430 349 var kC = window.event ? event.keyCode : 431 350 e && e.keyCode ? e.keyCode : 432 351 e && e.which ? e.which : null; 433 if (kC) { 434 //$("#dialog-modal").unbind('keypress'); 352 if (kC) 435 353 return kC == 13; 436 } 437 else{ 354 else 438 355 return false; 439 356 } 440 } 357 441 358 442 359 /* 443 360 * Faz a busca direto da tela modal 444 361 */ 445 function buscaContato(param) 446 { 447 $("#busca").empty(); 448 if(param.length == 0) 449 { 450 alert(get_lang("Please enter a parameter to search.")); 451 return false; 362 function buscaContato(param) { 363 $("#busca, #detalhes_contato, #selectable").empty(); 364 if(param.length == 0) { 365 alert(get_lang("Please enter a parameter to search")); 366 return; 452 367 } 453 if(param.length < preferences.search_characters_number) 454 { 368 if(param.length < preferences.search_characters_number) { 455 369 alert(get_lang("parameter must be at least") + " " + preferences.search_characters_number + " " + get_lang("characters")); 456 370 return false; 457 371 } 458 372 var catalog = $("#combobox").val(); 459 var handler_emQuickSearch = function(data) 460 { 373 var handler_emQuickSearch = function(data) { 461 374 data_ = data; 462 if(data_.length > 0) 463 { 464 init_results(data_); 375 if(data_.length > 0) { 465 376 configure_slider(data_); 377 create_list(data_, true); 466 378 details_results(data_); 467 379 } 468 else 469 { 380 else { 470 381 $("#detalhes_contato, #selectable").empty(); 471 382 configure_slider(data); … … 476 387 477 388 478 quantidade_contatos = 0;479 389 /* 480 390 * Método que adiciona o contato selecionado no campo do email (To, CC, CCo) 481 391 */ 482 function add_contact_field(contact) 483 { 484 quantidade_contatos++; 485 $("#adds").html("Foram adicionados " + quantidade_contatos + " contatos."); 392 function add_contact_field(contact) { 486 393 var emailList = document.getElementById(field_ + "_" + id_).value; 487 var contact_parsed = contact.replace(/<\/?[^>]+>/gi, ' '); 394 var contact_parsed = contact.replace(/<[\/]*u>/gi, ''); 395 contact_parsed = contact_parsed.replace(/<u[^>]*>/gi, ''); 396 contact_parsed = contact_parsed.replace(/<\/?[^>]+>/gi, ' '); 488 397 contact_parsed = contact_parsed.replace(/^\s+|\s+$/gi, "").replace(/\s{2,}/gi, "|"); 489 398 var tokens_contact = contact_parsed.split("|"); 490 491 399 if (tokens_contact[1].indexOf("(") > 0) 492 400 tokens_contact[1] = tokens_contact[1].substr(0, (tokens_contact[1].indexOf("("))-2); … … 494 402 var final_contact; 495 403 if(tokens_contact[2] == undefined) 496 final_contact = "\"" + tokens_contact[0] + "" + "\" <" + tokens_contact[1] + ">, ";404 final_contact = "\"" + tokens_contact[0] + "" + "\" <" + tokens_contact[1] + ">, "; 497 405 else 498 406 { 499 407 if(tokens_contact[3] == undefined) 500 final_contact = "\"" + tokens_contact[0] + "" + tokens_contact[1] + "\" <" + tokens_contact[2] + ">, ";408 final_contact = "\"" + tokens_contact[0] + "" + tokens_contact[1] + "\" <" + tokens_contact[2] + ">, "; 501 409 else 502 final_contact = "\"" + tokens_contact[0] + " " + tokens_contact[1] + "" + tokens_contact[2] + "\" <" + tokens_contact[3] + ">, ";410 final_contact = "\"" + tokens_contact[0] + "" + tokens_contact[1] + "" + tokens_contact[2] + "\" <" + tokens_contact[3] + ">, "; 503 411 } 504 if (emailList[0] != '"')412 if (emailList[0] != '"' && emailList.indexOf(",") < 0) 505 413 emailList = emailList.substr(end_); 414 if(emailList.lastIndexOf(",") > 0) 415 emailList = emailList.substr(0, emailList.lastIndexOf(",") + 1); 506 416 507 if(emailList.lastIndexOf(",") > 0) 508 emailList = emailList.substr(0, emailList.lastIndexOf(",") + 2); 509 417 final_contact = final_contact.replace(/\/n/, ""); 510 418 new_emailList = emailList + final_contact; 511 419 document.getElementById(field_ + "_" + id_).value = new_emailList; 420 421 if (is_ie) { 422 var range= document.getElementById(field_ + "_" + id_).createTextRange(); 423 range.collapse(false); 424 range.select(); 425 } else { 512 426 document.getElementById(field_ + "_" + id_).focus(); 427 } 428 429 430 513 431 $(this).unbind('keypress'); 514 432 $(this).dialog("close"); … … 518 436 * Método que remove o contato selecionado no campo do email (To, CC, CCo) 519 437 */ 520 function remove_contact_field(contact) 521 { 438 function remove_contact_field(contact) { 522 439 var contact_parsed = contact.replace(/<\/?[^>]+>/gi, ' '); 523 440 contact_parsed = contact_parsed.replace(/^\s+|\s+$/gi, "").replace(/\s{2,}/gi, "|"); 524 var tokens_contact = contact_parsed.split("|");525 441 442 var tokens_contact = contact_parsed.split("|"); 526 443 if (tokens_contact[2].indexOf("(") > 0) 527 444 tokens_contact[2] = tokens_contact[2].substr(0, (tokens_contact[2].indexOf("("))-2); … … 532 449 final_contact = "\"" + tokens_contact[0] + " " + tokens_contact[1] + " " + tokens_contact[2] + "\" <" + tokens_contact[3] + ">"; 533 450 534 if(quantidade_contatos ==0) 535 { 536 alert("Nenhum contato adicionado!"); 537 return false; 538 } 539 540 var encontrou = false; 541 var emailList = document.getElementById(field_ + "_" + id_).value; 451 var exist = false; 452 var emailList = $("#" + field_ + "_" + id_).val(); 542 453 var emails_adicionados = emailList.split(","); 543 var quantidade_excluidos = 0; 544 for(i=0; i<emails_adicionados.length -1; i++) 545 { 546 if(emails_adicionados[i].trim() == final_contact) 547 { 454 for(i=0; i<emails_adicionados.length -1; i++) { 455 emails_adicionados[i].replace(/^\s+|\s+$/g, ''); 456 if(emails_adicionados[i] == final_contact) { 548 457 emails_adicionados[i] = "%"; 549 quantidade_excluidos++; 550 encontrou = true; 458 exist = true; 551 459 } 552 460 } 553 if (encontrou == false) 554 { 555 alert("Não pode excluir um contato que ainda não adicionou."); 461 if (exist == false) 556 462 return false; 557 }558 559 quantidade_contatos -= quantidade_excluidos;560 $("#adds").html("Foram adicionados " + quantidade_contatos + " contatos.");561 562 463 var novos_contatos = emails_adicionados.join(","); 563 464 novos_contatos = novos_contatos.replace(/%,/g, ""); 564 document.getElementById(field_ + "_" + id_).value = novos_contatos;465 $("#" + field_ + "_" + id_).val(novos_contatos); 565 466 } 566 467 567 468 568 function utf8_decoder ( str_data ) 569 469 /* Decoder utf8 */ 470 function utf8_decoder ( str_data ) { 570 471 var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0; 571 572 472 str_data += ''; 573 574 while ( i < str_data.length ) 575 { 473 while ( i < str_data.length ) { 576 474 c1 = str_data.charCodeAt(i); 577 if (c1 < 128) 578 { 475 if (c1 < 128) { 579 476 tmp_arr[ac++] = String.fromCharCode(c1); 580 477 i++; 581 } else if ((c1 > 191) && (c1 < 224)) 582 { 478 } else if ((c1 > 191) && (c1 < 224)) { 583 479 c2 = str_data.charCodeAt(i+1); 584 480 tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); … … 596 492 597 493 598 function show_help() 599 494 /* Mostra tela de help */ 495 function show_help() { 600 496 $(function() { 601 497 $( "#dialog-modal_help" ).dialog({ 602 498 resizable: false, 603 height: 230,604 499 width: 540, 605 500 modal: true, 606 closeOnEscape: true, 607 501 closeOnEscape: true 608 502 }); 609 503 }); … … 611 505 612 506 613 emQuickCatalogSearch.prototype.showWindow = function (div) 614 { 615 $(this).bind('keypress'); 507 emQuickCatalogSearch.prototype.showWindow = function (div) { 508 $(this).bind('keydown'); 616 509 $(function() { 617 510 $( "#dialog:ui-dialog" ).dialog( "destroy" ); 618 511 $( "#dialog-modal" ).dialog({ 619 512 resizable: false, 620 height: 530,621 width: 940,513 // height: "auto", 514 width: 780, 622 515 modal: true, 516 position: 'bottom', 623 517 closeOnEscape: true, 624 518 close: function (event, ui) { 625 519 event.stopPropagation(); 626 $(this).unbind('keypress'); 520 $(this).unbind('keydown'); 521 if (is_ie) { 522 var range= document.getElementById(field_ + "_" + id_).createTextRange(); 523 range.collapse(false); 524 range.select(); 525 } else { 526 document.getElementById(field_ + "_" + id_).focus(); 527 } 528 }, 529 open: function () { 530 $("#selectable li:first button:first").focus(); 627 531 }, 628 532 focus: function (event, ui) { 629 $(this).bind('keypress');533 //$(this).unbind('keydown'); 630 534 }, 631 535 beforeClose: function (event, ui) { 632 $(this).bind('keypress');536 $(this).unbind('keydown'); 633 537 }, 634 buttons:{ 635 'Fechar' : function(){ 538 buttons:[ 539 { 540 text: "Fechar", 541 click: function(){ 636 542 $("#detalhes_contato, #selectable, #busca").empty(); 637 543 $(this).dialog("close"); 544 if (is_ie) { 545 var range= document.getElementById(field_ + "_" + id_).createTextRange(); 546 range.collapse(false); 547 range.select(); 548 } else { 549 document.getElementById(field_ + "_" + id_).focus(); 638 550 } 551 }, 552 style: "margin-top: -2.1em" 639 553 } 554 ] 640 555 }); 641 556 }); 557 $(".ui-dialog .ui-dialog-titlebar") 558 .append('<a href="#" class="ui-dialog-titlebar-minimize ui-corner-all" role="button"><span class="ui-icon ui-icon-minusthick">minimize</span></a>') 559 .find('.ui-dialog-titlebar-minimize').click(function() { 560 $(".ui-dialog-buttonpane, .ui-dialog-content").toggle(); 561 $(".ui-icon-minusthick, .ui-icon-newwin").toggleClass('ui-icon-minusthick').toggleClass('ui-icon-newwin'); 562 }); 642 563 643 644 645 if(! div) { 646 alert(get_lang('The list has no participant.')); 647 return; 648 } 649 650 if(! this.arrayWin[div.id]) { 651 div.style.width = "700px"; 652 div.style.height = "230px"; 653 var title = get_lang('The results were found in the Global Catalog')+':'; 654 var wHeight = div.offsetHeight + "px"; 655 var wWidth = div.offsetWidth + "px"; 656 div.style.width = div.offsetWidth - 5; 657 658 win = new dJSWin({ 659 id: 'QuickCatalogSearch_'+div.id, 660 content_id: div.id, 661 width: wWidth, 662 height: wHeight, 663 title_color: '#3978d6', 664 bg_color: '#eee', 665 title: title, 666 title_text_color: 'white', 667 button_x_img: '../phpgwapi/images/winclose.gif', 668 border: true, 669 onclose: 'QuickCatalogSearch.restoreShortcuts("'+ div.id +'")'}); 670 671 this.arrayWin[div.id] = win; 672 win.draw(); 673 } 674 else { 675 win = this.arrayWin[div.id]; 676 } 677 //document.getElementById("window_QuickCatalogSearch").style.visibility = "visible"; 678 //win.open(); 679 //document.getElementById('select_QuickCatalogSearch').focus(); 680 681 if(is_ie && (preferences.use_shortcuts == '1')){ 682 shortcut.remove('down'); 683 shortcut.remove('up'); 684 shortcut.remove('return'); 685 } 686 } 687 688 emQuickCatalogSearch.prototype.transfer_result = function (field, ID, begin, end){ 689 cm = document.getElementById('select_QuickCatalogSearch'); 690 option_selected = cm.options[cm.selectedIndex].value + ", "; 691 emailList = document.getElementById(field + "_" + ID).value; 692 693 new_emailList = emailList.substring(0, begin) + option_selected + emailList.substring((parseInt(end) + 2), emailList.length); 694 document.getElementById(field + "_" + ID).value = new_emailList; 695 document.getElementById(field + "_" + ID).focus(); 696 this.arrayWin['window_QuickCatalogSearch_A'].close(); 697 document.getElementById("window_QuickCatalogSearch").style.visibility = "hidden"; 698 } 699 700 emQuickCatalogSearch.prototype.close_QuickSearch_window = function (field, ID){ 701 //document.getElementById('QuickCatalogSearch_window_QuickCatalogSearch').style.display = "none"; 702 document.getElementById(field + "_" + ID).focus(); 703 this.arrayWin['window_QuickCatalogSearch_A'].close(); 704 document.getElementById("window_QuickCatalogSearch").style.visibility = "hidden"; 705 if(typeof shortcut.all_shortcuts['down'] == 'undefined'){ 706 if(is_ie && (preferences.use_shortcuts == '1')) 707 { 708 shortcut.add("down",function(){select_msg('null', 'down');},{'disable_in_input':false}); 709 shortcut.add("up",function(){select_msg('null', 'up');},{'disable_in_input':false}); 710 shortcut.add("return",function(){ 711 if ( Element('border_id_0').className==='menu-sel' ) 712 { 713 all_messages = Element('tbody_box').childNodes; 714 for (var i=0; i < all_messages.length; i++) 715 { 716 if ( exist_className(all_messages[i], 'selected_shortcut_msg') ) 717 { 718 Element("td_who_" + all_messages[i].id).onclick(); 719 return; 720 } 721 } 722 } 723 },{'disable_in_input':true}); 724 } 725 } 726 } 727 728 emQuickCatalogSearch.prototype.restoreShortcuts = function(id) { 729 730 var search_win = document.getElementById(id); 731 if(typeof shortcut.all_shortcuts['down'] == 'undefined'){ 732 if (search_win.style.visibility == 'visible') 733 { 734 shortcut.add("down",function(){select_msg('null', 'down');},{'disable_in_input':false}); 735 shortcut.add("up",function(){select_msg('null', 'up');},{'disable_in_input':false}); 736 shortcut.add("return",function(){ 737 if ( Element('border_id_0').className==='menu-sel' ) 738 { 739 all_messages = Element('tbody_box').childNodes; 740 for (var i=0; i < all_messages.length; i++) 741 { 742 if ( exist_className(all_messages[i], 'selected_shortcut_msg') ) 743 { 744 Element("td_who_" + all_messages[i].id).onclick(); 745 return; 746 } 747 } 748 } 749 },{'disable_in_input':true}); 750 } 751 } 752 search_win.style.visibility = 'hidden'; 753 754 } 755 756 emQuickCatalogSearch.prototype.close_window = function(id) { 757 this.arrayWin[id].close(); 758 var group_values = Element('list_values'); 759 var user_values = Element('user_values'); 760 } 761 emQuickCatalogSearch.prototype.showCatalogList = function (border_id){ 762 var el = Element('catalog_list'); 763 764 if(el) { 765 Element('border_id').value = border_id; 766 win = this.arrayWin[el.id]; 767 win.open(); 768 return; 769 } 770 var border_input = document.createElement("INPUT"); 771 border_input.type = 'hidden'; 772 border_input.id = 'border_id'; 773 border_input.value = border_id; 774 document.body.appendChild(border_input); 775 el = document.createElement("DIV"); 776 el.id = 'catalog_list'; 777 document.body.appendChild(el); 778 el.style.visibility = "hidden"; 779 el.style.position = "absolute"; 780 el.style.width = "700px"; 781 el.style.height = is_ie ? "360px" : "375px"; 782 el.style.left = "0px"; 783 el.style.top = "0px"; 784 el.innerHTML = "<table border='0' cellpading='0' cellspacing='0' width='100%'>"+ 785 "<tr><td id='td1' style='cursor:pointer' align='center' onclick='QuickCatalogSearch.select_div(\"tab1\")'><a href='#' class='catalog' onclick='QuickCatalogSearch.select_div(\"tab1\");'>"+get_lang('Global Catalog')+"</a></td>"+ 786 "<td id='td2' style='background:#cecece;cursor:pointer' onclick='QuickCatalogSearch.select_div(\"tab2\")' align='center'><a href='#' class='catalog' onclick='QuickCatalogSearch.select_div(\"tab2\");'>"+get_lang('Personal Catalog')+"</a></td></tr>"+ 787 '</table>'+ 788 '<div id="tab1" align="center"><br>'+ 789 '<table border="0" cellpading="0" cellspacing="0">'+ 790 '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+' :</td></tr>'+ 791 '<tr><td><select style="display:none;width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select> '+ 792 '<select id="select_organization" style="width:150px" name="select_organization"></select> '+ 793 '<input type="text" id="search_for" name="search_for" value="" size="30" maxlength="30"/> <input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'"> <input style="display:visible" type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+ 794 '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type_l" type="radio" name="type" value="l"/>'+get_lang('Public Lists')+' <input type="radio" id="type_u" name="type" value="u" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" checked/>'+get_lang('Users')+' '+ 795 '<span style="visibility:hidden;background:#cc4444" id=msg_search> <font face="Verdana" size="1" color="WHITE">'+get_lang('Search in Catalog')+'...</font> </span></td></tr>'+ 796 '<tr><td>'+ 797 '<span id="list_span"><select multiple style="display:none;width:580px" size="14" id="list_values"></select></span>'+ 798 '<span id="user_span"><select multiple style="width:580px" size="14" id="user_values"></select></span>'+ 799 '</td></tr>'+ 800 '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+': <input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to\')"> '+ 801 '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc\')"> '+( allow_hidden_copy ? 802 '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco\')">' : '' )+ 803 '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+ 804 '</table>'+ 805 '</div>'+ 806 '<div style="display:none" id="tab2" align="center">'+ 807 '<br><br><br>'+ 808 '<table border="0" cellpading="0" cellspacing="0">'+ 809 '<tr><td>'+get_lang("Select the type of contact that you want to view")+' :</td></tr>'+ 810 '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" type="radio" name="type" value="p"/>' + get_lang('People') + ' <input type="radio" name="type" value="g" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)"/>' + get_lang('Groups') + ' '+ 811 '<tr><td>'+ 812 '<span id="personal_span"><select multiple style="width:580px" size="14" id="list_personal"></select></span>'+ 813 '<span id="groups_span"><select multiple style="display:none;width:580px" size="14" id="list_groups"></select></span>'+ 814 '</td></tr>'+ 815 '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+': <input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to1\')"> '+ 816 '<input type="button" class="button" value="'+get_lang('CC')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cc1\')"> '+ ( allow_hidden_copy ? 817 '<input type="button" class="button" value="'+get_lang('CCo')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'cco1\')">' : '' )+ 818 '</center></td></tr><tr><td nowrap><center><input type="button" value="'+get_lang('Close')+'" onClick="javascript:QuickCatalogSearch.close_window(\'catalog_list\')"></center></td></tr>'+ 819 '</table>'+ 820 '</div>'; 821 822 var title = get_lang('Search in the Global Catalog'); 823 var wHeight = el.offsetHeight - (is_ie ? 10 : 0) + "px"; 824 var wWidth = el.offsetWidth + "px"; 825 el.style.width = el.offsetWidth; 826 827 Element('search_for').onkeypress = function (e) { 828 if ((is_ie && (window.event.keyCode == 13)) || (!is_ie && e.keyCode == 13)) { 829 QuickCatalogSearch.searchCatalogList(true); 830 } 831 }; 832 833 win = new dJSWin({ 834 id: 'win_'+el.id, 835 content_id: el.id, 836 width: wWidth, 837 height: wHeight, 838 title_color: '#3978d6', 839 bg_color: '#eee', 840 title: title, 841 title_text_color: 'white', 842 button_x_img: '../phpgwapi/images/winclose.gif', 843 border: true}); 844 845 this.arrayWin[el.id] = win; 846 win.draw(); 847 win.open(); 848 849 var handler_catalogs = function(data){ 850 var user_catalog = get_lang("Global Catalog"); 851 if(data.length > 1) { 852 Element('select_catalog').style.display = ''; 853 for(i = 0; i < data.length; i++) { 854 Element('select_catalog').options[i] = new Option(data[i],i); 855 if(user_catalog.toUpperCase() == data[i].toUpperCase()) 856 Element('select_catalog').options[i].selected = true; 857 } 858 } 859 } 860 cExecute ("$this.ldap_functions.get_catalogs", handler_catalogs); 861 862 this.update_organizations(); 863 var handler_cc_contacts= function(data){ 864 if(data && data.length > 0){ 865 var aux = data.split(","); 866 for(var i=0; i< aux.length; i++){ 867 QuickCatalogSearch.cc_contacts[QuickCatalogSearch.cc_contacts.length] = aux[i]; 868 } 869 } 870 } 871 cExecute("$this.db_functions.get_cc_contacts",handler_cc_contacts); 872 873 var handler_cc_groups = function(data){ 874 if(data && data.length > 0){ 875 var aux = data.split(","); 876 for(var i=0; i < data.length; i++){ 877 QuickCatalogSearch.cc_groups[QuickCatalogSearch.cc_groups.length] = aux[i]; 878 } 879 } 880 } 881 cExecute("$this.db_functions.get_cc_groups",handler_cc_groups); 882 883 } 884 885 emQuickCatalogSearch.prototype.select_div = function(element){ 886 if(element == 'tab1'){ 887 Element('tab1').style.display = ''; 888 Element('tab2').style.display = 'none'; 889 Element('td1').style.background = '#eee'; 890 Element('td2').style.background = '#cecece'; 891 } 892 if(element == 'tab2'){ 893 Element('tab1').style.display = 'none'; 894 Element('tab2').style.display = ''; 895 Element('td1').style.background = '#cecece'; 896 Element('td2').style.background = '#eee'; 897 898 } 899 } 900 901 emQuickCatalogSearch.prototype.load_catalog = function(){ 902 903 var _this = this; 904 var content = new Array; 905 var select = Element('list_personal').style.display == 'none'? Element('list_groups'): Element('list_personal'); 906 907 if(Element('list_personal').style.display == 'none'){ 908 content = _this.cc_groups; 909 }else{ 910 content = _this.cc_contacts; 911 } 912 if(select.options.length > 0){ 913 for(var i=0; i < select.options.length; i++){ 914 select.options[i] = null; 915 i--; 916 } 917 } 918 for(var i=0; i < content.length; i++){ 919 if(content[i] != undefined){ 920 var aux = content[i].split(";"); 921 var opt = new Option(aux[0] + ' (' + aux[1] + ')','"' + aux[0] + '" ' + '<' + aux[1] + '>',false,false); 922 select[select.length] = opt; 923 } 924 } 925 content.splice(0,(content.lenght)); 926 } 927 928 emQuickCatalogSearch.prototype.update_organizations = function(){ 929 while(Element('select_organization').options.length > 0) { 930 Element('select_organization').remove(0); 931 } 932 var handler_org = function(data){ 933 Element('select_organization').options[0] = new Option(get_lang('all'),'all'); 934 if (data != null){ 935 var user_organization = Element('user_organization').value; 936 for(x = 0; x < data.length; x++) { 937 Element('select_organization').options[x+1] = new Option(data[x].toUpperCase(),data[x]); 938 if(user_organization.toUpperCase() == data[x].toUpperCase()) 939 Element('select_organization').options[x+1].selected = true; 940 } 941 } 942 } 943 cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org); 944 } 945 946 emQuickCatalogSearch.prototype.changeOptions = function(type){ 947 948 switch(type){ 949 case 'u': 950 Element('list_values').style.display = 'none'; 951 Element('user_values').style.display = ''; 952 break; 953 954 case 'l': 955 Element('user_values').style.display = 'none'; 956 Element('list_values').style.display = ''; 957 break; 958 959 case 'p': 960 Element('list_personal').style.display = ''; 961 Element('list_groups').style.display = 'none' 962 QuickCatalogSearch.load_catalog(); 963 break; 964 965 case 'g': 966 Element('list_personal').style.display = 'none'; 967 Element('list_groups').style.display = '' 968 QuickCatalogSearch.load_catalog(); 969 break; 970 } 971 972 } 973 974 emQuickCatalogSearch.prototype.addContacts = function(field) { 975 976 var border_id = Element('border_id').value; 977 var select = Element('user_values').style.display == 'none' ? Element('list_values') : Element('user_values'); 978 if(field == "to1" || field == "cc1" || field == "cco1"){ 979 field = field.substr(0,field.length - 1); 980 var select = Element('list_personal').style.display == 'none' ? Element('list_groups') : Element('list_personal'); 981 } 982 var fieldOpener = Element(field+"_"+border_id); 983 var not_selected = true; 984 985 for (i = 0 ; i < select.length ; i++) { 986 if (select.options[i].selected && select.options[i].value != '-1') { 987 if(fieldOpener.value.length > 0 && (fieldOpener.value.lastIndexOf(',') != (fieldOpener.value.length - 1))){ 988 fieldOpener.value += ","; 989 } 990 fieldOpener.value += select.options[i].value + ","; 991 not_selected = false; 992 select.options[i].selected = false; 993 } 994 } 995 996 if(not_selected) 997 return false; 998 999 if(field != 'to'){ 1000 a_link = Element("a_"+field+"_link_"+border_id); 1001 if(a_link) 1002 a_link.onclick(); 1003 } 1004 } 1005 1006 emQuickCatalogSearch.prototype.searchCatalogList = function (itemSearch){ 1007 1008 if(itemSearch && Element('search_for').value.length < preferences.search_characters_number){ 1009 alert(get_lang('Your search argument must be longer than %1 characters.', preferences.search_characters_number)); 1010 Element('search_for').focus(); 1011 return false; 1012 } 1013 var organization = Element('select_organization').value; 1014 var search = itemSearch ? Element('search_for').value : ''; 1015 var catalog = Element('select_catalog').value; 1016 1017 var handler_searchResults = function(data){ 1018 Element('msg_search').style.visibility = 'hidden'; 1019 if(data.error){ 1020 alert(get_lang('More than %1 results. Please, try to refine your search.',data.maxResult)); 1021 return false; 1022 }else if(data.users.length == 0 && data.groups.length == 0){ 1023 alert(get_lang('None result was found.')); 1024 } 1025 1026 1027 var group = Element('list_span'); 1028 var user = Element('user_span'); 1029 if(is_ie){ 1030 group.innerHTML = ''; 1031 user.innerHTML = ''; 1032 } 1033 else { 1034 group = Element('list_values'); 1035 user = Element('user_values'); 1036 for(var i = 0;i < group.options.length; i++) 1037 group.options[i--] = null; 1038 for(var i = 0;i < user.options.length; i++) 1039 user.options[i--] = null; 1040 } 1041 1042 var arr = new Array(data.maxResult); 1043 1044 for(i = 0; data.groups && i < data.groups.length; i++) { 1045 // Maneiras diferentes de se montar uma tag OPTION, pois no IE o objeto Option é muito lento. 1046 if(is_ie) 1047 arr[i] = '<option value="'+'"'+data.groups[i].name+'" <'+data.groups[i].email+'>">'+data.groups[i].name+' ('+data.groups[i].email+')'+'</option>'; 1048 else 1049 group.options[i] = new Option(data.groups[i].name+' ('+data.groups[i].email+')','"'+data.groups[i].name+'" <'+data.groups[i].email+'>'); 1050 } 1051 1052 1053 if(is_ie) 1054 group.innerHTML = '<select multiple style="display:none;width:580px" size="14" id="list_values">'+ arr.join() +'</select>'; 1055 1056 arr = new Array(data.maxResult); 1057 1058 for(i = 0; data.users && i < data.users.length; i++) { 1059 /*******************************************************************************************/ 1060 /* O resultado pratico do bloco de codigo a seguir eh a exibicao dos valores em tela, 1061 ja que vai verificar se o departamento e o email estao vazios ou nulos e a partir dai o 1062 resultado apresentado em tela sera exibido de maneira mais apresentavel; 1063 */ 1064 //verifica se departamento eh null ou nao; 1065 var department = data.users[i].department ? " - " + data.users[i].department : ""; 1066 //verifica se email eh null ou nao; 1067 var email = data.users[i].email ? data.users[i].email : ""; 1068 1069 // Maneiras diferentes de se montar uma tag OPTION, pois no IE o objeto Option é muito lento. 1070 if(is_ie) 1071 arr[i] = '<option value="'+'"'+data.users[i].name+'" <'+email+'>">'+data.users[i].name+' ('+email+')'+department+'</option>'; 1072 else { 1073 user.options[i] = new Option(data.users[i].name+' ('+email+')'+department,'"'+data.users[i].name+'" <'+email+'>'); // incluido data.users[i].department para exibir setor na opcao "Pesquisar" do email; 1074 } 1075 } 1076 1077 if(is_ie) 1078 user.innerHTML = '<select multiple style="width:580px" size="14" id="user_values">'+ arr.join() +'</select>'; 1079 1080 // Display entries found. 1081 var type = (data.groups.length > 0 && data.users.length == 0) ? 'l' : 'u'; 1082 Element("type_"+type).checked = true; 1083 QuickCatalogSearch.changeOptions(type); 1084 } 1085 1086 Element('msg_search').style.visibility = 'visible'; 1087 cExecute ("$this.ldap_functions.catalogsearch&organization="+organization+"&search_for="+search+"&catalog="+catalog, handler_searchResults); 564 $("#dialog-modal button, input.button").button(); 1088 565 } 1089 566 1090 567 1091 /* Build the Object */568 /* Build the Object */ 1092 569 //QuickCatalogSearch; 1093 570 QuickCatalogSearch = new emQuickCatalogSearch(); -
trunk/expressoMail1_2/js/TreeS.js
r4772 r5134 18 18 tree.style.position = "absolute"; 19 19 tree.style.left = "0px"; 20 tree.style.width = "0px"; 20 21 tree.style.top = "0px"; 21 tree.style.width = "0px";22 22 tree.style.height = "0px"; 23 23 tree.id = "window_tree"; … … 32 32 div_buttons.style.left = "440px"; 33 33 div_buttons.style.top = "20px" 34 div_buttons.style.width = "1 30px";34 div_buttons.style.width = "10px"; 35 35 div_buttons.style.height = "214px"; 36 36 div_buttons.innerHTML = "<table border='0' cellpading='0' cellspacing='0'>"+ 37 37 "<tr>"+ 38 "<td><input type='button' value='"+get_lang('New folder')+"' onclick='proxy_mensagens.proxy_create_folder()' ></td>"+38 "<td><input type='button' value='"+get_lang('New folder')+"' onclick='proxy_mensagens.proxy_create_folder()' "+ (is_ie ? "style=\"width:85px\"": "") +"></td>"+ 39 39 "</tr>"+ 40 40 "<tr>"+ … … 42 42 "</tr>"+ 43 43 "<tr>"+ 44 "<td><input type='button' value='"+get_lang('Rename folder')+"' onclick='proxy_mensagens.proxy_rename_folder()' ></td>"+44 "<td><input type='button' value='"+get_lang('Rename folder')+"' onclick='proxy_mensagens.proxy_rename_folder()' "+ (is_ie ? "style=\"width:108px\"": "") +"></td>"+ 45 45 "</tr>"+ 46 46 "<tr>"+ 47 47 //Por Bruno Costa(bruno.vieira-costa@serpro.gov.br - Chama o proxy_mensagens para que uma pasta local também possa ser exportada 48 "<td><input type='button' value='"+get_lang('Export messages')+"' onclick='proxy_mensagens.proxy_export_all_msg()' ></td>"+48 "<td><input type='button' value='"+get_lang('Export messages')+"' onclick='proxy_mensagens.proxy_export_all_msg()' "+ (is_ie ? "style=\"width:130px\"": "") +"></td>"+ 49 49 "</tr>"+ 50 50 "<tr><td><br><br><br><br><br></td></tr>"+ … … 176 176 if(data[i].folder_parent != 'root') { 177 177 var node_parent = folders_tree.getNodeById(data[i].folder_parent); 178 if(typeof node_parent != 'undefined'){ 178 179 node_parent.plusSign = true; 179 180 folders_tree.alter(node_parent); 180 } 181 181 182 } 183 } 182 184 folders_tree.add(nn,data[i].folder_parent); 185 183 186 } 184 187 } -
trunk/expressoMail1_2/js/abas.js
r5083 r5134 2 2 BordersArray[0] = new setBorderAttributes(0); 3 3 var countBorders = 0; 4 var partMsgs = new Array(); 5 4 6 5 7 function setBorderAttributes(ID) … … 42 44 43 45 var footer_menu = Element("footer_menu"); 44 if (footer_menu) { 46 var aba = Element('border_id_'+ID); 47 if (footer_menu != null) { 45 48 footer_menu.style.display = (openTab.type[ID] != 4 ? '' : 'none'); 46 } 49 if((aba.id.indexOf("_r") < 0) && (aba.id.indexOf("_0") < 0) && (aba.id.indexOf("id_search_") < 0)){ 50 spanD.style.display = 'none'; 51 footer_menu.style.display = 'none'; 52 } 53 } 54 47 55 48 56 var len = BordersArray.length; … … 77 85 } 78 86 87 numBox = getNumBoxFromTabId(ID); 79 88 if (typeof(ID)=='number') { 80 89 numBox = ID; … … 114 123 var str_continue = ''; 115 124 var bolContinue = true; 125 str_continue = '\n' + get_lang('You must manually close one of your tabs before opening a new one'); 116 126 if (preferences.auto_close_first_tab == 1){ 117 str_continue = '\n' + get_lang('You must manualy close one of your tabs before opening a new one');118 127 var children = Element('border_tr').childNodes; 119 128 var bolDelete = true; … … 127 136 bolDelete = false; 128 137 } 129 if (bolDelete){ 138 if (bolDelete || bolContinue){ 139 str_fechar = '\n' + get_lang('Reached maximum tab limit. Want to close this tab'); 140 var confirmacao = confirm(str_fechar); 141 if(confirmacao){ 130 142 bolContinue = false; 131 143 delete_border(num_child, 'false'); 132 144 break; 145 }else{ 146 return 'maximo'; 133 147 } 134 148 } 135 149 } 136 150 } 137 if (bolContinue){151 }else{ 138 152 alert(get_lang('Reached maximum tab limit') + str_continue ); 139 return 0;153 return 'maximo'; 140 154 } 141 155 } … … 250 264 } 251 265 var caption = ""; 252 Element("font_"+border.id).style.width = (border_width - 25)+'px';266 Element("font_"+border.id).style.width = (border_width - 30)+'px'; 253 267 Element("font_"+border.id).innerHTML = title; 254 268 return(title); … … 257 271 function draftTests(ID, msg_sent){ 258 272 var cancel = new LertButton(get_lang('cancel'), function() { 259 Element("border_id_"+ID).onclick = function () {alternate_border(ID);}; 273 Element("border_id_"+ID).onclick = function () { alternate_border(ID);}; 274 cRichTextEditor.prototype.focus(ID); 275 260 276 }); 277 261 278 var yes = new LertButton(get_lang('Save'), function() { 262 save_msg(ID );279 save_msg(ID, 'undefined', true); 263 280 openTab.toPreserve[ID] = false; 264 281 close_delete(ID, msg_sent); 265 282 delete(openTab.type[ID]); 266 write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder('Drafts'))); 283 //write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder('Drafts'))); 284 267 285 }); 268 286 var discard = new LertButton(get_lang('Discard'), function() { … … 306 324 function delete_border(ID, msg_sent) 307 325 { 326 308 327 var bolExecuteClose = true; 309 var borderElem = Element("border_id_" + ID) 328 var borderElem = Element("border_id_" + ID); 310 329 if (borderElem){ 311 330 borderElem.onclick = null; // It's avoid a FF3 bug … … 368 387 resizeWindow(); 369 388 RichTextEditor.destroy( 'body_'+ID ); 389 390 //Caso for uma mensagem anexada tem que deletar ela da lixeira apos fechar a aba 391 var isPartMsg = false; 392 var id2 = ID.replace('_r',''); 393 for(var ii = 0; ii < partMsgs.length; ii++) 394 if(partMsgs[ii] == id2){ 395 isPartMsg = true; 396 partMsgs[ii] = null; 397 } 398 399 if(isPartMsg === true){ 400 var handler_delete_msg = function(){}; 401 cExecute ("$this.imap_functions.delete_msgs&folder=INBOX"+cyrus_delimiter+trashfolder+"&msgs_number="+id2,handler_delete_msg); 402 } 403 /////////////////////////////////////////////////////////////////////////////////// 404 370 405 return true; 406 } 407 408 function getTabPrefix() { // define o prefixo para os checkboxes das mensagens 409 if (typeof(currentTab)!='number') 410 return currentTab+"_"; 411 else 412 return ""; 371 413 } 372 414 … … 388 430 } 389 431 } 390 391 function getTabSufix() {392 if (typeof(currentTab)=='number')393 return '';394 else395 return '_s' + numBox.toString();396 } -
trunk/expressoMail1_2/js/common_functions.js
r5075 r5134 18 18 19 19 window.onresize = resizeWindow; 20 21 var message = "Não Informado"; 20 22 21 23 function config_events(pObj, pEvent, pHandler) … … 144 146 remove_className(tr_message, 'selected_msg'); 145 147 add_className(tr_message, 'tr_msg_unread'); 146 if( document.getElementById("td_message_unseen_"+msg_number) != null )147 148 Element("td_message_unseen_"+msg_number).innerHTML = "<img src ='templates/"+template+"/images/unseen.gif' title='"+get_lang('Unseen')+"'>"; 148 149 } … … 152 153 remove_className(msg, 'selected_msg'); 153 154 add_className(msg, 'flagged_msg'); 154 if( document.getElementById("td_message_important_"+msg_number) != null )155 155 Element("td_message_important_"+msg_number).innerHTML = "<img src ='templates/"+template+"/images/important.gif' title='"+get_lang('Important')+"'>"; 156 156 } … … 160 160 remove_className(msg, 'selected_msg'); 161 161 remove_className(msg, 'flagged_msg'); 162 if( document.getElementById("td_message_important_"+msg_number) != null )163 162 Element("td_message_important_"+msg_number).innerHTML = " "; 164 163 } … … 185 184 else 186 185 return false; 186 } 187 188 //Remove as linhas da tabela sem deletar o corrent_box 189 function remove_rows(el){ 190 while (el.rows.length > 0) { 191 el.deleteRow(0); 192 } 193 Element("tot_m").innerHTML = 0 194 Element("new_m").innerHTML = 0 187 195 } 188 196 … … 234 242 } 235 243 if(new_file_name) { 236 var extension = new_file_name.substring(new_file_name.length-4, new_file_name.length);237 if (extension == ".eml") // if the extension is .eml244 var extension = /\.[^.]*$/.exec(new_file_name); 245 if (extension == ".eml") 238 246 params = "&newFilename="+new_file_name; //name_of_message.eml 239 247 else // when more than one message … … 256 264 function addForwardedFile(id_border,file_name,link,divFiles){ 257 265 if(!divFiles) 258 divFiles = document.getElementById("divFiles_"+id_border);266 var divFiles = document.getElementById("divFiles_"+id_border); 259 267 260 268 if (! divFiles) … … 267 275 var countDivFiles = 1; 268 276 269 divFile = document.createElement('DIV');270 271 277 var divFile = document.createElement('DIV'); 278 279 var inputFile = document.createElement("INPUT"); 272 280 if (!expresso_offline) { 273 281 if (!is_ie) { 274 var inputFile = document.createElement("INPUT");275 276 282 var tmp_id_border = document.createAttribute('id_border'); 277 283 tmp_id_border.value = id_border; … … 286 292 } 287 293 else { 288 varinputFile = document.createElement("link");294 inputFile = document.createElement("link"); 289 295 290 296 var tmp_id_border = document.createAttribute('id_border'); … … 300 306 } 301 307 else { 302 var inputFile = document.createElement("input");303 308 inputFile.type = 'hidden'; 304 309 inputFile.name = 'offline_forward_' + countDivFiles; … … 315 320 checkbox.id = "checkbox_"+id_border+"_"+countDivFiles; 316 321 checkbox.name = "local_attachments[]"; 322 checkbox.setAttribute("checked", "checked"); 317 323 318 324 checkbox.value = s_tmp; … … 329 335 divFiles.appendChild(divFile); 330 336 331 checkbox.checked = true; //IncrÃvel, mas no Internet Explorer o checked só funciona efetivamente se o elemente já estiver renderizado... por isso só aqui eu seleciono ele...332 337 return inputFile; 333 338 } … … 476 481 to = to.replace("<","<"); 477 482 to = to.replace(">",">"); 478 block_quoted_body = "<br><br>";479 block_quoted_body += get_lang('At %1, %2 hours, %3 wrote:', date_day, date_hour, to) ;483 block_quoted_body ='<div>'; 484 block_quoted_body += get_lang('At %1, %2 hours, %3 wrote:', date_day, date_hour, to) + '<br type="_moz"></div>'; 480 485 block_quoted_body += "<blockquote style=\"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;\">"; 481 486 block_quoted_body += body; … … 489 494 to = to.replace(/</g,"<"); 490 495 to = to.replace(/>/g,">"); 491 var forward_body = '< BR><BR>---------- ' + get_lang('Forwarded message') + ' ----------<BR>';492 forward_body += get_lang('From') + ': ' + from + '< BR>';493 forward_body += get_lang('Date') + ': ' + date + '< BR>';494 forward_body += get_lang('Subject') + ': ' + subject + '< BR>';495 forward_body += get_lang('To') + ': ' + to+ '< BR>';496 var forward_body = '<div>---------- ' + get_lang('Forwarded message') + ' ----------<br type="_moz"></div><div>'; 497 forward_body += get_lang('From') + ': ' + from + '<br type="_moz"></div><div>'; 498 forward_body += get_lang('Date') + ': ' + date + '<br type="_moz"></div><div>'; 499 forward_body += get_lang('Subject') + ': ' + subject + '<br type="_moz"></div><div>'; 500 forward_body += get_lang('To') + ': ' + to+ '<br type="_moz"></div><div>'; 496 501 if(cc != undefined){ 497 502 cc = cc.replace(/</g,"<"); 498 503 cc = cc.replace(/>/g,">"); 499 forward_body += get_lang('CC') + ': ' + cc+ '< BR><BR>';504 forward_body += get_lang('CC') + ': ' + cc+ '<br type="_moz"></div><<div><br type="_moz"></div><div><br type="_moz"></div>'; 500 505 } 501 506 forward_body += body; … … 603 608 604 609 if (search_for.length < preferences.search_characters_number){ 605 //alert(get_lang('Your search argument must be longer than %1 characters.', preferences.search_characters_number)); 606 alert(get_lang('Your search argument must be longer than %1 characters. Use quotes to refine your search', preferences.search_characters_number)); 610 alert(get_lang('Your search argument must be longer than %1 characters.', preferences.search_characters_number)); 607 611 return false; 608 612 } … … 698 702 699 703 function url_encode(str){ 704 if(str === null) return false; 700 705 var hex_chars = "0123456789ABCDEF"; 701 706 var noEncode = /^([a-zA-Z0-9\_\-\.])$/; … … 730 735 return strDecode; 731 736 } 732 737 //Método que remove os hexadecimais criados no enconde 738 //e retorna string corretamente 733 739 function url_decode_s(str) { 734 var n, strCode, strDecode = ""; 735 for (n = 0; n < str.length; n++) { 736 if (str.charAt(n) == "%") { 737 strCode = str.charAt(n + 1) + str.charAt(n + 2); 738 strDecode += String.fromCharCode(parseInt(strCode, 16)); 739 n += 2; 740 } else { 741 strDecode += str.charAt(n); 742 } 743 } 744 return strDecode; 740 var result = ""; 741 742 for (var i = 0; i < str.length; i++) { 743 if (str.charAt(i) == "+") result += " "; 744 else result += str.charAt(i); 745 } 746 return unescape(result); 747 745 748 } 746 749 … … 963 966 } 964 967 968 //Verifica se ainda existem mensagens marcadas, se não desmarca 969 //o selecionar todas. 970 function remove_chk_box_select_all_messages(){ 971 var main = Element("tbody_box"); 972 var main_list = main.childNodes; 973 var len_main_list = main_list.length; 974 for (i=0; i<len_main_list; i++) 975 { 976 if (Element("check_box_message_"+main_list[i].id).checked){ 977 return; 978 } 979 } 980 document.getElementById("chk_box_select_all_messages").checked = false; 981 } 982 965 983 function select_all_messages(select) 966 984 { … … 974 992 { 975 993 Element("check_box_message_"+main_list[i].id).checked = true; 976 add_className(Element(main_list[i].id), 'selected_msg'); // one by one to add only if does not exist yet977 add_className(Element(main_list[i].id), 'selected_ shortcut_msg'); // one by one to add only if does not exist yet994 remove_className(Element(main_list[i].id), 'selected_msg'); 995 add_className(Element(main_list[i].id), 'selected_msg selected_shortcut_msg'); 978 996 } 979 997 } … … 983 1001 { 984 1002 Element("check_box_message_"+main_list[i].id).checked = false; 985 remove_className(Element(main_list[i].id), 'selected_msg'); // one by one to remove 986 remove_className(Element(main_list[i].id), 'selected_shortcut_msg'); // one by one to remove 1003 remove_className(Element(main_list[i].id), 'selected_msg selected_shortcut_msg'); 987 1004 } 988 1005 } … … 1006 1023 else 1007 1024 return (size/gbyte).toFixed(1) + ' GB'; 1025 } 1026 1027 //valida se a primeira data é menor que a segunda data 1028 function validate_date_order(dateStart, dateEnd){ 1029 if ( parseInt( dateEnd.split( "/" )[2].toString() + dateEnd.split( "/" )[1].toString() + dateEnd.split( "/" )[0].toString() ) >= parseInt( dateStart.split( "/" )[2].toString() + dateStart.split( "/" )[1].toString() + dateStart.split( "/" )[0].toString() ) ){ 1030 return true; 1031 }else{ 1032 return false; 1033 } 1008 1034 } 1009 1035 -
trunk/expressoMail1_2/js/connector.js
r4760 r5134 428 428 } 429 429 // Cancel Request Connector 430 cConnector.prototype.cancelRequest = function (){ 431 432 if (!this.requests[this.tid]){ 430 cConnector.prototype.cancelRequest = function (id){ 431 432 id = id || this.tid; 433 434 if (!this.requests[id]){ 433 435 return false; 434 436 } 435 437 //this.oxmlhttp.onreadystatechange = null; 436 this.requests[ this.tid].abort();437 delete this.requests[ this.tid];438 this.requests[ this.tid] = null;438 this.requests[id].abort(); 439 delete this.requests[id]; 440 this.requests[id] = null; 439 441 440 442 this.hideProgressBar(); -
trunk/expressoMail1_2/js/doiMenuData.js
r3388 r5134 18 18 if(preferences.use_local_messages==1) { 19 19 if(expresso_local_messages.is_offline_installed()) { 20 itens.push("force_check_queue()|" + get_lang("Send from queue") + "|queue. jpg");20 itens.push("force_check_queue()|" + get_lang("Send from queue") + "|queue.png"); 21 21 } 22 22 } -
trunk/expressoMail1_2/js/drag_area.js
r4845 r5134 63 63 64 64 if(_button == 2 || _button == 3) { 65 var _checkb = Element("check_box_message_" + msg_number + getTabSufix()); 65 var _checkb = Element("check_box_message_"+ msg_number); 66 67 var _checkb = Element(getTabPrefix() + "check_box_message_" + msg_number); 66 68 67 69 if(_checkb) { … … 96 98 97 99 var msg_number = _dragArea.from_list ? _dragArea.msg_number : _dragArea.msg_number.replace('_r',''); 98 var _checkbox_element = Element( "check_box_message_"+msg_number+getTabSufix());100 var _checkbox_element = Element(getTabPrefix()+"check_box_message_"+msg_number); 99 101 if(_dragArea.from_list) { 100 102 … … 166 168 else if(_dragArea.msg_number && _target.type != 'checkbox') { 167 169 _dragArea.mouseMoveDrag(e); 170 } 168 171 if (is_ie) 169 172 window.event.returnValue = false; 170 173 else 171 174 e.returnValue = false; 172 }173 175 }; 174 176 … … 178 180 var _target = is_ie ? _event.srcElement : _event.target; 179 181 var _button = is_ie ? _event.button : _event.which; 182 var _tab_prefix = getTabPrefix(); 180 183 var _msg_id; 181 184 … … 192 195 for(var i = 0; id_messages_to_drag && i < id_messages_to_drag.length; i++) { 193 196 _msg_id = getMessageIdFromRowId(id_messages_to_drag[i]); 194 Element( "check_box_message_"+id_messages_to_drag[i]).checked = false;197 Element(_tab_prefix+"check_box_message_"+_msg_id).checked = false; 195 198 changeBgColor(_event ,_msg_id); 196 199 } … … 244 247 for(var i = 0; id_messages_to_drag && i < id_messages_to_drag.length; i++) { 245 248 _msg_id = getMessageIdFromRowId(id_messages_to_drag[i]); 246 Element( "check_box_message_"+id_messages_to_drag[i]).checked = false;249 Element(_tab_prefix+"check_box_message_"+_msg_id).checked = true; 247 250 changeBgColor(_event ,_msg_id); 248 251 } -
trunk/expressoMail1_2/js/draw_api.js
r5083 r5134 51 51 else if (data[i].folder_unseen <= 0) 52 52 { 53 if(tree_folders.getNodeById(data[i].folder_id)){ 53 54 tree_folders.getNodeById(data[i].folder_id).alter({caption:lang_folder(data[i].folder_name)}); 54 55 tree_folders.getNodeById(data[i].folder_id)._refresh(); 56 } 55 57 } 56 58 … … 152 154 */ 153 155 if (preferences.use_local_messages==1 || expresso_offline) { 154 if (!window.google || !google.gears) { 155 if (!expresso_local_messages.installGears()) 156 preferences.use_local_messages=0; 157 } 158 else{ 159 if (!window.google || !google.gears) { 160 temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to be redirected to gears installation page?")); 161 if (temp) { 162 //if(is_win && is_gecko && preferences.gears_firefox_windows != "") 163 // location.href = preferences.gears_firefox_windows; 164 //else if(!is_win && is_gecko && preferences.gears_firefox_linux != "") 165 // location.href = preferences.gears_firefox_linux; 166 //else if(is_ie && preferences.gears_ie != "") 167 //location.href = preferences.gears_ie; 168 //else 169 expresso_local_messages.installGears(); 170 } 171 else { 172 preferences.use_local_messages=0; 173 } 174 } 156 //verifica se gears esta installado ou o offline 157 if( (!window.google || !google.gears) && 158 !expresso_local_messages.installGears() ){ 159 preferences.use_local_messages = 0; 160 } 161 else if( !expresso_local_messages.is_offline_installed() ) 162 preferences.use_local_messages = 0; 175 163 else{ 176 164 if (expresso_offline) … … 210 198 } 211 199 } 212 }213 200 214 201 tree_folders.draw(Element('content_folders')); 215 202 if (!expresso_offline) { 216 //n_root.changeState();217 //tree_folders.getNodeById('INBOX')._select();203 n_root.changeState(); 204 tree_folders.getNodeById('INBOX')._select(); 218 205 } 219 206 else { … … 260 247 261 248 draw_paging(Element('tot_m').innerHTML); 262 if(document.getElementById("nINBOX /"+trashfolder+"tree_folders"))249 if(document.getElementById("nINBOX"+cyrus_delimiter+trashfolder+"tree_folders")) 263 250 { 264 251 var trash = document.createElement("SPAN"); … … 271 258 trash.onmouseover = function() {trash.style.color="red";}; 272 259 trash.onmouseout= function() {trash.style.color="#666666";}; 273 document.getElementById("nINBOX /"+trashfolder+"tree_folders").appendChild(trash);274 } 275 if(document.getElementById("nINBOX /"+spamfolder+"tree_folders"))260 document.getElementById("nINBOX"+cyrus_delimiter+trashfolder+"tree_folders").appendChild(trash); 261 } 262 if(document.getElementById("nINBOX"+cyrus_delimiter+spamfolder+"tree_folders")) 276 263 { 277 264 var spam = document.createElement("SPAN"); … … 285 272 spam.onmouseover = function() {spam.style.color="red";}; 286 273 spam.onmouseout= function() {spam.style.color="#666666";}; 287 document.getElementById("nINBOX /"+spamfolder+"tree_folders").appendChild(spam);274 document.getElementById("nINBOX"+cyrus_delimiter+spamfolder+"tree_folders").appendChild(spam); 288 275 } 289 276 … … 540 527 if(current_page != 1) { 541 528 lnk_page = document.createElement("A"); 542 lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 529 //lnk_page.setAttribute("href", "javascript:current_page=1;kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 530 lnk_page.setAttribute("href", "javascript:current_page=1; draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 543 531 } 544 532 else { … … 579 567 msg_range_begin = ((i*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); 580 568 msg_range_end = (i*preferences.max_email_per_page); 581 lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 569 //lnk_page.setAttribute("href", "javascript:current_page="+i+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 570 lnk_page.setAttribute("href", "javascript:current_page="+i+"; draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 582 571 } 583 572 lnk_page.innerHTML = " ... "; … … 593 582 msg_range_begin = ((total_pages*preferences.max_email_per_page)-(preferences.max_email_per_page-1)); 594 583 msg_range_end = (total_pages*preferences.max_email_per_page); 595 lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 584 //lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";kill_current_box(); draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 585 lnk_page.setAttribute("href", "javascript:current_page="+total_pages+"; draw_paging("+num_msgs+"); proxy_mensagens.messages_list(get_current_folder(),"+msg_range_begin+","+msg_range_end+",'"+sort_box_type+"','"+search_box_type+"',"+sort_box_reverse+","+preferences.preview_msg_subject+","+preferences.preview_msg_tip+",function handler(data){alternate_border(0); draw_box(data, get_current_folder());});"); 596 586 } 597 587 else { … … 788 778 else 789 779 hT = getFirstParentOfType(el,"TABLE"); 790 return (hT.parentNode.nextSibling.childNodes[0]); 780 return (hT.parentNode.nextSibling.childNodes[0].className !== "local-messages-search-warning"? 781 hT.parentNode.nextSibling.childNodes[0] : hT.parentNode.nextSibling.childNodes[1]); 791 782 } 792 783 … … 969 960 document.getElementById("border_table").width = "99.5%"; 970 961 962 numBox = 0; //As pastas sempre estarão na aba 0 963 971 964 openTab.content_id[numBox] = document.getElementById("content_id_"+numBox); 972 965 openTab.content_id[numBox].innerHTML = ""; … … 1246 1239 tr_element.msg_sample = ""; 1247 1240 //if(headers_msgs.msg_sample && headers_msgs.msg_sample.preview_msg_subject != "") 1248 if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1" )1241 if(headers_msgs.msg_sample && preferences.preview_msg_subject == "1" && headers_msgs.msg_sample.body !== "") 1249 1242 { 1250 1243 if (cssForResizing) //Colunas redimensionaveis - nao trunca 1251 tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,180) + "..."; //trecho do body que sera exibido com o assunto;1244 tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,180) + "..."; //trecho do body que sera exibido com o assunto; 1252 1245 else 1253 tr_element.msg_sample = headers_msgs.msg_sample.body.substr(0,120) + "..."; //trecho do body que sera exibido com o assunto;1246 tr_element.msg_sample = Base64.decode(headers_msgs.msg_sample.body).substr(0,120) + "..."; //trecho do body que sera exibido com o assunto; 1254 1247 } 1255 1248 1256 1249 tr_element.tip = ""; 1257 if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1" )1250 if(headers_msgs.msg_sample && preferences.preview_msg_tip == "1" && headers_msgs.msg_sample.body !== "") 1258 1251 { 1259 tr_element.tip = headers_msgs.msg_sample.body.substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip;1252 tr_element.tip = Base64.decode(headers_msgs.msg_sample.body).substr(3,300) + "..."; //trecho do body que sera exibido no tool-tip; 1260 1253 } 1261 1254 … … 1266 1259 } 1267 1260 else{ 1268 if ((headers_msgs.Flagged == 'F') || headers_msgs.Importance.toLowerCase().indexOf("high")!=-1)1261 if ((headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high")!=-1 ) ) 1269 1262 add_className(tr_element,'flagged_msg'); 1270 1263 } … … 1342 1335 td_element23 = createTDElement(0,4,"td_msg",null,"td_message_important_"+headers_msgs.msg_number); 1343 1336 1344 if ( headers_msgs.Flagged == 'F' || (headers_msgs.Importance.toLowerCase().indexOf("high") != -1 ))1337 if ( (headers_msgs.Flagged == 'F') || ( headers_msgs.Importance !== undefined && headers_msgs.Importance.toLowerCase().indexOf("high") != -1 )) 1345 1338 { 1346 1339 td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.gif' title='"+get_lang('Important')+"'>"; … … 1370 1363 1371 1364 test = true; 1372 if(msg_folder.indexOf(sentfolder) !=-1 ||msg_folder.indexOf(preferences.save_in_folder) !=-1 || msg_folder.replace("local_","INBOX /").indexOf(preferences.save_in_folder) !=-1)1365 if(msg_folder.indexOf(sentfolder) !=-1 ||msg_folder.indexOf(preferences.save_in_folder) !=-1 || msg_folder.replace("local_","INBOX"+cyrus_delimiter).indexOf(preferences.save_in_folder) !=-1) 1373 1366 test = false; 1374 1367 1375 if( headers_msgs.from.email.toLowerCase() == Element("user_email").value.toLowerCase() && !(preferences.from_to_sent == "1" && test) && !(msg_folder.substr(0,5) == "user/"))1368 if( (headers_msgs.from != undefined) && headers_msgs.from.email.toLowerCase() == Element("user_email").value.toLowerCase() && !(preferences.from_to_sent == "1" && test) && !(msg_folder.substr(0,5) == "user/")) 1376 1369 { 1377 1370 td_element3.onmouseover = function () {this.title=headers_msgs.to.email;}; … … 1402 1395 spanSender.onmouseover = function (event) {this.style.textDecoration = "underline";try {InfoContact.begin(this,headers_msgs.from.email)} catch(e){};}; 1403 1396 spanSender.onmouseout = function (){try {this.style.textDecoration = "none";clearTimeout(InfoContact.timeout);} catch(e){}}; 1397 if ( headers_msgs.from !== undefined ) 1404 1398 spanSender.innerHTML = headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email; 1405 1399 if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){ … … 1458 1452 1459 1453 // old local messages can capture headers_msgs.udate as "hh:mm" or "dd/mm/yyyy" 1460 if ( headers_msgs.udate.toString().match(/\d{2}:\d{2}/) || headers_msgs.udate.toString().match(/\d{2}\/\d{2}\/\d{4}/))1454 if ( (headers_msgs.udate !== undefined) && (headers_msgs.udate.toString().match(/\d{2}:\d{2}/) || headers_msgs.udate.toString().match(/\d{2}\/\d{2}\/\d{4}/)) ) 1461 1455 { 1462 1456 temp_msg_day = headers_msgs.msg_day.split('/'); … … 1562 1556 document.getElementById("message_header_"+(sort_box_type.lastIndexOf("SORT") != "-1" ? sort_box_type : "SORTARRIVAL")+"_"+numBox ).innerHTML = "<B>"+type_name+"</B><img src ='templates/"+template+"/images/arrow_"+(sort_box_reverse == 1 ? 'desc' : 'asc')+"endant.gif'>"; 1563 1557 } 1564 1558 function verifyOption(name, id){ 1559 var str = name + '' + id; 1560 if(!Element(str).style.display == ""){ 1561 var option_reply_options = document.getElementById('msg_opt_reply_options_'+id); 1562 option_reply_options.value = 'show'; 1563 option_reply_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1564 Element('tr_other_options_'+id).style.display = 'none'; 1565 var option_more_options = document.getElementById('msg_opt_more_options_'+id); 1566 option_more_options.value = 'show'; 1567 option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1568 Element('tr_other_more_options_'+id).style.display = 'none'; 1569 var option_mark_as_options = document.getElementById('msg_opt_mark_options_'+id); 1570 option_mark_as_options.value = 'show'; 1571 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1572 Element('tr_other_mark_options_'+id).style.display = 'none'; 1573 } 1574 } 1565 1575 function draw_message(info_msg, ID){ 1566 1576 var content = document.getElementById('content_id_' + ID); … … 1589 1599 folder = Element(info_msg.msg_number); 1590 1600 1591 if (!folder){ 1592 delete_border(ID); 1593 return; 1594 } 1601 1595 1602 if (folder){ // mensagem local criptografada nao tem ID da pasta local 1596 1603 if (folder.nextSibling){ 1597 1604 var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; 1598 1605 1599 if (nextMsgBox == "INBOX /decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas1606 if (nextMsgBox == "INBOX" + cyrus_delimiter + "decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas 1600 1607 nextMsgBox = get_current_folder(); 1601 1608 … … 1605 1612 openTab.type[ID] = 2; 1606 1613 proxy_mensagens.get_msg(folder.nextSibling.id,nextMsgBox,true,show_msg); 1614 select_msg('null', 'down', true); 1607 1615 }; 1608 1616 } … … 1635 1643 img_previous_msg.style.cursor = 'pointer'; 1636 1644 1637 if (!folder){ 1638 delete_border(ID); 1639 return; 1640 } 1645 1641 1646 if (folder){ // mensagem local criptografada nao tem ID da pasta local 1642 1647 if (folder.previousSibling) … … 1652 1657 openTab.type[ID] = 2; 1653 1658 proxy_mensagens.get_msg(folder.previousSibling.id,previousMsgBox,true,show_msg); 1659 select_msg('null', 'up', true); 1654 1660 }; 1655 1661 } … … 1730 1736 } 1731 1737 1738 if (info_msg.Flagged == 'F') 1739 { 1740 td.innerHTML += ' <img id="disposition_important_'+ID+'" style="cursor:pointer" alt="'+ get_lang('Important message') + '" title="'+ get_lang('Important message') + '" src="templates/'+template+'/images/important.gif">'; 1741 } 1732 1742 // NORMAL MSG 1733 1743 if(info_msg.Draft != 'X') … … 1736 1746 options.width = "30%"; 1737 1747 options.setAttribute("noWrap","true"); 1748 1749 //BEGIN: DESENHA MOSTRA DETALHES, OCULTAR DETALHES 1738 1750 var option_hide_more = document.createElement("SPAN"); 1739 1751 option_hide_more.className = 'message_options'; … … 1756 1768 resizeWindow(); 1757 1769 }; 1758 var option_mark = document.createElement('TD'); 1759 option_mark.align = "left"; 1760 option_mark.width = "50%"; 1761 var option_mark_as = '<span>'+get_lang("Mark as")+'</span>: '; 1770 //END: DESENHA MOSTRA DETALHES, OCULTAR DETALHES 1771 1772 //OPCAO PARA MARCAR COMO 1773 var option_mark_as = document.createElement("SPAN"); 1774 option_mark_as.innerHTML = "<b>"+get_lang('Mark as')+"</b>"; 1775 option_mark_as.className = 'message_options'; 1776 option_mark_as.onmouseover=function () {this.className='message_options_active';}; 1777 option_mark_as.onmouseout=function () {this.className='message_options'}; 1778 option_mark_as.onclick = function(){ 1779 verifyOption('tr_other_mark_options_', ID); 1780 var thi = document.getElementById('msg_opt_mark_options_'+ID); 1781 if (thi.value != 'hide'){ 1782 thi.value = 'hide'; 1783 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; 1784 Element('tr_other_mark_options_'+ID).style.display = ''; 1785 1786 } 1787 else{ 1788 thi.value = 'show'; 1789 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1790 Element('tr_other_mark_options_'+ID).style.display = 'none'; 1791 } 1792 }; 1793 //DESENHA OPCOES DO MARCAR COMO 1762 1794 var option_mark_as_unseen = document.createElement("SPAN"); 1763 option_mark_as_unseen.className = "message_options";1795 option_mark_as_unseen.className = "reply_options"; 1764 1796 option_mark_as_unseen.onclick = function () {changeLinkState(this,'seen'); 1765 1797 proxy_mensagens.proxy_set_message_flag(folder_id,'unseen'); 1766 1798 write_msg(get_lang('Message marked as ')+get_lang("Unseen")); 1767 1799 }; 1768 option_mark_as_unseen.onmouseover=function () {this.className='message_options_active';};1769 option_mark_as_unseen.onmouseout=function () {this.className='message_options'};1800 option_mark_as_unseen.onmouseover=function () {this.className='reply_options_active'}; 1801 option_mark_as_unseen.onmouseout=function () {this.className='reply_options'}; 1770 1802 option_mark_as_unseen.innerHTML = get_lang("Unseen"); 1771 1803 1772 1804 var option_mark_important = document.createElement("SPAN"); 1773 option_mark_important.className = 'message_options'; 1774 option_mark_important.style.paddingLeft = "10px"; 1775 option_mark_important.onmouseover=function () {this.className='message_options_active';}; 1776 option_mark_important.onmouseout=function () {this.className='message_options'}; 1805 option_mark_important.className = 'reply_options'; 1806 option_mark_important.onmouseover=function () {this.className='reply_options_active';}; 1807 option_mark_important.onmouseout=function () {this.className='reply_options'}; 1777 1808 1778 1809 if (info_msg.Flagged == "F"){ … … 1796 1827 option_mark_important.innerHTML = get_lang("Important"); 1797 1828 } 1798 option_mark.innerHTML = option_mark_as; 1799 option_mark.appendChild(option_mark_as_unseen); 1800 option_mark.appendChild(option_mark_important); 1829 //option_mark.appendChild(option_mark_as_unseen); 1830 //option_mark.appendChild(option_mark_important); 1831 1832 1801 1833 option_hide_more.innerHTML = get_lang('Show details'); 1834 option_hide_more.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'O') : get_lang('Show details'); 1835 1836 var space3 = document.createElement("SPAN"); 1837 space3.innerHTML = ' | '; 1838 1839 var option_mark_as_options = document.createElement('IMG'); 1840 option_mark_as_options.id = 'msg_opt_mark_options_'+ID; 1841 option_mark_as_options.src = '../expressoMail1_2/templates/default/images/down.png'; 1842 option_mark_as_options.value = 'show'; 1843 1844 option_mark_as_options.onmouseover = function(){ 1845 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/over.png'; 1846 option_mark_as.className = 'message_options_active'; 1847 }; 1848 option_mark_as_options.onmouseout = function(){ 1849 option_mark_as.className = 'message_options'; 1850 if (this.value == 'show') 1851 { 1852 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1853 } 1854 else 1855 { 1856 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; 1857 } 1858 }; 1859 option_mark_as_options.onclick = function(){ 1860 verifyOption('tr_other_mark_options_', ID); 1861 if (this.value != 'hide'){ 1862 this.value = 'hide'; 1863 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; 1864 Element('tr_other_mark_options_'+ID).style.display = ''; 1865 1866 } 1867 else{ 1868 this.value = 'show'; 1869 option_mark_as_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1870 Element('tr_other_mark_options_'+ID).style.display = 'none'; 1871 } 1872 }; 1873 1802 1874 options.appendChild(option_hide_more); 1875 options.appendChild(space3); 1876 options.appendChild(option_mark_as_options); 1877 options.appendChild(option_mark_as); 1878 //FIM OPCAO PARA MARCAR COMO 1803 1879 1804 1880 var space0 = document.createElement("SPAN"); … … 1809 1885 space2.innerHTML = ' | '; 1810 1886 1811 var option_forward = document.createElement("SPAN"); 1812 option_forward.id = 'msg_opt_forward_'+ID; 1813 option_forward.className = 'message_options'; 1814 option_forward.onclick = function(){new_message('forward', ID);}; 1815 option_forward.onmouseover=function () {this.className='message_options_active';}; 1816 option_forward.onmouseout=function () {this.className='message_options'}; 1817 option_forward.innerHTML = get_lang('Forward'); 1887 //OPCAO PARA MAIS ACOES 1888 var option_more = document.createElement("SPAN"); 1889 option_more.id = 'msg_opt_more_actions_'+ID; 1890 option_more.className = 'message_options'; 1891 //option_more.onclick = function(){new_message('forward', ID);}; 1892 option_more.onmouseover=function () {this.className='message_options_active';}; 1893 option_more.onmouseout=function () {this.className='message_options'}; 1894 option_more.onclick = function(){ 1895 verifyOption('tr_other_more_options_', ID); 1896 if (option_more_options.value != 'hide'){ 1897 option_more_options.value = 'hide'; 1898 option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; 1899 Element('tr_other_more_options_'+ID).style.display = ''; 1900 1901 } 1902 else{ 1903 option_more_options.value = 'show'; 1904 option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1905 Element('tr_other_more_options_'+ID).style.display = 'none'; 1906 } 1907 }; 1908 option_more.innerHTML = get_lang('More Actions'); 1909 1910 //CRIA IMG DE MAIS ACOES 1911 var option_more_options = document.createElement('IMG'); 1912 option_more_options.id = 'msg_opt_more_options_'+ID; 1913 option_more_options.src = '../expressoMail1_2/templates/default/images/down.png'; 1914 option_more_options.value = 'show'; 1915 1916 option_more_options.onmouseover = function(){ 1917 option_more.className = 'message_options_active'; 1918 option_more_options.src= '../expressoMail1_2/templates/default/images/over.png'; 1919 }; 1920 option_more_options.onmouseout = function(){ 1921 option_more.className = 'message_options'; 1922 if (this.value == 'show') 1923 { 1924 option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1925 } 1926 else 1927 { 1928 option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; 1929 } 1930 }; 1931 option_more_options.onclick = function(){ 1932 verifyOption('tr_other_more_options_',ID); 1933 1934 if (this.value != 'hide'){ 1935 this.value = 'hide'; 1936 option_more_options.src= '../expressoMail1_2/templates/default/images/pressed.png'; 1937 Element('tr_other_more_options_'+ID).style.display = ''; 1938 1939 } 1940 else{ 1941 this.value = 'show'; 1942 option_more_options.src= '../expressoMail1_2/templates/default/images/down.png'; 1943 Element('tr_other_more_options_'+ID).style.display = 'none'; 1944 } 1945 }; 1818 1946 options.appendChild(space1); 1819 options.appendChild(option_forward); 1947 options.appendChild(option_more_options); 1948 options.appendChild(option_more); 1949 //FIM OPCAO PARA MAIS ACOES 1950 1951 //OPCAO PARA RESPONDER 1820 1952 var option_reply = document.createElement("SPAN"); 1821 1953 option_reply.id = 'msg_opt_reply_'+ID; … … 1825 1957 option_reply.onmouseover=function () {this.className='message_options_active';}; 1826 1958 option_reply.onmouseout=function () {this.className='message_options'}; 1959 option_reply.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'R') : get_lang('Reply'); 1827 1960 1828 1961 options.appendChild(space2); … … 1847 1980 }; 1848 1981 option_reply_options.onclick = function(){ 1982 verifyOption('tr_other_options_', ID); 1849 1983 if (this.value != 'hide'){ 1850 1984 this.value = 'hide'; … … 1861 1995 options.appendChild(option_reply_options); 1862 1996 options.appendChild(option_reply); 1997 //FIM OPCAO PARA RESPONDER 1998 1999 //OPCAO PARA ENCAMINHAR 2000 var option_forward = document.createElement("SPAN"); 2001 option_forward.id = 'msg_opt_forward_'+ID; 2002 option_forward.className = 'message_options'; 2003 option_forward.innerHTML = get_lang('Forward'); 2004 option_forward.onclick = function(){new_message('forward', ID);}; 2005 option_forward.onmouseover=function () {this.className='message_options_active';}; 2006 option_forward.onmouseout=function () {this.className='message_options'}; 2007 option_forward.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'E') : get_lang('Forward'); 2008 2009 var space9 = document.createElement("SPAN"); 2010 space9.innerHTML = ' | '; 2011 2012 options.appendChild(space9); 2013 options.appendChild(option_forward); 2014 //FIM DA OPCAO PARA ENCAMINHAR 2015 2016 //OPCAO PARA DELETAR 2017 var option_delete = document.createElement("SPAN"); 2018 option_delete.id = 'msg_opt_delete_'+ID; 2019 option_delete.className = 'message_options'; 2020 option_delete.onclick = function(){proxy_mensagens.delete_msgs('null','selected','null');}; 2021 option_delete.innerHTML = get_lang('Delete'); 2022 option_delete.onmouseover=function () {this.className='message_options_active';}; 2023 option_delete.onmouseout=function () {this.className='message_options'}; 2024 option_delete.title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'Delete') : get_lang('Delete'); 2025 2026 var space6 = document.createElement("SPAN"); 2027 space6.innerHTML = ' | '; 2028 2029 options.appendChild(space6); 2030 options.appendChild(option_delete); 2031 //FIM OPCAO PARA DELETAR 1863 2032 1864 2033 tr.appendChild(td); 1865 tr.appendChild(option_mark);2034 //tr.appendChild(option_mark); 1866 2035 tr.appendChild(options); 1867 2036 tr.appendChild(next_previous_msg_td); … … 1870 2039 ////////// OTHER OPTIONS //////////////////// 1871 2040 var tr_other_options = document.createElement("TR"); 2041 var tr_other_mark_options = document.createElement("TR"); 2042 var tr_other_more_options = document.createElement("TR"); 2043 2044 tr_other_mark_options.id = 'tr_other_mark_options_' + ID; 2045 tr_other_mark_options.style.display = 'none'; 2046 tr_other_mark_options.style.backgroundColor = '#205C8E'; 1872 2047 tr_other_options.id = 'tr_other_options_' + ID; 1873 2048 tr_other_options.style.display = 'none'; 2049 tr_other_options.style.backgroundColor = '#205C8E'; 2050 tr_other_more_options.id = 'tr_other_more_options_' + ID; 2051 tr_other_more_options.style.display = 'none'; 2052 tr_other_more_options.style.backgroundColor = '#205C8E'; 1874 2053 1875 2054 var td_other_options = document.createElement("TD"); 2055 var td_other_mark_options = document.createElement("TD"); 2056 var td_other_more_options = document.createElement("TD"); 2057 1876 2058 td_other_options.colSpan = '3'; 2059 td_other_mark_options.colSpan = '3'; 2060 td_other_more_options.colSpan = '3'; 2061 1877 2062 var div_other_options = document.createElement("DIV"); 1878 1879 var option_mark_as_unseen = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unseen\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, '; 1880 var option_mark_as_important = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'flagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, '; 1881 var option_mark_as_normal = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span> | '; 1882 1883 var option_move = '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","move_to");>'+get_lang("Move")+'</span> | '; 1884 var option_reply_to_all = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_with_history","'+ID+'");>'+get_lang("Reply to all")+'</span> | '; 2063 var div_other_mark_options = document.createElement("DIV"); 2064 var div_other_more_options = document.createElement("DIV"); 2065 2066 //var option_mark_as_unseen = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unseen\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, '; 2067 //var option_mark_as_important = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'flagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, '; 2068 //var option_mark_as_normal = '<span class="message_options" onclick="proxy_mensagens.proxy_set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span> | '; 2069 var block_user = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick ="filter.new_rule(\''+info_msg.from.email+'\');">'+get_lang("Block Sender")+'</span> | '; 2070 //var option_forward = '<span onclick="new_message(\'forward\',\''+ ID+'\');" onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options">'+get_lang("Forward")+'</span> | '; 2071 var option_move = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=wfolders.makeWindow("'+ID+'","move_to");>'+get_lang("Move")+'</span> | '; 2072 var option_print = '<span onclick="print_all()" onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options">'+get_lang("Print")+'</span> | '; 2073 var option_export = '<span onclick="proxy_mensagens.export_all_messages()" onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options">'+get_lang("Export")+'</span> | '; 2074 2075 option_reply_to_all__title = (preferences.use_shortcuts == '1') ? get_lang('Shortcut: %1', 'T') : ''; 2076 var option_reply_to_all = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick="new_message(\'reply_to_all_with_history\',\''+ID+'\');" title="'+option_reply_to_all__title+'">'+get_lang("Reply to all")+'</span> | '; 1885 2077 var option_reply_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_without_history","'+ID+'");>'+get_lang("Reply without history")+'</span> | '; 1886 var option_reply_to_all_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_without_history","'+ID+'");>'+get_lang("Reply to all without history")+'</span>'; 1887 1888 div_other_options.innerHTML = option_reply_to_all + option_reply_without_history + option_reply_to_all_without_history; 2078 var option_reply_to_all_without_history = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=new_message("reply_to_all_without_history","'+ID+'");>'+get_lang("Reply to all without history")+'</span> | '; 2079 2080 var report_error = '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick=reports_window("'+currentTab+'");>'+get_lang("Report error")+'</span> | '; 2081 2082 div_other_more_options.innerHTML += option_move + option_print + option_export + block_user + report_error; 2083 2084 div_other_options.innerHTML += option_reply_without_history + option_reply_to_all_without_history + option_reply_to_all; 1889 2085 if (use_spam_filter) { 1890 if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam') 1891 div_other_options.innerHTML += ' | <span class="message_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\')";>'+get_lang("Not Spam")+'</span>'; 1892 else 1893 div_other_options.innerHTML += ' | <span class="message_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\')";>'+get_lang("Mark as Spam")+'</span>'; 1894 } 2086 if(info_msg.msg_folder == 'INBOX'+cyrus_delimiter+'Spam' || (info_msg.msg_folder.match(/^user/) && info_msg.msg_folder.match(/Spam$/))){ 2087 div_other_mark_options.innerHTML += '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick="nospam('+info_msg.msg_number+',\'null\', \''+info_msg.msg_folder+'\');">'+get_lang("Not Spam")+'</span> | '; 2088 } 2089 else{ 2090 div_other_mark_options.innerHTML += '<span onmouseover="this.className=\'reply_options_active\'" onmouseout="this.className=\'reply_options\'" class="reply_options" onclick="spam(\''+info_msg.msg_folder+'\', '+info_msg.msg_number+',\'null\');">'+get_lang("Is Spam")+'</span> | '; 2091 } 2092 } 2093 var space5 = document.createElement("SPAN"); 2094 space5.innerHTML = ' | '; 1895 2095 1896 var report_error = ' | <span onmouseover="this.className=\'message_options_active\'" onmouseout="this.className=\'message_options\'" class="message_options" onclick=reports_window("'+currentTab+'");>'+get_lang("Report error")+'</span> |'; 1897 1898 div_other_options.innerHTML += report_error; 2096 div_other_mark_options.appendChild(option_mark_as_unseen); 2097 var space4 = document.createElement("SPAN"); 2098 space4.innerHTML = ' | '; 2099 div_other_mark_options.appendChild(space4); 2100 div_other_mark_options.appendChild(option_mark_important); 2101 var space7 = document.createElement("SPAN"); 2102 space7.innerHTML = ' | '; 2103 div_other_mark_options.appendChild(space7); 1899 2104 1900 2105 td_other_options.align = 'right'; … … 1902 2107 td_other_options.appendChild(div_other_options); 1903 2108 2109 td_other_mark_options.align = 'right'; 2110 td_other_mark_options.style.paddingTop = '3px'; 2111 td_other_mark_options.appendChild(div_other_mark_options); 2112 2113 td_other_more_options.align = 'right'; 2114 td_other_more_options.style.paddingTop = '3px'; 2115 td_other_more_options.appendChild(div_other_more_options); 2116 1904 2117 1905 2118 tr_other_options.appendChild(td_other_options); 1906 2119 tbody_message_options.appendChild(tr_other_options); 2120 2121 tr_other_more_options.appendChild(td_other_more_options); 2122 tbody_message_options.appendChild(tr_other_more_options); 2123 2124 tr_other_mark_options.appendChild(td_other_mark_options); 2125 tbody_message_options.appendChild(tr_other_mark_options); 1907 2126 ////////// END OTHER OPTIONS //////////////// 1908 2127 … … 1939 2158 td_signature.innerHTML += '<span style=color:red><strong>'+get_lang(info_msg.signature[i].substring(0,info_msg.signature[i].indexOf("#@#")))+'</strong> '+info_msg.signature[i].substring(info_msg.signature[i].indexOf("#@#")+3)+'</span> <br /> '; 1940 2159 } 1941 else1942 {1943 2160 if(info_msg.signature[i].indexOf("###") > -1) 1944 2161 { 1945 2162 td_signature.innerHTML += '<span><strong>'+get_lang(info_msg.signature[i].substring(0,info_msg.signature[i].indexOf("###")))+'</strong> '+info_msg.signature[i].substring(info_msg.signature[i].indexOf("###")+3)+'</span> <br /> '; 1946 2163 } 1947 else1948 {1949 td_signature.innerHTML += '<span><strong>'+get_lang(info_msg.signature[i])+'</strong></span> <br /> ';1950 }1951 }1952 2164 } 1953 2165 var signature_status_pos = info_msg.signature[0].indexOf('Message untouched'); … … 2051 2263 table_message_others_options.width = "100%"; 2052 2264 table_message_others_options.style.display = 'none'; 2053 table_message_others_options.className = "table_message"; 2265 if(navigator.appName.indexOf('Internet Explorer')>0){ 2266 table_message_others_options.className = "table_message_options_ie"; 2267 }else{ 2268 table_message_others_options.className = "table_message_options"; 2269 } 2270 2054 2271 var tbody_message_others_options = document.createElement("TBODY"); 2055 2272 var tr1 = document.createElement("TR"); … … 2129 2346 tr2.className = "tr_message_header"; 2130 2347 var td2 = document.createElement("TD"); 2348 td2.width = "7%"; 2131 2349 td2.innerHTML = get_lang("To: "); 2132 2350 var to = document.createElement("TD"); … … 2293 2511 if ( info_msg.attachments && info_msg.attachments.length > 0 ) 2294 2512 { 2295 var div_attach = document.createElement("DIV"); 2296 div_attach.setAttribute("class", "expressomail-attachments"); 2297 div_attach.setAttribute("className", "expressomail-attachments"); //for IE 2298 2299 var div_attach_lbl = document.createElement("span"); 2300 div_attach_lbl.setAttribute("class", "expressomail-attachments-label"); 2301 div_attach_lbl.setAttribute("className", "expressomail-attachments-label"); //for IE 2302 div_attach_lbl.innerHTML = get_lang("Attachments: "); 2513 //Código no padrão expresso 2.2 2514 var tr6 = document.createElement("TR"); 2515 tr6.className = "tr_message_header"; 2516 var td6 = document.createElement("TD"); 2517 td6.innerHTML = get_lang("Attachments: "); 2303 2518 2304 var div_attach_list = document.createElement("UL");2305 div_attach_list.setAttribute("id", "attachments_" + ID);2306 div_attach_list.setAttribute("class", "expressomail-attachments-list");2307 div_attach_list.setAttribute("className", "expressomail-attachments-list"); //for IE2308 2519 2520 var attachments = document.createElement("TD"); 2521 td6.valign = "top"; 2522 attachments.align = 'left'; 2523 if(info_msg.attachments.length >= 1){ 2309 2524 if(info_msg.attachments.length > 1) { 2310 var li_link_attachment = document.createElement("LI");2311 2525 var link_attachment = document.createElement("A"); 2312 link_attachment.setAttribute("class", "expressomail-attachments-link");2313 link_attachment.setAttribute("className", "expressomail-attachments-link"); //for IE2314 2315 2526 if(proxy_mensagens.is_local_folder(current_folder)) 2316 2527 link_attachment.setAttribute("href", "javascript:expresso_local_messages.download_all_local_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); … … 2318 2529 link_attachment.setAttribute("href", "javascript:download_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 2319 2530 link_attachment.innerHTML = " "+info_msg.attachments.length+' '+get_lang('files')+' :: '+get_lang('Download all atachments'); 2320 li_link_attachment.appendChild(link_attachment); 2321 div_attach_list.appendChild(li_link_attachment); 2322 } 2323 2531 attachments.appendChild(link_attachment); 2532 } 2324 2533 if(parseInt(preferences.remove_attachments_function)) 2325 2534 { 2326 var li_link_attachment = document.createElement("LI"); 2327 var link_attachment = document.createElement("A"); 2328 link_attachment.setAttribute("class", "expressomail-attachments-link"); 2329 link_attachment.setAttribute("className", "expressomail-attachments-link"); //for IE 2330 link_attachment.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 2331 link_attachment.innerHTML = get_lang('remove all attachments'); 2332 2333 li_link_attachment.appendChild(link_attachment); 2334 div_attach_list.appendChild(li_link_attachment); 2335 } 2336 2535 attachments.appendChild(document.createTextNode(' ')); 2536 var del_attachments = document.createElement("A"); 2537 del_attachments.setAttribute("href", "javascript:remove_all_attachments('"+info_msg.msg_folder+"','"+info_msg.msg_number+"')"); 2538 del_attachments.innerHTML = get_lang('remove all attachments'); 2539 attachments.appendChild(del_attachments); 2540 } 2541 attachments.appendChild(document.createElement('BR')); 2542 } 2543 attachments.id = "attachments_" + ID; 2337 2544 for (var i=0; i<info_msg.attachments.length; i++) 2338 2545 { 2339 var li_link_attachment = document.createElement("LI"); 2340 var link_attachment = document.createElement("A"); 2546 var link_attachment = document.createElement("a"); 2341 2547 link_attachment.setAttribute("href", proxy_mensagens.link_anexo(info_msg,i)); 2342 2548 link_attachment.innerHTML = url_decode(info_msg.attachments[i].name) + " ("+borkb(info_msg.attachments[i].fsize)+")"; 2343 link_attachment.setAttribute("name", url_decode(info_msg.attachments[i].name));2549 //link_attachment.innerHTML += " ("+borkb(info_msg.attachments[i].fsize)+")"; 2344 2550 2345 2551 //k trocar por match??? … … 2357 2563 } 2358 2564 2359 li_link_attachment.appendChild(link_attachment); 2360 div_attach_list.appendChild(li_link_attachment); 2361 } 2362 div_attach.appendChild(div_attach_lbl); 2363 div_attach.appendChild(div_attach_list); 2565 if((url_decode(info_msg.attachments[i].name).indexOf(".eml") != -1)) 2566 { 2567 //Link para importar calendário 2568 var link_open_msg = new Image(); 2569 link_open_msg.src = "templates/"+template+"/images/email.png"; 2570 //link_open_msg.setAttribute("onclick","javascript:import_calendar('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"&idx_file="+i+"&encoding="+info_msg.attachments[i].encoding+"'); return false;"); 2571 link_open_msg.setAttribute("onclick","javascript:open_msg_part('"+info_msg.msg_folder+"&msg_number="+info_msg.msg_number+"&msg_part="+info_msg.attachments[i].pid+"'); return false;"); 2572 link_open_msg.title = get_lang("Open message"); 2573 link_open_msg.align = "top"; 2574 link_open_msg.style.marginLeft = "5px"; 2575 link_open_msg.style.cursor = "pointer"; 2576 link_attachment.appendChild(link_open_msg); 2577 } 2364 2578 2365 var tr6 = document.createElement("TR"); 2366 tr6.className = "tr_message_header"; 2367 var td6 = document.createElement("TD"); 2368 td6.setAttribute("colspan", "2"); 2369 td6.vAlign = "top"; 2370 td6.appendChild(div_attach); 2579 link_attachment.innerHTML += '<br/>'; 2580 attachments.appendChild(link_attachment); 2581 } 2371 2582 tr6.appendChild(td6); 2583 tr6.appendChild(attachments); 2372 2584 tbody_message_others_options.appendChild(tr6); 2373 2585 } 2586 2374 2587 //k!! 2375 2588 var div = document.createElement("DIV"); 2376 2589 div.id = "div_message_scroll_"+ID; 2377 div.setAttribute('class', 'div_message_scroll');2378 div.setAttribute('className', 'div_message_scroll'); //for IE 2590 div.style.background = 'WHITE'; 2591 div.style.overflow = "auto"; 2379 2592 table_message_others_options.appendChild(tbody_message_others_options); 2380 2593 var tr = document.createElement("TR"); 2594 tr.className = "tr_message_header"; 2381 2595 var td = document.createElement("TD"); 2382 td.colSpan = '2';2596 td.colspan = '2'; 2383 2597 td.style.fontSize = '10pt'; 2384 2598 td.style.fontFamily = 'Arial,Verdana'; … … 2401 2615 for (var i = 0; i < domains.length; i++) 2402 2616 { 2403 if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/ show_embedded_attach\.php/g))2617 if (imgTag[j].match(/cid:([\w\d]){5,}/) || imgTag[j].match(/src=\"\.\/inc\/get_archive\.php/g)) 2404 2618 { 2405 2619 forbidden = false; … … 2412 2626 if (forbidden) 2413 2627 { 2414 newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden. jpg'>");2628 newBody = newBody.replace(imgTag[j],"<img src='templates/"+template+"/images/forbidden.png'>"); 2415 2629 blocked=true; 2416 2630 } … … 2441 2655 newBody = newBody.replace("<body","<span"); 2442 2656 newBody = newBody.replace("<BODY","<span"); 2443 //while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) )2444 //newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' );2657 while ( ( /<span[^>]*><span[^>]*>/ig ).test( newBody ) ) 2658 newBody = newBody.replace( /(<span[^>]*>)<span[^>]*>/ig, '$1' ); 2445 2659 2446 2660 var _body = document.createElement( 'div' ); 2447 2661 _body.id = 'body_' + ID; 2448 2662 _body.innerHTML = newBody; 2449 _body.style.fontSize = '16px';2663 //_body.style.fontSize = '16px'; 2450 2664 2451 2665 var _elements = _body.getElementsByTagName( '*' ); … … 2487 2701 2488 2702 if ((info_msg.thumbs)&&(info_msg.thumbs.length > 0)){ 2489 var div_thumbs = document.createElement("DIV"); 2703 var thumbs = jQuery.parseJSON(info_msg.thumbs); 2704 var div_thumbs = document.createElement("div"); 2705 2490 2706 div_thumbs.setAttribute("class", "expressomail-thumbs"); 2491 2707 div_thumbs.setAttribute("className", "expressomail-thumbs"); //for IE … … 2526 2742 ul_thumbs_list.setAttribute("className", "expressomail-thumbs-list"); //for IE 2527 2743 2528 for (var i=0; i<info_msg.thumbs.length; i++){ 2529 var li = document.createElement("LI"); 2530 li.innerHTML += info_msg.thumbs[i]; 2531 ul_thumbs_list.appendChild(li); 2532 } 2744 var msg = info_msg.msg_number; 2745 var fdr = info_msg.msg_folder; 2746 var i = 0; 2747 //verifica se está no novo padrão de montagem das mensagens ou no antigo, necessário 2748 //para exibir as imagens no arquivamento local arquivamento local. 2749 if(thumbs){ 2750 jQuery.each(thumbs, function(i, thumb) { 2751 if(fdr.indexOf("local_") >= 0){ 2752 var href = info_msg.array_attach[i].url + '&image=true'; 2753 var src = info_msg.array_attach[i].url+ '&image=thumbnail'; 2754 i++; 2755 }else{ 2756 var href = './inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=true'; 2757 //var href = thumb.url; 2758 var src = 'inc/get_archive.php?msgFolder=' + fdr + '&msgNumber=' + msg + '&indexPart=' + thumb.pid + '&image=thumbnail'; 2759 } 2760 var msgid= fdr+";;"+msg+";;"+i+";;"+thumb.pid+";;"+thumb.encoding; 2761 var image_info = '{"folder":"'+fdr+'","message":"'+msg+'","thumbIndex":"'+i+'","pid":"'+thumb.pid+'","encoding":"'+thumb.encoding+'","type":"'+thumb.type+'"}'; 2762 2763 var image= '<img id="' + msgid + '" title="' + 2764 get_lang('Click here do view (+)') + '" src="' + src + '" style="width:auto;height:100%;" />'; 2765 2766 var content = '<a title="'+thumb.name+ '" rel="thumbs'+ID+'" class="expressomail-thumbs-link" onMouseDown="save_image(event,this,\'' +thumb.type+'\')" href="'+href+'" onclick="window.open(\''+href+'\',\'mywindow\',\'width=700,height=600,scrollbars=yes\');return false;">'+image+'</a>'; 2767 content += '<input id="thumb_'+ID+'_'+i+'" type="hidden" value="' +escape(image_info) +'" />'; 2768 jQuery(ul_thumbs_list).append('<li>'+content+'</li>'); 2769 2770 }); 2533 2771 2534 2772 div_thumbs.appendChild(div_thumbs_lbl); 2535 2773 div_thumbs.appendChild(div_thumbs_lbl_sp2); 2536 2774 div_thumbs.appendChild(ul_thumbs_list); 2775 2776 }else{ 2777 div_thumbs.appendChild(div_thumbs_lbl); 2778 div_thumbs.appendChild(div_thumbs_lbl_sp2); 2779 div_thumbs.innerHTML = div_thumbs.innerHTML + info_msg.thumbs; 2780 2781 2782 } 2537 2783 2538 2784 div.appendChild(div_thumbs); … … 2560 2806 } 2561 2807 2562 //k!2563 2808 /* 2564 2809 * TODO: implementar o controle como preferência do usuário … … 2566 2811 */ 2567 2812 var jcarousel = false; 2568 2569 2813 if (jcarousel) { 2814 //carousel 2570 2815 jQuery(document).ready(function() { 2571 jQuery('.expressomail-thumbs-list').attr('id', 'expressomail-thumbs-list'+ID); 2572 jQuery('.expressomail-thumbs-list').addClass('jcarousel-skin-default'); 2573 jQuery('#expressomail-thumbs-list'+ID).jcarousel({ 2574 // Configuration 2575 }); 2576 }); 2816 jQuery('.expressomail-thumbs-list').attr('id', 'expressomail-thumbs-list'+ID) 2817 .addClass('jcarousel-skin-default').jcarousel(); 2818 2819 jQuery('.expressomail-thumbs-link img').attr('style', ''); 2577 2820 2578 2821 //fancybox 2579 jQuery(document).ready(function() {2580 2822 jQuery(".expressomail-thumbs-list li a").attr('onclick', 'return true;'); 2581 2823 jQuery(".expressomail-thumbs-list li a").fancybox({ 2582 2824 'hideOnContentClick': true, 2583 'type': 'image' 2825 'type': 'image', 2826 'titlePosition': 'over', 2827 'titleFormat' : function(name, currentArray, currentIndex, currentOpts) { 2828 var image_info = $('#thumb_'+ID+'_'+currentIndex).val(); 2829 2830 return '<div id="fancybox-title" class="fancybox-title-over" style="width: 100%; display: block;">' + 2831 '<div id="fancybox-title-over">' + 2832 '<a title="Anterior" onclick="javascript:$.fancybox.prev();" style="float:left;">' + 2833 '<img src="./templates/'+template+'/images/left_arrow_white.png" width="30" height="30" />' + 2834 '</a>'+ 2835 '<a title="Baixar imagem" onclick="javascript:save_image2(\''+image_info+'\');" style="padding:0 5px;">' + 2836 '<img src="./templates/'+template+'/images/image_down.png" width="22" height="22" />' + 2837 '</a>'+ 2838 '<a title="Baixar todas de uma vez" onclick="javascript:download_all_attachments(\''+info_msg.msg_folder+"','"+info_msg.msg_number+'\')" style="padding:0 5px;">'+ 2839 '<img src="./templates/'+template+'/images/package_down.png" width="26" height="26" />' + 2840 '</a>'+ 2841 '<span style="margin-left:5px; margin-top:7px; position:absolute;">'+name+'</span>'+ 2842 '<a title="Próxima" onclick="javascript:$.fancybox.next();" style="float:right;">' + 2843 '<img src="./templates/'+template+'/images/right_arrow_white.png" width="30" height="30" />' + 2844 '</a>' + 2845 '</div>' + 2846 '</div>'; 2847 } 2584 2848 }); 2585 2849 }); 2586 } 2587 //k!! 2850 } 2851 2852 resizeWindow(); 2588 2853 } 2589 2854 … … 2630 2895 function draw_new_message(border_ID){ 2631 2896 connector.loadScript("color_palette"); 2632 connector.loadScript("rich_text_editor");2633 2897 connector.loadScript('wfolders'); 2634 2898 if(typeof(RichTextEditor) == 'undefined' || typeof(ColorPalette) == 'undefined' || typeof(wfolders) == 'undefined') … … 2638 2902 if (ID == 0) 2639 2903 return 0; 2904 else if(ID == 'maximo') 2905 return 'maximo'; 2640 2906 hold_session = true; 2641 2907 … … 2675 2941 2676 2942 if ((preferences.save_in_folder == '-1') || (preferences.save_in_folder == '')){ 2677 //var option_send = '<spanclass="message_options" onclick=send_message("'+ID+'","null","null");>'+get_lang("Send")+'</span> | ';2678 var option_send = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send and not file")+'" onclick=send_message("'+ID+'","null","null");>' + ' | ';2943 var option_send = '<span id="send_button_'+ID+'" class="message_options" onclick=send_message("'+ID+'","null","null");>'+get_lang("Send")+'</span> | '; 2944 //var option_send = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send and not file")+'" onclick=send_message("'+ID+'","null","null");>' + ' | '; 2679 2945 if(!expresso_offline) 2680 2946 var option_send_and_file= '<span class="message_options" onclick=wfolders.makeWindow("'+ID+'","send_and_file");>'+get_lang("Send and file")+'</span> | '; … … 2683 2949 } 2684 2950 else{ 2685 //var option_send = '<spanclass="message_options" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">'+get_lang("Send")+'</span> | ';2686 var option_send = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send")+'" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">' + ' | ';2951 var option_send = '<span id="send_button_'+ID+'" class="message_options" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">'+get_lang("Send")+'</span> | '; 2952 //var option_send = '<input type="button" id="send_button_'+ID+'" class="em_button_like_span" tabindex="1" value="'+get_lang("Send")+'" onclick="send_message(\''+ID+'\',\''+preferences.save_in_folder+'\',\'null\');">' + ' | '; 2687 2953 var option_send_and_file=''; 2688 2954 wfolders.alert = true; … … 2797 3063 var img_search = document.createElement("IMG"); 2798 3064 img_search.src = "./templates/"+template+"/images/search.gif"; 2799 img_search.onclick = function () {emQuickSearch(document.getElementById('replyto_'+ID).value, 'replyto', ID)} 3065 img_search.onclick = function () { 3066 emQuickSearch(document.getElementById('replyto_'+ID).value, 'replyto', ID) 3067 } 2800 3068 img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); 2801 3069 var span_search = document.createElement("SPAN"); … … 2887 3155 img_search.src = "./templates/"+template+"/images/search.gif"; 2888 3156 img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); 2889 img_search.onclick = function () {emQuickSearch(document.getElementById('to_'+ID).value, 'to', ID);}; 3157 img_search.onclick = function () { 3158 emQuickSearch(document.getElementById('to_'+ID).value, 'to', ID); 3159 }; 2890 3160 } 2891 3161 else { … … 2974 3244 var img_search = document.createElement("IMG"); 2975 3245 img_search.src = "./templates/"+template+"/images/search.gif"; 2976 img_search.onclick = function () {emQuickSearch(document.getElementById('cc_'+ID).value, 'cc', ID)} 3246 img_search.onclick = function () { 3247 emQuickSearch(document.getElementById('cc_'+ID).value, 'cc', ID) 3248 } 2977 3249 img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); 2978 3250 var span_search = document.createElement("SPAN"); … … 3062 3334 img_search.src = "./templates/"+template+"/images/search.gif"; 3063 3335 img_search.title = get_lang('Search') + " | " + get_lang('Use F9 Key as shortcut.'); 3064 img_search.onclick = function () {emQuickSearch(document.getElementById('cco_'+ID).value, 'cco', ID);}; 3336 img_search.onclick = function () { 3337 emQuickSearch(document.getElementById('cco_'+ID).value, 'cco', ID); 3338 }; 3065 3339 var span_search = document.createElement("SPAN"); 3066 3340 span_search.innerHTML = get_lang('Search'); … … 3090 3364 a_cc_link.setAttribute("href","javascript:void(0)"); 3091 3365 a_cc_link.setAttribute("tabIndex","-1"); 3092 a_cc_link.onclick = function () {this.style.display='none';document.getElementById('tr_cc_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cc.focus();return false;} 3366 a_cc_link.onclick = function () { 3367 this.style.display='none'; 3368 document.getElementById('tr_cc_'+ID).style.display=''; 3369 if(document.getElementById('space_link_'+ID) !== null) 3370 document.getElementById('space_link_'+ID).style.display='none'; 3371 input_cc.focus(); 3372 return false;}; 3093 3373 td2_link.appendChild(a_cc_link); 3094 var space = document.createElement("span");3095 space.id ="space_link_"+ID;3096 space.innerHTML=" | ";3097 td2_link.appendChild(space);3098 var a_cco_link = document.createElement('A');3099 a_cco_link.innerHTML = get_lang('Add BCC');3100 a_cco_link.id = "a_cco_link_"+ID;3101 a_cco_link.setAttribute("href","javascript:void(0)");3102 a_cco_link.setAttribute("tabIndex","-1");3103 a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus();return false;}3104 td2_link.appendChild(a_cco_link);3105 3374 var space = document.createElement("span"); 3106 3375 … … 3115 3384 a_cco_link.setAttribute("href","javascript:void(0)"); 3116 3385 a_cco_link.setAttribute("tabIndex","-1"); 3117 a_cco_link.onclick = function () {this.style.display='none';document.getElementById('tr_cco_'+ID).style.display='';document.getElementById('space_link_'+ID).style.display='none';input_cco.focus(); return false;} 3386 a_cco_link.onclick = function () { 3387 this.style.display='none'; 3388 document.getElementById('tr_cco_'+ID).style.display=''; 3389 if(document.getElementById('space_link_'+ID) !== null) 3390 document.getElementById('space_link_'+ID).style.display='none'; 3391 input_cco.focus(); 3392 return false;}; 3118 3393 td2_link.appendChild(a_cco_link); 3119 3394 } … … 3151 3426 ////////////////////////////////////////////////////////////////////////////////////////////////////// 3152 3427 var tr5 = document.createElement("TR"); 3153 var td5 = document.createElement("TD"); 3154 td5.innerHTML = " "; 3155 var td_return_receipt = document.createElement("TD"); 3156 td_return_receipt.setAttribute("noWrap","true"); 3157 td_return_receipt.innerHTML = get_lang("Return receipt")+":"; 3158 if (is_ie) 3159 { 3160 var input_return_receipt = document.createElement('input name=input_return_receipt'); 3161 } 3162 else 3163 { 3164 var input_return_receipt = document.createElement('input'); 3165 input_return_receipt.name = "input_return_receipt"; 3166 } 3167 input_return_receipt.type = "checkbox"; 3168 input_return_receipt.className = "checkbox"; 3169 input_return_receipt.id = "return_receipt_"+ID; 3170 3171 if(preferences.return_recipient_deafault != '0'){ 3172 if (is_ie){ 3173 input_return_receipt.checked=true; 3174 } 3175 else{ 3176 input_return_receipt.defaultChecked=true; 3177 } 3178 } 3179 3180 input_return_receipt.setAttribute("tabIndex","-1"); 3181 td_return_receipt.appendChild(input_return_receipt); 3182 3183 // Workaround para resolver problema ao enviar e-mails 3184 if((preferences.use_assinar_criptografar != '0')) 3185 { 3186 if(parseInt(preferences.use_signature_digital_cripto)==1) 3187 { 3188 td_return_receipt.innerHTML += " " + get_lang("Digitally sign message?")+""; 3189 3190 if (is_ie) 3191 { 3192 var input_return_digital = document.createElement('input name=input_return_digital'); 3193 } 3194 else 3195 { 3196 var input_return_digital = document.createElement('input'); 3197 input_return_digital.name = "input_return_digital"; 3198 } 3199 3200 input_return_digital.type = "checkbox"; 3201 input_return_digital.className = "checkbox"; 3202 input_return_digital.id = "return_digital_"+ID; 3203 input_return_digital.setAttribute("tabIndex","-1"); 3204 if(parseInt(preferences.use_signature_digital)==1) 3205 { 3206 if (is_ie) 3428 var td_content = ''; 3429 3430 if((preferences.use_assinar_criptografar != '0')) { 3431 if(parseInt(preferences.use_signature_digital_cripto)==1) { 3432 var input_return_digital_chk = (parseInt(preferences.use_signature_digital)==1) ? 'checked="checked"' : ''; 3433 var input_return_digital = '<input type="checkbox" class="checkbox" name="input_return_digital" id="return_digital_'+ID+'" tabIndex="-1" '+input_return_digital_chk+' />'; 3434 var label_return_digital = '<label for="return_digital_'+ID+'">'+get_lang("Digitally sign message?")+'</label>'; 3435 3436 td_content += input_return_digital + label_return_digital; 3437 3438 var input_return_cripto_chk = (parseInt(preferences.use_signature_cripto)==1) ? 'checked="checked"' : ''; 3439 var input_return_cripto = '<input type="checkbox" class="checkbox" name="input_return_cripto" id="return_cripto_'+ID+'" tabIndex="-1" '+input_return_cripto_chk+' />'; 3440 var label_return_cripto = '<label for="return_cripto_'+ID+'">'+get_lang("Digitally crypt message?")+'</label>'; 3441 3442 td_content += input_return_cripto + label_return_cripto; 3443 } 3444 } 3445 3446 var input_return_receipt_chk = (preferences.return_recipient_deafault != '0') ? 'checked="checked"' : ''; 3447 var input_return_receipt = '<input type="checkbox" class="checkbox" name="input_return_receipt" id="return_receipt_'+ID+'" tabIndex="-1" '+input_return_receipt_chk+' />'; 3448 var label_return_receipt = '<label for="return_receipt_'+ID+'">'+get_lang("Return receipt")+'</label>'; 3449 3450 td_content += input_return_receipt + label_return_receipt; 3451 3452 if (parseInt(preferences.use_important_flag)) 3207 3453 { 3208 input_return_digital.checked=true; 3209 } 3210 else 3211 { 3212 input_return_digital.defaultChecked=true; 3213 } 3214 } 3215 td_return_receipt.appendChild(input_return_digital); 3216 td_return_receipt.innerHTML += " " + get_lang("Digitally crypt message?")+""; 3217 3218 if (is_ie) 3219 { 3220 var input_return_cripto = document.createElement('input name=input_return_cripto'); 3221 } 3222 else 3223 { 3224 var input_return_cripto = document.createElement('input'); 3225 input_return_cripto.name = "input_return_cripto"; 3226 } 3227 3228 input_return_cripto.type = "checkbox"; 3229 input_return_cripto.className = "checkbox"; 3230 input_return_cripto.id = "return_cripto_"+ID; 3231 input_return_cripto.setAttribute("tabIndex","-1"); 3232 input_return_cripto.defaultChecked=false; 3233 3234 if(parseInt(preferences.use_signature_cripto)==1) 3235 { 3236 if (is_ie) 3237 { 3238 input_return_cripto.checked=true; 3239 } 3240 else 3241 { 3242 input_return_cripto.defaultChecked=true; 3243 } 3244 } 3245 3246 td_return_receipt.appendChild(input_return_cripto); 3247 } 3248 } 3249 td_return_receipt.innerHTML += ""; 3250 tr5.appendChild(td5); 3251 tr5.appendChild(td_return_receipt); 3252 3253 if ( ! expresso_offline ) 3254 { 3255 var text_plain = td_return_receipt.appendChild( 3256 document.createElement( 'span' ) 3257 ).appendChild( 3258 document.createTextNode( ' | ' ) 3259 ).parentNode.appendChild( 3260 document.createTextNode( get_lang('Send this mail as text plain') + '.') 3261 ).parentNode.appendChild( 3262 document.createElement( 'input' ) 3263 ); 3264 text_plain.setAttribute( 'tabIndex', '-1' ); 3265 text_plain.id = 'textplain_rt_checkbox_' + ID ; 3266 text_plain.type = "checkbox"; 3267 text_plain.onclick = function () 3268 { 3269 RichTextEditor.setPlain( this.checked, ID ); 3270 }; 3454 var input_important = '<input type="checkbox" class="checkbox" id="important_message_'+ID+'" name="input_important_message" tabIndex="-1"/>'; 3455 var label_important = '<label for="important_message_'+ID+'">'+get_lang("Important message")+'</label>'; 3456 //jQuery(tbody_message).append('<tr><td> </td><td>'+input_important+label_important+'</td</tr>'); 3457 3458 td_content += input_important + label_important; 3459 } 3460 3461 if (!expresso_offline) { 3462 var onclk_text_plain = 'javascript:RichTextEditor.setPlain(this.checked, '+ID+');'; 3463 var input_text_plain = '<input type="checkbox" class="checkbox" name="textplain_rt_checkbox" id="textplain_rt_checkbox_'+ID+'" tabIndex="-1" onclick="'+onclk_text_plain+'"/>'; 3464 var label_text_plain = '<label for="textplain_rt_checkbox_'+ID+'">'+get_lang('Simple text mode')+'</label>'; 3271 3465 3272 } 3273 3466 td_content += input_text_plain + label_text_plain; 3467 } 3468 3469 jQuery(tr5).append('<td> </td><td class="message-general-options">'+td_content+'</td>'); 3274 3470 3275 3471 tbody_message.appendChild(tr5); 3276 if (parseInt(preferences.use_important_flag))3277 {3278 var trn = document.createElement("TR");3279 var tdn = document.createElement("TD");3280 tdn.innerHTML = " ";3281 var td_important_msg = document.createElement("TD");3282 td_important_msg.setAttribute("noWrap","true");3283 td_important_msg.innerHTML = get_lang("Important message")+":";3284 var input_important_message = document.createElement('input');3285 input_important_message.type = "checkbox";3286 input_important_message.className = "checkbox";3287 input_important_message.id = "important_message_"+ID;3288 input_important_message.name = "input_important_message";3289 input_important_message.setAttribute("tabIndex","-1");3290 td_important_msg.appendChild(input_important_message);3291 trn.appendChild(tdn);3292 trn.appendChild(td_important_msg);3293 tbody_message.appendChild(trn);3294 }3295 3472 3296 3473 /** … … 3319 3496 add_files.innerHTML = get_lang("Attachments: add+"); 3320 3497 add_files.setAttribute("tabIndex","-1"); 3498 3499 var add_msgs = document.createElement("A"); 3500 add_msgs.setAttribute("href", "javascript:void(0)"); 3501 is_ie ? add_msgs.setAttribute("className", 'message-attach-link') : add_msgs.setAttribute("class", 'message-attach-link'); 3502 add_msgs.innerHTML = get_lang("Messages: add+"); 3321 3503 var divfiles = document.createElement("DIV"); 3322 3504 divfiles.id = "divFiles_"+ID; 3505 3506 jQuery(add_msgs).click(function(event){ 3507 jQuery('#message-attach-dialog').html("../prototype/modules/attach_message/attach_message.ejs", {data:{}}).dialog({ 3508 width:920, 3509 height:550, 3510 resizable:false, 3511 modal: true, 3512 closeOnEscape:true, 3513 close:function(event, ui) {event.stopPropagation();}, 3514 autoOpen:false 3515 }); 3516 jQuery.getScript("../prototype/modules/attach_message/attach_message.js", function(){ 3517 jQuery('#message-attach-dialog').dialog('open'); 3518 3519 jQuery('#message-attach-attach-btn').click(function(event){ 3520 //alert(dump(selectedMessages));../ 3521 jQuery.each(selectedMessages, function(folder_name, messages) { 3522 3523 var isOffline = /^local_messages/.test(folder_name); 3524 3525 jQuery.each(selectedMessages[folder_name], function(message_number, message) { 3526 if (message) { 3527 var subject = onceOpenedMessages[folder_name][message_number].subject; 3528 var text_input = '<input type="text" name="message_attachments['+folder_name+']['+message_number+']" value="'+subject+'"/>'; 3529 text_input += '<a href="javascript:void(0)" onclick="javascript:this.parentNode.parentNode.removeChild(this.parentNode);">' + get_lang("Remove")+'</a>'; 3530 3531 if( isOffline ) 3532 text_input += '<input type="hidden" name="message_attachments_content['+folder_name+']['+message_number+']" value="'+Base64.encode( onceOpenedMessages[folder_name][message_number].eml )+'"/>'; 3533 jQuery(divfiles).append('<div>'+text_input+'</div>'); 3534 } 3535 3536 }); 3537 }); 3538 3539 jQuery('#message-attach-dialog').dialog('close'); 3540 }); 3541 jQuery('#message-attach-cancel-btn').click(function(event){ 3542 jQuery('#message-attach-dialog').dialog('close'); 3543 }); 3544 }); 3545 }); 3323 3546 var tr5 = document.createElement("TR"); 3324 3547 var td5_link = document.createElement("TD"); … … 3328 3551 td5_link.setAttribute("colSpan","2"); 3329 3552 td5_link.appendChild(add_files); 3553 td5_link.appendChild(add_msgs); 3554 $(td5_link).append('<div id="message-attach-dialog" title="'+get_lang('Select messages to attach...')+'"> </div>'); 3330 3555 tr5.appendChild(td5_input); 3331 3556 tr5.appendChild(td5_link); … … 3426 3651 if(data.length > 0) { 3427 3652 tr1_1.style.display = ''; 3653 var mycn = typeof(data.myname != 'undefined') ? data.myname : ''; 3428 3654 var _option = document.createElement("OPTION"); 3429 _option.text = '"'+ data.myname+'" <'+Element("user_email").value+'>';3430 _option.value = data.myname+";"+Element("user_email").value;3655 _option.text = '"'+mycn+'" <'+Element("user_email").value+'>'; 3656 _option.value = mycn+";"+Element("user_email").value; 3431 3657 sel_from.options[sel_from.options.length] = _option; 3432 3658 3433 3659 var options = ''; 3660 var cn = ''; 3434 3661 for (var x = 0; x < data.length; x++) { 3662 cn = typeof(data[x].cn[0] != 'undefined') ? data[x].cn[0] : ''; 3435 3663 var _option = document.createElement("OPTION"); 3436 _option.text = '"'+ data[x].cn[0] +'" <'+data[x].mail[0]+'>';3437 _option.value = data[x].cn[0] +';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0];3664 _option.text = '"'+cn+'" <'+data[x].mail[0]+'>'; 3665 _option.value = cn+';'+data[x].mail[0]+';'+data[x].save_shared[0]+';'+data[x].uid[0]; 3438 3666 sel_from.options[sel_from.options.length] = _option ; 3439 3667 } … … 3452 3680 3453 3681 function changeBgColorToON(all_messages, begin, end){ 3682 var _tab_prefix = getTabPrefix(); 3683 var _msg_id; 3454 3684 for (begin; begin<=end; begin++) 3455 3685 { 3686 _msg_id = getMessageIdFromRowId(all_messages[begin].id); 3456 3687 add_className(all_messages[begin], 'selected_msg'); 3457 Element( "check_box_message_" + all_messages[begin].id).checked = true;3688 Element(_tab_prefix + "check_box_message_" + _msg_id).checked = true; 3458 3689 } 3459 3690 } … … 3502 3733 else{ 3503 3734 //if ( exist_className(actual_tr, 'selected_msg') ) 3504 if ( Element('check_box_message_' + _element_id).checked ) 3735 if ( document.getElementById(getTabPrefix()+'check_box_message_' + msg_number).checked ){ 3736 if( document.getElementById("chk_box_select_all_messages").checked) { 3737 add_className(actual_tr, 'selected_msg selected_shortcut_msg'); 3738 }else 3505 3739 add_className(actual_tr, 'selected_msg'); 3506 else 3740 }else{ 3741 if( document.getElementById("chk_box_select_all_messages").checked){ 3742 remove_className(actual_tr, 'selected_msg selected_shortcut_msg'); 3743 remove_className(actual_tr, 'selected_msg'); 3744 remove_chk_box_select_all_messages(); 3745 if(actual_tr.className == 'selected_msg') 3507 3746 remove_className(actual_tr, 'selected_msg'); 3747 }else 3748 remove_className(actual_tr, 'selected_msg'); 3749 } 3508 3750 } 3509 3751 last_message_selected = _element_id; -
trunk/expressoMail1_2/js/filter.js
r4855 r5134 51 51 var handler_sieve = function(data) 52 52 { 53 if(data.toString().indexOf('Error:') == 0) 54 { 55 53 if (data.toString().indexOf('Error:') == 0) 54 { 56 55 _this.criticalError = true; 57 56 alert(get_lang('The filters service is out of service, try again later...')); … … 69 68 } 70 69 } 71 if(typeof(data.vacation[0]) == 'undefined'){ 72 _this.out_officeR = ""; 73 } 74 else 75 _this.out_officeR = url_decode_s(data.vacation[0]); 70 _this.out_officeR = data.vacation[0]; 71 _this.out_officeR = _this.out_officeR ? trim(_this.out_officeR.toString().replace("\n","")) : ""; 72 if(data.mode.length > 0){_this.mode_in = data.mode[0];} 76 73 } 77 74 catch(e){ 78 75 _this.criticalError = true; 79 alert(get_lang('==> The filters service is out of service, try again later...')); 80 } 81 if(data.mode.length > 0){_this.mode_in = data.mode[0];} 76 alert(get_lang('The filters service is out of service, try again later...')); 77 } 82 78 if (typeof(posHandler) == 'function') 83 79 posHandler(param); … … 93 89 Element('form_body').innerHTML = ""; 94 90 Element('form_buttons').style.display = ''; 91 Element('Edit_form_buttons').style.display = 'none'; 95 92 filters.mount_list(); 96 93 this.ac_form = ""; … … 109 106 Element('form_body').innerHTML = ""; 110 107 Element('form_body').innerHTML = this.forms_(); 108 Element('Edit_form_buttons').style.display = ''; 109 Element('form_buttons').style.display = 'none'; 111 110 this.ind = pos; 112 111 … … 221 220 var mark_values = this.values[fields[8]].split(","); 222 221 for(var i=0; i < mark_values.length; i++){ 222 if( mark_values[i] == "checkBox1" || mark_values[i] == "checkBox2"){ 223 document.getElementById(mark_values[i]).checked = true; 224 } 223 225 if( mark_values[i] == "checkBox2"){ 224 226 document.getElementById(mark_values[i]).checked = true; … … 313 315 var form = ""; 314 316 form = "<div id='div_rule' style='display:none'><table id='table_rule' border='0' cellpading='0' cellspacing='0' width='100%'>"+ 317 "<tr><td colspan='2'><input type='checkBox' id='checkBox1' name='checkb'>"+get_lang('Also check message against next rule') + "</td></tr>"+ 318 //"<tr><td colspan='2'><input type='checkBox' id='checkBox2' onclick='filter.disable_radio3();' name='checkb'>"+get_lang('Keep a copy of the message at your Inbox')+ "</td><tr>"+ 319 "<tr><td colspan='2'><hr size='1' width='100%'></td></tr><tr>"+ 315 320 "<tr><td colspan='2'><b>"+get_lang("Criteria")+":</b></td></tr><tr>"+ 316 321 "<td rowspan='4' width='20%'>"+get_lang('Find items')+":<br><select id='select_rules' name='select_rules'>"+ … … 338 343 //"<tr><td colspan='3'><br>"+get_lang('Subject')+".: <input type='text' id='field7' name='field7' size='35' maxlength='200'/></td></tr>"+ 339 344 "<tr><td colspan='3'><br>"+get_lang('With the following message')+".:</td>"+ 340 "</tr><tr><td colspan='3'><textarea id='field8' onkeypress='return charCounter(this);'rows='8' cols='50'></textarea></td></tr></table></div>" +345 "</tr><tr><td colspan='3'><textarea id='field8' rows='8' cols='50'></textarea></td></tr></table></div>" + 341 346 "<div id='div_voipFilter' style='display:none'>" + 342 347 "<br/><table id='table_voipFilter'>" + 343 348 "<tr><td>"+get_lang("Type the subject of the message for receiving a phone warning")+" .:"+ 344 349 "</td></tr><tr><td><input type='text' id='field9' size='50' maxlength='200'>" + 345 "</td></tr><br/></table></div>" +346 "<span align='right'><input type='button' value="+get_lang("Back")+" onclick='filter.form_m()'></span>"+347 "<span align='right'><input type='button' value="+get_lang("Save")+" onclick='filter.saved_rules()'></span>";350 "</td></tr><br/></table></div>";// + 351 //"<span align='right'><input type='button' value="+get_lang("Back")+" onclick='filter.form_m()'></span>"+ 352 //"<span align='right'><input type='button' value="+get_lang("Save")+" onclick='filter.saved_rules()'></span>"; 348 353 return form; 349 354 } … … 487 492 //Save outoffice in prefs: 488 493 connector.loadScript("preferences"); 489 if(typeof(prefe) == 'undefined'){490 setTimeout("filter.delete_r();",500);491 }492 else493 494 prefe.save("outoffice", _this.out_officeF); 494 495 } … … 573 574 } 574 575 575 if(LTrim(Element("field1").value) == "" && LTrim(Element("field2").value) == "" && LTrim(Element("field3").value) == "" && Element("field4").value == "")576 if(LTrim(Element("field1").value) == "" && LTrim(Element("field2").value) == "" && LTrim(Element("field3").value) == "" && LTrim(Element("field4").value).length == 0) 576 577 { 577 578 alert(get_lang("Define some criterion to the fields Sender, To and Subject with more than 3 characters!")); 578 579 return false; 579 580 } 580 581 if((LTrim(Element("field1").value).length <= 3) && (LTrim(Element("field2").value).length <= 3) && (LTrim(Element("field3").value).length <= 3 && Element("field4").value == "")){ 581 if((LTrim(Element("field1").value).length <= 3) && LTrim(Element("field1").value) != ""){ 582 alert(get_lang("Define some criterion to the fields Sender, To and Subject with more than 3 characters!")); 583 return false; 584 }if((LTrim(Element("field2").value).length <= 3) && LTrim(Element("field2").value) != ""){ 585 alert(get_lang("Define some criterion to the fields Sender, To and Subject with more than 3 characters!")); 586 return false; 587 }if((LTrim(Element("field3").value).length <= 3) && LTrim(Element("field3").value) != ""){ 582 588 alert(get_lang("Define some criterion to the fields Sender, To and Subject with more than 3 characters!")); 583 589 return false; … … 649 655 } 650 656 var opts = ""; 657 if(Element("checkBox1").checked == true){ 658 opts += ",checkBox1"; 659 } 651 660 if(Element("checkBox2").checked == true){ 652 661 opts += ",checkBox2"; … … 691 700 return false; 692 701 } 702 else if(fld_men.value.length > 10000){ 703 alert(get_lang("Your message have %1 characters, the message needs to have less then 10000 characters",fld_men.value.length)); 704 return false; 705 } 693 706 this.out_officeR = mount_rule; 694 707 } … … 740 753 741 754 Element('form_buttons').style.display = ''; 755 Element('Edit_form_buttons').style.display = 'none'; 742 756 this.reload_rules(); 743 757 } … … 824 838 } 825 839 826 connector.loadScript("preferences");827 840 // build object 828 841 var filter; -
trunk/expressoMail1_2/js/filters.js
r4855 r5134 43 43 form_buttons.style.position = "absolute"; 44 44 form_buttons.style.display = ""; 45 form_buttons.style.top = "3 47px";45 form_buttons.style.top = "372px"; 46 46 form_buttons.style.left = "5px"; 47 form_buttons.style.width = "6 55px";47 form_buttons.style.width = "675px"; 48 48 form_buttons.innerHTML = "<input type='button' value="+get_lang("Enable")+" onclick='filter.enabled_disabled(\"ENABLED\");'>"+ 49 49 " <input type='button' value="+get_lang("Disable")+" onclick='filter.enabled_disabled(\"DISABLED\");'>"+ … … 52 52 53 53 form.appendChild(form_buttons); 54 55 var form_buttons2 = document.createElement("DIV"); 56 form_buttons2.id = "Edit_form_buttons"; 57 form_buttons2.style.position = "absolute"; 58 form_buttons2.style.display = "none"; 59 form_buttons2.style.top = "372px"; 60 form_buttons2.style.left = "5px"; 61 form_buttons2.style.width = "675px"; 62 form_buttons2.innerHTML = "<span align='right'><input type='button' value="+get_lang("Back")+" onclick='filter.form_m()'></span>"+ 63 "<span align='right'><input type='button' value="+get_lang("Save")+" onclick='filter.saved_rules()'></span>"; 64 65 form.appendChild(form_buttons2); 54 66 55 67 var form_body = document.createElement("DIV"); … … 58 70 form_body.style.left = "5px"; 59 71 form_body.style.top = "5px"; 60 form_body.style.width = "6 68px";61 form_body.style.height = "3 37px";72 form_body.style.width = "688px"; 73 form_body.style.height = "357px"; 62 74 form_body.style.borderStyle = "outset"; 63 75 form_body.style.borderColor = "black"; … … 187 199 { 188 200 var aux = outOffice.split("&&"); 189 return get_lang("Rule") + " - <a href='javascript:void(0)' onclick=filter.form_out()> " + "<b>" + get_lang("Status") + " : </b><font color='red'>" + (aux[4] .replace("\n","") === "off" ? get_lang("Disabled") : get_lang("Enabled")) + "</font></a>";201 return get_lang("Rule") + " - <a href='javascript:void(0)' onclick=filter.form_out()> " + "<b>" + get_lang("Status") + " : </b><font color='red'>" + (aux[4] == "off" ? get_lang("Disabled") : get_lang("Enabled")) + "</font></a>"; 190 202 } 191 203 … … 197 209 filter.ac_form = "new_rule"; 198 210 Element('form_buttons').style.display = 'none'; 211 Element('Edit_form_buttons').style.display = ''; 199 212 filter.sel_boxes(); 200 213 … … 207 220 Element('div_vacation').style.display = "block"; 208 221 Element('form_buttons').style.display = 'none'; 222 Element('Edit_form_buttons').style.display = ''; 209 223 filter.ac_form = "new_out"; 210 224 } … … 236 250 { 237 251 if(! this.filter_Sh[div.id]) { 238 div.style.width = " 680px";239 div.style.height = " 372px";252 div.style.width = "700px"; 253 div.style.height = "400px"; 240 254 div.style.visibility = "hidden"; 241 255 div.style.position = "absolute"; -
trunk/expressoMail1_2/js/globals.js
r4802 r5134 46 46 var denyFileExtensions = new Array('exe','com','reg','chm','cnf','hta','ins','jse','job','lnk','pif','src','scf','sct','shb','vbe','vbs','wsc','wsf','wsh','cer','its','mau','','mda','mar','mdz','prf','pst'); 47 47 var mobile_device = false; 48 48 var previous = 0; -
trunk/expressoMail1_2/js/lert/lert.css
r3977 r5134 24 24 font-weight:normal; 25 25 font-size:1em; 26 font-family: Tahoma, Verdana, Sans;26 //font-family: Tahoma, Verdana, Sans; 27 27 border:4px double #aaa; 28 28 width:40%; -
trunk/expressoMail1_2/js/local_messages.js
r4939 r5134 8 8 this.store = null; 9 9 this.filterSerch = ""; 10 this.folders = [];11 10 this.sortType = ""; 12 11 } … … 122 121 123 122 local_messages.prototype.installGears = function (){ 124 temp = confirm(get_lang("To use local messages you have to install google gears. Would you like to install it now?")); 125 if (temp && typeof(preferences.googlegears_url) != 'undefined'){ 126 if (is_ie) 127 location.href = preferences.googlegears_url + "/gears.exe"; 123 124 var ua = navigator.userAgent.toLowerCase(); // captura o userAgent 125 // alert( parseFloat(ua.substring(ua.indexOf("firefox") + 8)) ); 126 var is_ff = ( ua.indexOf("linux") != -1 || ua.indexOf("windows") != -1) && 127 ua.indexOf("mozilla") != -1 && 128 ( ua.indexOf("firefox") != -1 && parseFloat(ua.substring(ua.indexOf("firefox") + 8)) <= 3.6 ); 129 130 if ( is_ff ) 131 ext = "xpi"; 132 else 133 if( typeof is_ie !== "undefined" && is_ie ) 134 ext = "exe" 128 135 else 129 location.href = preferences.googlegears_url + "/gears.xpi";130 136 return false; 131 } 132 if (temp) { 133 location.href = "http://gears.google.com/?action=install&message="+ 134 get_lang("To use local messages, install Google Gears")+"&return=" + document.location.href; 135 } 136 else return false; 137 138 var confirmation = confirm(get_lang("To use local messages you have to install google gears. Would you like to install it now?")); 139 140 if ( confirmation && typeof(preferences.googlegears_url) != 'undefined' ) 141 location.href = preferences.googlegears_url + "/gears." + ext; 142 143 144 return false; 137 145 } 138 146 … … 171 179 this.dbGears.execute('create table if not exists mail' + 172 180 ' (mail blob,original_id int,original_folder text,header blob,timestamp int,uid_usuario int,unseen int,id_folder int,' + 173 ' ffrom text, subject text, fto text, cc text, body text, size int, unique (original_id,original_folder,uid_usuario,id_folder))');181 ' ffrom text, subject text, fto text, cc text, body text, size int, visible bool default true, unique (original_id,original_folder,uid_usuario,id_folder))'); 174 182 this.dbGears.execute('create table if not exists anexo' + 175 ' (id_mail int,nome_anexo text,url text,pid int )');183 ' (id_mail int,nome_anexo text,url text,pid int, contentType text)'); 176 184 this.dbGears.execute('create table if not exists folders_sync' + 177 185 ' (id_folder text,folder_name text,uid_usuario int)'); … … 184 192 try { 185 193 this.dbGears.execute('alter table mail add column size int'); 186 }catch(Exception) { 194 } 195 catch(Exception) { 187 196 188 197 } 198 try { 199 this.dbGears.execute('alter table mail add column visible bool default true'); 200 } 201 catch(Exception) { 202 } 203 try { 204 this.dbGears.execute('alter table anexo add column contentType text'); 205 } 206 catch(Exception) { 207 } 208 209 189 210 var rs = this.dbGears.execute('select rowid,header from mail where size is null'); 190 211 while(rs.isValidRow()) { … … 246 267 } 247 268 269 sync = { length: 0, fails: [], success: [], mails: {}, archived: [] }; 270 271 local_messages.prototype.insert_mails = function( msgs_info, folder, complete ){ 272 273 sync.length += msgs_info.length; 274 275 write_msg( ( sync.archived.length ? sync.archived.length + " mensagens ja arquivadas anteriormente, " : "" ) 276 + "Preparando o arquivamento de "+sync.length+ " mensagens...", true ); 277 278 for( var i = 0; i < msgs_info.length; i++ ) 279 { 280 var original = url = DEFAULT_URL + "$this.exporteml.export_eml.raw&folder=" + msgs_info[i].msg_folder 281 + "&msgs_to_export=" + msgs_info[i].msg_number; 282 283 msgs_info[i].url_export_file = url; 284 msgs_info[i].dest_folder = folder; 285 286 for( var ii = 0; ii < msgs_info[i].array_attach.length; ii++ ) 287 { 288 var anexo = msgs_info[i].array_attach[ii]; 289 290 anexo.url = "inc/get_archive.php?msgFolder=" + msgs_info[i].msg_folder + "&msgNumber=" + msgs_info[i].msg_number + "&indexPart=" + anexo.pid; 291 292 msgs_info[i].array_attach[ii] = anexo; 293 294 sync.mails[ anexo.url ] = url; 295 296 url = anexo.url; 297 } 298 299 sync.mails[ original ] = parseInt( this.store_mail( msgs_info[i] ) ); 300 301 this.capture( url, complete ); 302 } 303 304 write_msg( ( sync.archived.length ? sync.archived.length + " mensagens ja arquivadas anteriormente, " : "" ) 305 + "arquivando " + sync.length + " mensagens...", true ); 306 } 307 308 local_messages.prototype.checkArchived = function( msgsNumber, folder ){ 309 310 var levels = [], newtree = []; 311 312 for( var i = 0; i < oldtree.length; i++ ){ 313 314 var element = oldtree[i]; 315 316 var current = element.parent, hierarchy = []; 317 318 while( !levels[ current.id ] ) 319 { 320 levels[ current.id ] = []; 321 322 hierarchy.push( current.id ); 323 324 for( var ii = 0; ii < hierarchy.length; ii++ ) 325 levels[ hierarchy[ii] ].push( 0 ); 326 327 current = current.parent; 328 } 329 330 var parent = newtree; 331 332 for( var ii = 0; ii < levels[ element.parent ].length; ii++ ) 333 parent = parent[ levels[element.parent][ii] ]; 334 335 parent[ levels[ element.id ] = parent.length ] = element; 336 } 337 } 338 339 local_messages.prototype.checkArchived = function( msgsNumber, folder ){ 340 341 var isArray = false; 342 343 if( msgsNumber.join ){ 344 isArray = true; 345 msgsNumber = msgsNumber.join(","); 346 } 347 348 var archived = this.isArchived( msgsNumber, folder ); 349 350 if( !archived ) 351 return( isArray ? msgsNumber.split(",") : msgsNumber ); 352 353 msgsNumber = "," + msgsNumber; 354 355 for( var i = 0; i < archived.length; i++ ){ 356 sync.archived[ sync.archived.length ] = archived[i]; 357 msgsNumber = msgsNumber.replace( "," + archived[i], "" ); 358 } 359 360 if( !msgsNumber ) 361 this.cleanup(); 362 363 return( isArray ? msgsNumber.substr(1).split(",") : 364 ( msgsNumber ? msgsNumber.substr(1) : msgsNumber )); 365 } 366 367 local_messages.prototype.isArchiving = function( msgsNumber, folder ){ 368 return this.isArchived( msgsNumber, folder, true ); 369 } 370 371 local_messages.prototype.isArchived = function( msgsNumber, folder, archiving ){ 372 373 if( msgsNumber.join ) 374 msgsNumber = msgsNumber.join(","); 375 376 folder = this.get_folder_id( folder ); 377 378 var archived = []; 379 380 try{ 381 this.init_local_messages(); 382 383 var sql = "select original_id from mail where id_folder = ? and original_id IN ("+msgsNumber+")" + ( archiving ? " and visible = ?" : "" ); 384 var params = archiving ? [ folder, false ]: [ folder ]; 385 386 if(folder != false){ 387 for( var rs = this.dbGears.execute(sql, params); rs.isValidRow() || rs.close(); rs.next() ){ 388 archived[ archived.length ] = rs.field(0); 389 } 390 } 391 } 392 catch( error ){ 393 //Removido alert pois o método 394 //é usado quando move mensagens entre pastas 395 // alert( error ); 396 return( false ); 397 } 398 finally{ 399 this.finalize(); 400 } 401 402 return( archived.length ? archived : false ); 403 } 404 405 local_messages.prototype.capture = function( uri, complete ){ 406 407 var _this = this; 408 409 var callback = function( url, ok ){ 410 411 //check if its a chained attachment url. 412 if( typeof sync.mails[url] === "string" ) 413 { 414 var content = _this.get_src( url ); 415 416 //if its successful, continue to capture the chain 417 if( ok = ok || content ) 418 return _this.capture( sync.mails[url], complete ); 419 420 //If it's not, don't need to continue loading the attachments. 421 //Just break the chain, search the last one chained (the message url) and finalize the process 422 while( sync.mails[url].length ) 423 url = sync.mails[url]; 424 } 425 426 sync[ ok ? 'success' : 'fails' ].push( sync.mails[url] ); 427 428 sync.length--; 429 430 if( sync.length ) 431 return write_msg( ( sync.archived.length ? sync.archived.length + " mensagens ja arquivadas anteriormente, " : "" ) 432 + "arquivando " + sync.length + " mensagens...", true ); 433 434 clean_msg(); 435 write_msg( ( sync.success.length ? "Foram arquivadas corretamente " + sync.success.length + " mensagens" : "Nenhuma mensagem arquivada" ) 436 + ( sync.archived.length ? ", " + sync.archived.length + " mensagens ja arquivadas anteriormente" : "" ) 437 + ( sync.fails.length ? ", " + sync.fails.length + " falharam" : "" ) + "." ); 438 439 _this.update_mails( sync.success, sync.fails, complete ); 440 } 441 442 try{ 443 this.init_local_messages(); 444 this.store.capture( uri, callback ); 445 } 446 catch( error ){ 447 console && console.log(error); 448 } 449 finally{ 450 this.finalize(); 451 } 452 } 453 454 local_messages.prototype.store_mail = function( msg_info ){ 455 456 var id_mail = false; 457 458 try { 459 460 var id_folder = this.get_folder_id( msg_info.dest_folder ); 461 462 this.init_local_messages(); 463 464 //This fields needs to be separeted to search. 465 var msg_header = msg_info.header; 466 var anexos = msg_info.array_attach; 467 var login = msg_info.login; 468 var original_id = msg_info.msg_number; 469 var original_folder = msg_info.msg_folder; 470 var subject = msg_info.subject; 471 var body = msg_info.body; 472 var timestamp = msg_info.timestamp; 473 var size = msg_header.Size; 474 var from = connector.serialize(msg_info.from); 475 var to = connector.serialize(msg_info.toaddress2); 476 var cc = connector.serialize(msg_info.cc); 477 var unseen = (msg_info.Unseen == "U" )? 1 : 0; 478 479 //If the mail was archieved in the same date the user received it, the date cames with the time. 480 //here I solved it 481 msg_header.udate = (String(msg_header.udate).indexOf(":")==-1)? msg_header.udate : msg_header.aux_date; 482 // The importance attribute can be empty, and javascript consider as null causing nullpointer. 483 msg_header.Importance = msg_header.Importance || "Normal"; 484 485 //do not duplicate this information 486 msg_info.from = null; 487 msg_info.subject = null; 488 msg_info.body = null; 489 msg_info.to = null; 490 msg_info.cc = null; 491 msg_header.Size=null; 492 msg_header.aux_date = null; 493 494 var mail = connector.serialize(msg_info); 495 var header = connector.serialize(msg_header); 496 497 //parse header 498 var parser = new FlagsParser(msg_header); 499 var flags = parser.parse(); 500 501 this.dbGears.execute("insert into mail (mail,original_id,original_folder,header,timestamp,uid_usuario,unseen,id_folder,ffrom,subject,fto,cc,body,size,answered,flagged,recent, visible) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", 502 [mail,original_id,original_folder,header,timestamp,login,unseen,id_folder,from,subject,to,cc,body,size,flags.getAnswered(),flags.getFlagged(),flags.getRecent(), false]); 503 504 id_mail = this.dbGears.lastInsertRowId; 505 506 //insert_mail already close and open gears. 507 for (var i = 0; i < anexos.length; i++) 508 this.dbGears.execute("insert into anexo (id_mail,nome_anexo,url,pid) values (?,?,?,?)", 509 [id_mail, anexos[i]['name'],anexos[i]['url'],anexos[i]['pid']]); 510 } 511 catch (error) { 512 return( false ); 513 } 514 finally{ 515 this.finalize(); 516 } 517 518 return( id_mail ); 519 } 520 521 local_messages.prototype.get_folder_id = function( folder ){ 522 523 var id_folder; 524 525 folder = ( folder && folder != "local_root" )? folder.substr(6) : "Inbox"; 526 527 try 528 { 529 this.init_local_messages(); 530 531 var rs = this.dbGears.execute("select rowid from folder where folder=? and uid_usuario=?",[folder,account_id]); 532 533 if(rs.isValidRow()) 534 id_folder = rs.field(0); 535 else { 536 this.dbGears.execute("insert into folder (folder,uid_usuario) values (?,?)",["Inbox",account_id]); 537 id_folder = this.dbGears.lastInsertRowId; 538 } 539 540 rs.close(); 541 } 542 catch( error ){ 543 return( false ); 544 } 545 finally{ 546 this.finalize(); 547 } 548 549 return( id_folder ); 550 } 551 552 local_messages.prototype.update_mails = function( success, fails, callback ){ 553 try 554 { 555 this.init_local_messages(); 556 557 this.dbGears.execute('update mail set visible=? where rowid IN (' + success.join(",") + ')',[ true ]); 558 559 var sql = 'select url, contentType from anexo where id_mail = ' +success; 560 561 for( var rs = this.dbGears.execute(sql); rs.isValidRow() || rs.close(); rs.next() ) 562 { 563 var url = rs.field(0), contentType = rs.field(1); 564 var blob = this.store.getAsBlob( url ); 565 566 this.store.captureBlob( blob, url + "&image=thumbnail", "image/jpeg" ); 567 this.store.captureBlob( blob, url + "&image=true", "image/jpeg" ); 568 } 569 } 570 catch (error) { 571 status = false; 572 } 573 finally{ 574 this.finalize(); 575 } 576 577 if( callback ) 578 callback( success, fails ); 579 this.cleanup(); 580 581 return( status ); 582 } 583 584 local_messages.prototype.cleanup = function(){ 585 586 try{ 587 this.init_local_messages(); 588 589 this.dbGears.execute('delete from mail where visible=?', [ false ]); 590 591 sync.success = [], sync.fails = [], sync.archived = [], sync.mails = {}; 592 } 593 catch(error){ 594 return( false ); 595 } 596 finally{ 597 this.finalize(); 598 } 599 600 return( true ); 601 } 602 603 604 605 local_messages.prototype.select_mail = function( columns, rowIds ){ 606 607 try 608 { 609 this.init_local_messages(); 610 611 if( rowIds.join ) 612 rowIds = rowIds.join( "," ); 613 614 if( columns.join ) 615 columns = columns.join( "," ); 616 617 var sql = 'select '+columns+' from mail where rowid IN (' + rowIds + ')'; 618 619 var result = []; 620 621 for( var i = 0, rs = this.dbGears.execute(sql); rs.isValidRow() || rs.close() || delete ii; rs.next( i++ ) ) 622 623 for( ii = 0, result[i] = {}; ii < rs.fieldCount(); ii++ ) 624 625 result[i][ rs.fieldName( ii ) ] = rs.field( ii ); 626 627 } 628 catch (error) { 629 status = false; 630 } 631 finally{ 632 this.finalize(); 633 } 634 635 if( result.length === 1 ) 636 result = result[0]; 637 638 return( result ); 639 } 640 248 641 local_messages.prototype.insert_mail = function(msg_info,msg_header,anexos,folder) { 249 642 try { … … 391 784 if(anexos[i]['url'] && anexos[i]['url'].match(/((jpg)|(jpeg)|(png)|(gif)|(bmp))/gi)) 392 785 { 393 var er_imagens = new RegExp("\\.\\/ inc\\/show_embedded_attach.php\\?msg_folder=[\\w/]+\\&msg_num=[0-9]+\\&msg_part="+anexos[i]['pid']);786 var er_imagens = new RegExp("\\.\\/get_archive.php\\?msgFolder=[\\w/]+\\&msgNumber=[0-9]+\\&indexPart="+(anexos[i]['pid']-1)); 394 787 var Result_imagens = er_imagens.exec(retorno['body']); 395 788 retorno['body'] = retorno['body'].replace(Result_imagens,anexos[i]['url']); 396 789 if(thumbs && thumbs[i]){ 397 er_imagens = new RegExp("\\.\\/inc\\/ show_thumbs.php\\?file_type=image\\/[\\w]+\\&msg_num=[0-9]+\\&msg_folder=[\\w/%]+\\&msg_part="+anexos[i]['pid']);790 er_imagens = new RegExp("\\.\\/inc\\/get_archive.php\\?&&msgFolder=[\\w/%]+\\msgNumber=[0-9]+\\&indexPart=0."+(anexos[i]['pid']-1)+"&image=thumbnail"); 398 791 Result_imagens = er_imagens.exec(thumbs[i]); 399 792 thumbs[i] = thumbs[i].replace(Result_imagens,"'"+anexos[i]['url']+"'"); 400 er_imagens = new RegExp("\\.\\/inc\\/ show_img.php\\?msg_num=[0-9]+\\&msg_folder=[\\w/%]+\\&msg_part="+anexos[i]['pid']);793 er_imagens = new RegExp("\\.\\/inc\\/get_archive.php\\?&msgFolder=[\\w/%]+\\msgNumber=[0-9]+\\&indexPart=0."+(anexos[i]['pid']-1)+"&image=true"); 401 794 Result_imagens = er_imagens.exec(thumbs[i]); 402 795 thumbs[i] = thumbs[i].replace(Result_imagens,anexos[i]['url']); … … 475 868 'ltrim(ltrim(substr(UPPER(ffrom),21,length(ffrom)),\':\'),\'"\') ' + 476 869 'end ' + 477 'end as order_from,mail.subject from mail inner join folder on mail.id_folder=folder.rowid where mail.uid_usuario=? and folder.folder=? ' +870 'end as order_from,mail.subject from mail inner join folder on mail.id_folder=folder.rowid where mail.uid_usuario=? and folder.folder=? and mail.visible=? ' + 478 871 mail_filter + ' order by '; 479 872 … … 496 889 497 890 498 var rs = this.dbGears.execute(sql,['%'+Element("user_email").value+'%',account_id,folder, msg_range_begin,emails_per_page]);891 var rs = this.dbGears.execute(sql,['%'+Element("user_email").value+'%',account_id,folder,true,msg_range_begin,emails_per_page]); 499 892 var cont = 0; 500 893 501 var rs3 = this.dbGears.execute('select count(*) from mail inner join folder on mail.id_folder=folder.rowid where mail.uid_usuario=? and folder.folder=? '+mail_filter,[account_id,folder]);894 var rs3 = this.dbGears.execute('select count(*) from mail inner join folder on mail.id_folder=folder.rowid where mail.uid_usuario=? and folder.folder=? and mail.visible=?'+mail_filter,[account_id,folder,true]); 502 895 503 896 while (rs.isValidRow()) { … … 528 921 529 922 retorno[cont]['msg_sample'] = new Array(); 530 531 if( (preview_msg_subject == 0) && (preview_msg_tip == 0) )532 {533 923 retorno[cont]['msg_sample']['body'] = ""; 534 } 535 else 536 { 537 msg_body += ">"; 538 msg_body=this.strip_tags(msg_body); 539 msg_body=msg_body.replace(/\ /ig," "); 540 retorno[cont]['msg_sample']['body'] = " - " + msg_body.substr(2,msg_body.length-1); 541 } 924 542 925 543 926 cont++; … … 562 945 var retorno; 563 946 var rs = this.dbGears.execute("select url from anexo where id_mail="+msg_number+" and pid = '"+pid+"'"); 564 retorno = rs.field(0) 947 retorno = rs.field(0); 565 948 this.finalize(); 566 949 … … 576 959 577 960 local_messages.prototype.finalize = function() { 961 if(this.dbGears) 578 962 this.dbGears.close(); 579 963 this.dbGears = null; 580 964 } 581 965 582 local_messages.prototype.delete_msgs = function(msgs_number,border_ID) { 583 this.init_local_messages(); 966 local_messages.prototype.remove_msgs = function(msgs_number) 967 { 968 this.init_local_messages(); 969 584 970 var rs = this.dbGears.execute("select url from anexo where id_mail in ("+msgs_number+")"); 585 971 while(rs.isValidRow()) { … … 590 976 this.dbGears.execute("delete from mail where rowid in ("+msgs_number+")"); 591 977 this.finalize(); 592 if (msgs_number.length == 1) 593 write_msg(get_lang("The message was deleted.")); 594 else 595 write_msg(get_lang("The messages were deleted.")); 596 597 mail_msg = Element("tbody_box"); 598 978 } 979 980 local_messages.prototype.delete_msgs = function(msgs_number,border_ID) { 981 982 if(!msgs_number) 983 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 984 985 if(msgs_number === ""){ 986 write_msg(get_lang('No selected message.')); 987 return; 988 } 989 990 this.remove_msgs( msgs_number ); 991 992 mail_msg = Element("tbody_box"); 599 993 try { 600 994 msgs_exploded = msgs_number.split(","); … … 603 997 msgs_exploded[0] = msgs_number; 604 998 } 999 this.previous = 0; 605 1000 var msg_to_delete; 606 1001 for (var i=0; i<msgs_exploded.length; i++){ … … 609 1004 if ( (msg_to_delete.style.backgroundColor != '') && (preferences.use_shortcuts == '1') ) 610 1005 select_msg('null', 'down'); 1006 if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete && currentTab.toString().indexOf("_r") > 0) 1007 for(var ii=0; ii < mail_msg.rows.length; ii++){ 1008 if(mail_msg.rows[ii] === msg_to_delete){ 1009 if(ii == 0){ 1010 break; 1011 }else{ 1012 this.previous = mail_msg.rows[(ii - 1)].attributes[0]; 1013 this.previous = parseInt(this.previous.value); 1014 break; 1015 } 1016 } 1017 } 1018 611 1019 mail_msg.removeChild(msg_to_delete); 612 decrement_folder_unseen(); 613 } 614 } 1020 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - 1; 1021 } 1022 } 1023 if (msgs_exploded.length == 1){ 1024 write_msg(get_lang("The message was deleted.")); 1025 } 1026 else 1027 write_msg(get_lang("The messages were deleted.")); 615 1028 Element('chk_box_select_all_messages').checked = false; 616 if (border_ID != 'null') 617 delete_border(border_ID,'false'); 618 1029 1030 if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete && this.previous){ 1031 proxy_mensagens.get_msg(this.previous, folder, true, show_msg); 1032 }else if(currentTab != 0){ 1033 delete_border(currentTab,'false'); 1034 } 619 1035 } 620 1036 … … 635 1051 this.init_local_messages(); 636 1052 var no_errors = true; 637 var rowids_to_set; // rows ids 638 var msgs_to_set; // messages ids 1053 var msgs_to_set; 639 1054 var one_message = false; 640 1055 if (msgs_number == 'get_selected_messages') { 641 msgs_to_set = get_selected_messages(); 642 rowids_to_set = msgs_to_set.split(","); 643 msgs_to_set = msgs_to_set.replace(/_s[^,]*/g,"").split(","); 644 } 645 else { 646 if(isNaN(parseInt(msgs_number))){ //message(s) sent to function 647 rowids_to_set = msgs_number.split(","); 648 msgs_to_set = msgs_number.replace(/_s[^,]*/g,"").split(","); 649 if (msgs_to_set.length==1) { 650 //Just one message 651 one_message = true; 652 } 653 }else{ 654 rowids_to_set = new Array(); 655 msgs_to_set = new Array() 656 msgs_to_set[0] = parseInt(msgs_number); 657 rowids_to_set[0] = parseInt(msgs_number); 1056 var msgs_to_set = get_selected_messages(); 1057 msgs_to_set= msgs_to_set.split(","); 1058 } 1059 else { //Just one message 658 1060 one_message = true; 659 } 1061 msgs_to_set = new Array(); 1062 msgs_to_set[0] = msgs_number; 660 1063 } 661 1064 for (var i in msgs_to_set) { 662 1065 663 1066 var matches = '';//Messages comming from other tabs. 664 if(matches = ==this.parse_id_mail(msgs_to_set[i])) {1067 if(matches = this.parse_id_mail(msgs_to_set[i])) { 665 1068 msgs_to_set[i] = matches[1]; 666 1069 } … … 674 1077 switch(flag) { 675 1078 case "unseen": 676 set_msg_as_unread( rowids_to_set[i]);1079 set_msg_as_unread(msgs_to_set[i]); 677 1080 header["Unseen"] = "U"; 678 1081 mail["Unseen"] = "U"; … … 681 1084 break; 682 1085 case "flagged": 683 set_msg_as_flagged( rowids_to_set[i]);1086 set_msg_as_flagged(msgs_to_set[i]); 684 1087 header["Flagged"] = "F"; 685 1088 mail["Flagged"] = "F"; … … 691 1094 no_errors = false; 692 1095 else { 693 set_msg_as_unflagged( rowids_to_set[i]);1096 set_msg_as_unflagged(msgs_to_set[i]); 694 1097 header["Flagged"] = "N"; 695 1098 mail["Flagged"] = "N"; … … 702 1105 mail["Unseen"] = "N"; 703 1106 mail["header"]["Unseen"] = "N"; 704 set_msg_as_read( rowids_to_set[i],true);1107 set_msg_as_read(msgs_to_set[i],true); 705 1108 unseen = 0; 706 1109 break; … … 729 1132 rs.close(); 730 1133 731 if(Element("check_box_message_" + rowids_to_set[i]))732 Element("check_box_message_" + rowids_to_set[i]).checked = false;1134 if(Element("check_box_message_" + msgs_to_set[i])) 1135 Element("check_box_message_" + msgs_to_set[i]).checked = false; 733 1136 var smail=connector.serialize(mail); 734 1137 smail =smail.replace(/([^'])'([^'])('?)/g,"$1''$2$3$3"); … … 815 1218 temp[2] = 0; 816 1219 817 if(sentfolder == preferences.save_in_folder.replace("INBOX /","") || preferences.save_in_folder.replace("INBOX/","") == trashfolder || preferences.save_in_folder.replace("INBOX/","") == draftsfolder)1220 if(sentfolder == preferences.save_in_folder.replace("INBOX" + cyrus_delimiter,"") || preferences.save_in_folder.replace("INBOX" + cyrus_delimiter,"") == trashfolder || preferences.save_in_folder.replace("INBOX" + cyrus_delimiter,"") == draftsfolder) 818 1221 achouSentConf= true; 819 1222 … … 835 1238 achouDrafts = true; 836 1239 break; 837 case preferences.save_in_folder.replace("INBOX /",""):1240 case preferences.save_in_folder.replace("INBOX" + cyrus_delimiter,""): 838 1241 retorno_defaults[2] = temp; 839 1242 achouSentConf = true; … … 862 1265 this.create_folder(draftsfolder); 863 1266 if(!achouSentConf) 864 this.create_folder(preferences.save_in_folder.replace("INBOX /",""));1267 this.create_folder(preferences.save_in_folder.replace("INBOX" + cyrus_delimiter,"")); 865 1268 return this.list_local_folders(); 866 1269 } … … 930 1333 931 1334 local_messages.prototype.move_messages = function(new_folder,msgs_number) { 1335 1336 if(!msgs_number) 1337 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 1338 932 1339 this.init_local_messages(); 933 1340 var rs = this.dbGears.execute("select rowid from folder where folder=? and uid_usuario=?",[new_folder,account_id]); … … 938 1345 } 939 1346 940 local_messages.prototype.setFolders = function(sFolders)941 {942 this.folders = sFolders;943 }944 945 local_messages.prototype.getFolders = function()946 {947 return this.folders;948 }949 950 1347 local_messages.prototype.setFilter = function(sFilter) 951 1348 { … … 972 1369 local_messages.prototype.search = function(folders,sFilter) { 973 1370 this.init_local_messages(); 974 //sFilter = unescape(sFilter);975 1371 this.setFilter(sFilter); 976 this.setFolders(folders);977 1372 var filters = sFilter.replace(/^##|##$/g,"").split('##'); 978 1373 var friendly_filters = new Array(); … … 1017 1412 } 1018 1413 } 1019 var sql = "select mail.header,folder.folder,mail.rowid,size from mail inner join folder on mail.id_folder=folder.rowid where mail.uid_usuario="+account_id + " and folder.folder in (";1414 var sql = "select mail.header,folder.folder,mail.rowid,size from mail inner join folder on mail.id_folder=folder.rowid where visible=? and mail.uid_usuario="+account_id + " and folder.folder in ("; 1020 1415 for(var fnum in folders) { 1021 1416 sql+="'"+folders[fnum]+"'"; … … 1069 1464 sql += this.getSortType().match('^.*_REVERSE$') ? ' asc' : ' desc'; 1070 1465 1071 var rs = this.dbGears.execute(sql );1466 var rs = this.dbGears.execute(sql,[true]); 1072 1467 var retorno = []; 1073 1468 var numRec = 0; … … 1226 1621 } 1227 1622 1228 AJAX.open('get', url, false);1623 AJAX.open('get', encodeURI(url), false); 1229 1624 AJAX.send(null); 1230 1625 return AJAX.responseText; … … 1233 1628 //Por Bruno Costa(bruno.vieira-costa@serpro.gov.br - Dessarquiva msgs locais pegando o codigo fonte das mesmas e mandando via POST para o servidor 1234 1629 //para que elas sejam inseridas no imap pela função imap_functions.unarchive_mail. 1235 local_messages.prototype.unarchive_msgs = function (folder,new_folder,msgs_number){ 1236 1237 if(!new_folder) 1238 new_folder='INBOX'; 1239 this.init_local_messages(); 1240 // alert(folder+new_folder+msgs_number); 1241 var handler_unarchive = function(data) 1242 { 1243 if(data.error == '') 1244 write_msg(get_lang('All messages are successfully unarchived')); 1245 else 1246 alert(data.error); 1247 } 1248 1249 if(currentTab.toString().indexOf("_r") != -1){ 1630 local_messages.prototype.unarchive_msgs = function (folder,new_folder,msgs_number){ 1631 1632 this.init_local_messages(); 1633 1634 // se a aba estiver aberta e selecionada, apenas a msg da aba é movida 1635 if(currentTab.toString().indexOf("_r") != -1) 1250 1636 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 1251 } 1252 1253 if(msgs_number =='selected' || !msgs_number) 1254 { 1255 msgs_number = get_selected_messages() 1256 if (!msgs_number){ 1257 write_msg(get_lang('No selected message.')); 1258 return; 1259 } 1260 var rs = this.dbGears.execute("select mail,timestamp from mail where rowid in ("+msgs_number+")"); 1261 var source=""; 1262 var flags=""; 1263 var timestamp=""; 1637 1638 if( msgs_number =='selected' || !msgs_number ) 1639 msgs_number = get_selected_messages(); 1640 1641 if( !msgs_number ) 1642 return write_msg(get_lang('No selected message.')); 1643 1644 document.getElementById("overlay").style.visibility = ""; 1645 1646 var rs = this.dbGears.execute("select mail,timestamp from mail where rowid in (" + msgs_number + ")"); 1647 1648 var source = [], flags = [], timestamp = []; 1264 1649 1265 1650 while(rs.isValidRow()) { 1266 mail=connector.unserialize(rs.field(0)); 1267 mail.msg_source?source_tmp = escape(mail.msg_source):source_tmp = escape(this.get_src(mail.url_export_file)); 1268 flags+="#@#@#@"+mail["Answered"]+":"+mail["Draft"]+":"+mail["Flagged"]+":"+mail["Unseen"]; 1269 source+="#@#@#@"+source_tmp; 1270 timestamp+="#@#@#@"+rs.field(1); 1651 1652 var mail = connector.unserialize(rs.field(0)); 1653 1654 flags.push( mail["Answered"]+":"+mail["Draft"]+":"+mail["Flagged"]+":"+mail["Unseen"] ); 1655 source.push( escape( mail.msg_source || this.get_src( mail.url_export_file ) ) ); 1656 timestamp.push( rs.field(1) ); 1657 1271 1658 rs.next(); 1272 1659 } 1660 1273 1661 rs.close(); 1274 1662 this.finalize(); 1275 } 1276 else 1277 { 1278 var rs = this.dbGears.execute("select mail,timestamp from mail where rowid="+msgs_number); 1279 mail=connector.unserialize(rs.field(0)); 1280 var source =""; 1281 1282 mail.msg_source?source = escape(mail.msg_source):source = escape(this.get_src(mail.url_export_file)); 1283 flags = mail["Answered"]+":"+mail["Draft"]+":"+mail["Flagged"]+":"+mail["Unseen"]; 1284 timestamp=rs.field(1); 1285 rs.close(); 1286 this.finalize(); 1287 } 1288 params="&folder="+new_folder+"&source="+source+"×tamp="+timestamp+"&flags="+flags; 1289 cExecute ("$this.imap_functions.unarchive_mail&", handler_unarchive, params); 1290 } 1663 1664 write_msg( "Desarquivando " + source.length + " mensagens... ", true ); 1665 1666 var sep = "#@#@#@"; 1667 1668 var params = "&folder=" + ( new_folder || 'INBOX' ) + 1669 "&source=" + source.join(sep) + 1670 "×tamp=" + timestamp.join(sep) + 1671 "&flags=" + flags.join(sep); 1672 1673 cExecute ("$this.imap_functions.unarchive_mail&", function(data){ 1674 1675 clean_msg(); 1676 document.getElementById("overlay").style.visibility = "hidden"; 1677 write_msg( get_lang( data.error || 'All messages are successfully unarchived' ) ); 1678 1679 }, params); 1680 1681 update_menu(); 1682 } 1291 1683 1292 1684 local_messages.prototype.get_msg_date = function (original_id, is_local){ … … 1309 1701 rs = this.dbGears.execute("select mail from mail where original_id="+original_id); 1310 1702 } 1311 if(!rs.field(0)){1312 ret=null;1313 }1314 else1315 {1316 1703 var tmp = connector.unserialize(rs.field(0)); 1317 1704 var ret = new Array(); … … 1320 1707 ret.msg_day = tmp.msg_day; 1321 1708 ret.msg_hour = tmp.msg_day; 1322 } 1709 1323 1710 rs.close(); 1324 1711 this.finalize(); … … 1356 1743 var flag = true; 1357 1744 var handler_local_mesgs_to_export = function(data){ 1745 var filename = 'mensagens.zip'; 1746 1747 if (data.match(/\.eml$/gi)) { 1748 fn_regex = /[^\/]*\.eml$/i; 1749 filename = fn_regex.exec(data); 1750 } 1751 1358 1752 document.getElementById('lertOverlay').style.display='none'; 1359 1753 document.getElementById('lertContainer').style.display='none'; 1360 1754 document.getElementById('lertContainer').innerHTML = ''; 1361 1755 flag = false; 1362 download_attachments(null, null, data, null,null,'mensagens.zip'); 1756 1757 download_attachments(null, null, data, null, null, filename); 1363 1758 } 1364 1759 … … 1510 1905 } 1511 1906 1907 local_messages.prototype.as_trash = function(){//verifica se o usuario tem a pasta lixeira no arquivamento local 1908 this.init_local_messages(); 1909 var rs = this.dbGears.execute("select folder from folder where uid_usuario="+account_id+" and folder = \"Trash\""); 1910 var check = rs.isValidRow(); 1911 this.finalize(); 1912 if(check) 1913 return true; 1914 else 1915 return false; 1916 } 1917 1512 1918 local_messages.prototype.get_folders_to_sync = function() {//Precisa ter visibilidade ao array de linguagens. 1513 1919 this.init_local_messages(); … … 1517 1923 temp = new Array(); 1518 1924 temp[0] = rs.field(0); 1519 if(temp[0]=='INBOX /Drafts' ||temp[0]=='INBOX/Trash' || temp[0]=='INBOX/Sent') {1925 if(temp[0]=='INBOX' + cyrus_delimiter + 'Drafts' ||temp[0]=='INBOX' + cyrus_delimiter + 'Trash' || temp[0]=='INBOX' + cyrus_delimiter + 'Sent') { 1520 1926 temp[1] = array_lang[rs.field(1).toLowerCase()]; 1521 1927 } … … 1533 1939 local_messages.prototype.install_offline = function(urlOffline,urlIcone,uid_usuario,login,pass,redirect) { 1534 1940 if (!window.google || !google.gears) { 1535 temp = confirm(document.getElementById('lang_gears_redirect').value);1536 if (temp) {1537 1941 expresso_local_messages.installGears(); 1538 }1539 1942 return; 1540 1541 1943 } 1542 1944 -
trunk/expressoMail1_2/js/mail_sync.js
r4988 r5134 275 275 276 276 var unseen = 0; 277 var flagged = 0; 278 var answered = 0; 277 279 var login = msg_info.login; 278 280 var original_id = msg_info.msg_number; … … 313 315 if(msg_info.Unseen=="U") 314 316 unseen = 1; 315 316 //parse header 317 var parser = new FlagsParser(msg_header); 318 var flags = parser.parse(); 319 320 this.dbGears.execute("insert into mail (mail,original_id,original_folder,header,timestamp,uid_usuario,unseen,id_folder,ffrom,subject,fto,cc,body,size,flagged,answered,recent) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",[mail,original_id,original_folder,header,timestamp,login,unseen,id_folder,from,subject,to,cc,body,size,flags.getFlagged(),flags.getAnswered(),flags.getRecent()]); 317 this.dbGears.execute("insert into mail (mail,original_id,original_folder,header,timestamp,uid_usuario,unseen,id_folder,ffrom,subject,fto,cc,body,size,flagged,answered) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",[mail,original_id,original_folder,header,timestamp,login,unseen,id_folder,from,subject,to,cc,body,size,flagged,answered]); 318 319 321 320 322 321 //Preenche os anexos. -
trunk/expressoMail1_2/js/main.js
r5083 r5134 5 5 var autosave_time = 20000; 6 6 7 var results_search_messages = ""; 8 var cabecalho = '<h4>ExpressoLivre - ExpressoMail</h4>'; 9 7 10 function init(){ 8 11 if (!is_ie) … … 20 23 21 24 preferences = data; 25 26 27 if(preferences.show_name_print_messages == "1") { 28 var getUserName = document.getElementById("user_info"); 29 var userName = getUserName.innerHTML; 30 var position = userName.indexOf("-"); 31 var userName = userName.substring(3, position); 32 cabecalho = '<h4>' + userName; 33 } 34 35 22 36 current_folder="INBOX"; 23 24 version = (navigator.userAgent.match( /.+ie\s([\d.]+)/i ) || [])[1];25 if(parseInt(version)==7 && (/trident\/\d/i.test(navigator.userAgent)))26 preferences.use_local_messages="0";27 37 28 38 if( (window.google && google.gears) && !google.gears.factory.getPermission()) … … 318 328 // Call function to draw message 319 329 // If needed, delete old border 320 if (openTab.type[currentTab] == 2 || openTab.type[currentTab] == 3) 330 var isPartMsg = false; 331 for(var ii = 0; ii < partMsgs.length; ii++) 332 if(partMsgs[ii] == ID) isPartMsg = true; 333 334 if ((openTab.type[currentTab] == 2 || openTab.type[currentTab] == 3) && isPartMsg === false) 321 335 delete_border(currentTab,'false'); 322 336 … … 394 408 if(!verify_session(data)) 395 409 return; 410 var total_messages_element = Element('tot_m'); 396 411 397 412 var box = Element("tbody_box"); … … 415 430 416 431 var box = Element("tbody_box"); 417 table_element.insertBefore(box, Element("colgroup_main_"+numBox)); // keeps colgroup as the last child 418 419 if (data.msgs_to_delete.length > 0) 432 //table_element.insertBefore(box, Element("colgroup_main_"+numBox)); // keeps colgroup as the last child 433 //table_element.appendChild(Element("colgroup_main_"+numBox)); 434 435 $(table_element).append(Element("colgroup_main_"+numBox)); 436 437 if (data.msgs_to_delete.length > 0){ 420 438 for (var i=0; i<data.msgs_to_delete.length; i++){ 421 439 if ( (data.msgs_to_delete[i] != undefined) && (data.msgs_to_delete[i] != "")){ … … 423 441 } 424 442 } 425 443 } 426 444 if (data[0].msg_folder != current_folder) // Bad request 427 445 return false; 428 429 var total_messages_element = Element('tot_m');430 431 446 for (var i=0; i<data.length; i++){ 432 447 var existent = document.getElementById(data[i].msg_number); … … 437 452 438 453 if( data[i].next_msg_number != undefined && data[i].next_msg_number != null ){ 439 try { box.insertBefore(new_msg, box.childNodes[data[i].msg_key_position]); } 440 catch (e) { box.insertBefore(new_msg, box.firstChild); } 454 try { 455 box.insertBefore(new_msg, box.childNodes[data[i].msg_key_position]); 456 } 457 catch (e){ 458 $(box).append(new_msg); 459 } 441 460 } 442 461 else if (data[i].Recent == 'N'){ … … 446 465 box.appendChild(new_msg); 447 466 } 448 // if( data[i].next_msg_number != undefined && data[i].next_msg_number != null )449 // box.insertBefore(new_msg, Element(data[i].next_msg_number));450 // else if (data[i].Recent == 'N')451 // box.insertBefore(new_msg,box.firstChild);452 // else453 // box.appendChild(new_msg);454 455 // total_messages_element.innerHTML = parseInt( total_messages_element.innerHTML ) + 1;456 467 } 457 468 } … … 460 471 alert(data['new_msgs'] > 1 ? get_lang("You have %1 new messages", data['new_msgs']) + "!" : get_lang("You have 1 new message") +"!"); 461 472 build_quota(data['quota']); 473 } 474 if(data.new_msgs){ 475 total_messages_element.innerHTML = parseInt( total_messages_element.innerHTML ) + data.new_msgs; 476 }else if(data.tot_msgs){ 477 total_messages_element.innerHTML = data.tot_msgs; 462 478 } 463 479 // Update Box BgColor … … 494 510 } 495 511 496 function delete_msgs(folder, msgs_number, border_ID, show_success_msg,archive){ 512 function delete_msgs(folder, msgs_number, border_ID, show_success_msg,archive){ 513 514 if( preferences.use_local_messages == 1 && expresso_local_messages.isArchiving( msgs_number, folder ) ){ 515 alert( "Impossivel deletar mensagens que estão ainda estão sendo arquivadas." ); 516 return; 517 } 518 497 519 var userTrashFolder = ''; 498 520 … … 507 529 else userTrashFolder = 'INBOX'+cyrus_delimiter+trashfolder; 508 530 509 if(openTab.type[currentTab] == 1) return move_search_msgs('content_id_'+currentTab,userTrashFolder,trashfolder); 510 if(currentTab.toString().indexOf("_r") != -1) msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 531 if(openTab.type[currentTab] == 1) 532 return move_search_msgs('content_id_'+currentTab,userTrashFolder,trashfolder); 533 534 if(currentTab.toString().indexOf("_r") != -1) 535 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 511 536 512 537 if (!archive && (parseInt(preferences.save_deleted_msg)) && (folder != userTrashFolder)){ … … 574 599 575 600 function move_search_msgs(border_id, new_folder, new_folder_name){ 601 602 if( preferences.use_local_messages == 1 && expresso_local_messages.isArchiving( msgs_number, folder ) ){ 603 alert( "Impossivel mover mensagens que estão ainda estão sendo arquivadas." ); 604 return; 605 } 606 576 607 var selected_messages = ''; 577 608 var temp_msg; … … 663 694 } 664 695 665 function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,show_success_msg){ 696 function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,show_success_msg, not_opem_previus){ 697 not_opem_previus = typeof(not_opem_previus) != 'undefined' ? not_opem_previus : false; 698 if( preferences.use_local_messages == 1 && expresso_local_messages.isArchiving( msgs_number, folder ) ){ 699 alert( "Impossivel mover mensagens que estão ainda estão sendo arquivadas." ); 700 return; 701 } 702 666 703 if (! folder || folder == 'null') 667 704 folder = Element("input_folder_"+msgs_number+"_r") ? Element("input_folder_"+msgs_number+"_r").value : (openTab.imapBox[currentTab] ? openTab.imapBox[currentTab]:get_current_folder()); … … 689 726 } 690 727 mail_msg = ( Element("divScrollMain_"+numBox) ) ? Element("divScrollMain_"+numBox).firstChild.firstChild : Element("divScrollMain_0").firstChild.firstChild; 691 if (data.msgs_number.length == 1) 728 if (data.msgs_number.length == 1){ 692 729 write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); 693 else 730 } 731 else{ 694 732 write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); 733 } 695 734 696 735 if (openTab.type[currentTab] > 1){ … … 701 740 var previous_msg = msg_to_delete.previousSibling.id; 702 741 //cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + current_folder, show_msg); 742 if(!not_opem_previus){ 703 743 cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(folder), show_msg); 744 } 704 745 } 705 746 else 706 747 delete_border(currentTab,'false'); 707 748 } 708 else 749 else{ 709 750 delete_border(currentTab,'false'); 751 } 710 752 if(msg_to_delete) 711 753 mail_msg.removeChild(msg_to_delete); … … 715 757 if(box.childNodes.length > 0){ 716 758 updateBoxBgColor(box.childNodes); 759 } 760 if(folder == get_current_folder()){ 761 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - 1; 717 762 } 718 763 return; … … 770 815 delete_border(data.border_ID,'false'); 771 816 } 772 if(folder == get_current_folder()) 817 if(folder == get_current_folder()){ 773 818 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - data.msgs_number.length; 774 819 } 775 820 refresh(); 776 821 } … … 796 841 } 797 842 798 if(currentTab.toString().indexOf("_r") != -1){ 799 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 800 if(msgs_number.indexOf("_s1")) 801 msgs_number = msgs_number.replace('_s1', ''); 843 // se a aba estiver aberta e selecionada, apenas a msg da aba é movida 844 if(currentTab.toString().indexOf("_r") != -1) 845 { 846 //se a aba for aberta atraves de uma pesquisa 847 if(currentTab.toString().indexOf('_s') != -1) 848 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf('_s')); 849 else 850 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf('_r')); 802 851 } 803 852 804 853 if (parseInt(msgs_number) > 0 || msgs_number.length > 0){ 805 var params = "&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+escape(new_folder)+"&new_folder_name="+escape(new_folder_name)+"&get_previous_msg="+preferences.delete_and_show_previous_message; 806 cExecute ("$this.imap_functions.move_messages",handler_move_msgs,params); 854 if(!not_opem_previus){ 855 cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs); 856 }else{ 857 cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+false, handler_move_msgs); 807 858 } 808 else859 }else 809 860 write_msg(get_lang('No selected message.')); 810 861 811 862 } 812 863 813 function move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name) { 814 move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,true); 864 function move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name, not_opem_previus) { 865 move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,true, not_opem_previus); 866 } 867 868 //Caso deseja-se que não se abra a mensagem anterior independente da 869 //preferencia do usuario 870 function move_msgs_not_previus(folder, msgs_number, border_ID, new_folder, new_folder_name) { 871 move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,true, true); 872 } 873 874 function normalizeMsgNumber( msgNumber ){ 875 876 if (msgNumber || msgNumber == 'selected') 877 msgNumber = get_selected_messages(); 878 879 880 // se a aba estiver aberta e selecionada, apenas a msg da aba é movida 881 if(currentTab.toString().indexOf("_r") != -1) 882 { 883 //se a aba for aberta atraves de uma pesquisa 884 if(currentTab.toString().indexOf('_s') != -1) 885 msgNumber = currentTab.toString().substr(0,currentTab.toString().indexOf('_s')); 886 else 887 msgNumber = currentTab.toString().substr(0,currentTab.toString().indexOf('_r')); 888 } 889 890 if (parseInt(msgNumber) <= 0 || msgNumber.length <= 0){ 891 write_msg(get_lang('No selected message.')); 892 return( false ); 893 } 894 895 return( msgNumber ); 896 815 897 } 816 898 … … 828 910 id_msgs = get_selected_messages(); 829 911 912 if ( parseInt(id_msgs) <= 0 || id_msgs.length <= 0 ) 913 return write_msg(get_lang('No selected message.')); 914 830 915 if(folder_dest=='local_root' || folder_dest==null) //Caso seja o primeiro arquivamento... 831 916 folder_dest = 'local_Inbox'; 832 917 833 if (parseInt(id_msgs) > 0 || id_msgs.length > 0) 834 expresso_mail_sync.archive_msgs(folder,folder_dest,id_msgs); 835 //cExecute("$this.imap_functions.get_info_msgs&folder=" + folder + "&msgs_number=" + id_msgs , handler_arquivar_mensagens); 836 else 837 write_msg(get_lang('No selected message.')); 838 918 id_msgs = expresso_local_messages.checkArchived( id_msgs, folder_dest ); 919 920 if( !id_msgs ){ 921 write_msg( "Todas as mensagens já foram arquivadas anteriormente." ); 922 return; 923 } 924 925 document.getElementById("overlay").style.visibility = "visible"; 926 927 var handler_arquivar_mensagens = function(data) { 928 929 var msgs_info = []; 930 931 for( var i = 0; i < data.length; i++ ) 932 msgs_info[i] = connector.unserialize( data[i] ); 933 934 //vejo se já tinha mensagens locais 935 var h = expresso_local_messages.has_local_mails(); 936 937 expresso_local_messages.insert_mails( msgs_info, folder_dest, function( s, f ){complete_archiving( s, f, h )} ); 938 939 document.getElementById("overlay").style.visibility = "hidden"; 940 } 941 942 cExecute( "$this.imap_functions.get_info_msgs&folder=" + folder + "&msgs_number=" + id_msgs, handler_arquivar_mensagens ); 943 } 944 945 function complete_archiving( success, fails, has_local_messages_before ) 946 { 947 var msgs_to_remove = {}; 948 var target = 'INBOX' + cyrus_delimiter + trashfolder + cyrus_delimiter + 'tmpMoveToLocal'; 949 950 success = expresso_local_messages.select_mail( [ 'original_id', 'original_folder' ], success ); 951 952 for (var i = 0; i < success.length; i++) { 953 954 var msg_info = success[i]; 955 956 // if ( msg_info.dest_folder == target ) 957 // { 958 // msg_info.msg_folder += (Date.parse(new Date)); 959 // } 960 961 //////////////// deselecionando //////////////// 962 Element('chk_box_select_all_messages').checked = false; 963 964 if ( Element("check_box_message_" + msg_info.original_id) ) 965 { 966 Element("check_box_message_" + msg_info.original_id).checked = false; 967 } 968 if ( Element(msg_info.original_id) ) 969 { 970 remove_className(Element(msg_info.original_id), 'selected_msg'); 971 } 972 973 // if ( tree_folders._selected.id.indexOf( 'local_' ) == 0 || msg_info.dest_folder.indexOf( target ) == 0 ) 974 // { 975 // openTab.imapBox[0] = ''; 976 // tree_folders.getNodeById( 'local_Inbox' )._select( ); 977 // change_folder('local_Inbox','Inbox'); 978 // } 979 ///////////////////////////////////////////////// 980 981 //As mensagens arquivadas devem ser removidas, caso o usuario tenha isso configurado. 982 msgs_to_remove[ msg_info.original_folder ] = msgs_to_remove[ msg_info.original_folder ] || []; 983 msgs_to_remove[ msg_info.original_folder ].push( msg_info.original_id ); 984 } 985 986 if (preferences.keep_archived_messages == 0) { 987 //Remove as mensagens 988 for( var folder in msgs_to_remove ){ 989 if(folder != 'undefined') 990 delete_msgs(folder, msgs_to_remove[folder],'null',false,true); 991 } 992 } 993 994 if( !has_local_messages_before && expresso_local_messages.has_local_mails() ) 995 ttreeBox.update_folder(); 996 else 997 update_menu(); 839 998 } 840 999 … … 853 1012 854 1013 // Get all TR (messages) in tBody. 855 if(currentTab.toString().indexOf("_r") != -1){856 return currentTab.toString().substr(0,currentTab.toString().indexOf("_r"));857 }858 859 1014 var main_list = main.childNodes; 860 1015 861 var _ check_box;1016 var _tab_prefix = getTabPrefix(); 862 1017 var selected_messages = ''; 863 1018 var selected_messages_by_shortcuts = ''; … … 865 1020 for (j; j<(main_list.length); j++) 866 1021 { 867 _check_box = Element("check_box_message_" + main_list[j].id); 868 869 if ( (_check_box) && (_check_box.checked) ) 1022 1023 if ( (!isNaN(parseInt(numBox))) && (numBox == 0)) { 1024 check_box = Element("check_box_message_" + main_list[j].id); 1025 } else { 1026 id_mensagem = main_list[j].id.split('_'); 1027 check_box = Element("search_" + numBox + "_check_box_message_" + id_mensagem[0]); 1028 } 1029 1030 if ( (check_box) && (check_box.checked) ) 870 1031 selected_messages += main_list[j].id + ','; 871 1032 … … 880 1041 selected_messages = selected_messages.substring(0,(selected_messages.length-1)); 881 1042 1043 1044 /* Verifica se está na tela de pesquisa. */ 1045 if(selected_messages.indexOf("_") != -1) 1046 { 1047 results_search_messages = selected_messages; 1048 /* Retira a informação da aba */ 1049 selected_messages = selected_messages.substring(0,selected_messages.indexOf("_")); 1050 } 1051 1052 882 1053 if (preferences.use_shortcuts == '1') 883 1054 { … … 897 1068 else 898 1069 return selected_messages; 899 }900 901 function get_selected_messages_folder(){902 var _main;903 var _main_list;904 try{905 _main = document.getElementById("divScrollMain_"+numBox).firstChild.firstChild;906 }catch(e){907 };908 909 if (! _main)910 _main = Element("tbody_box_"+numBox);911 912 if (! _main)913 _main = Element("tbody_box");914 915 // Get all TR (messages) in tBody.916 _main_list = _main.childNodes;917 918 var _check_box;919 var selected_messages_folder;920 // var selected_messages_by_shortcuts = '';921 var j = 0;922 for (j; j<(_main_list.length); j++)923 {924 925 _check_box = Element("check_box_message_" + _main_list[j].id);926 927 if ( (_check_box) && (_check_box.checked) && (_main_list[j].name) ) {928 if (!selected_messages_folder)929 selected_messages_folder = _main_list[j].name;930 else {931 if (selected_messages_folder!=_main_list[j].name)932 return false;933 }934 }935 }936 return selected_messages_folder;937 1070 } 938 1071 … … 971 1104 9 : get_lang("Reply without history"), 972 1105 10: get_lang("Reply to all without history")}; 973 1106 if(new_border_ID != 0) 974 1107 if(!confirm(get_lang("Your message to %1 has not been saved or sent. "+ 975 1108 "To %2 will be necessary open it again. Discard your message?", … … 982 1115 } 983 1116 } 1117 } 1118 if (new_border_ID == 'maximo'){ 1119 RichTextEditor.editorReady = true; 1120 return false; 984 1121 } 985 1122 if (new_border_ID == false) … … 1039 1176 if (document.getElementById("subject_" + border_ID)) 1040 1177 data.subject = document.getElementById("subject_" + border_ID).innerHTML; 1178 if(data.subject == get_lang("(no subject) ")) 1179 data.subject = ''; 1180 1041 1181 if (document.getElementById("body_" + border_ID)) 1042 1182 data.body = document.getElementById("body_" + border_ID).innerHTML; … … 1052 1192 data.date_hour = Element('date_hour_' + border_ID).value; 1053 1193 } 1194 1054 1195 var signature = RichTextEditor.getSignatureDefault(); 1055 if(type!="new" && type!="edit") 1196 1197 if(type!="new" && type!="edit" && document.getElementById("is_local_"+border_ID) != null) 1056 1198 data.is_local_message = (document.getElementById("is_local_"+border_ID).value=="1")?true:false; 1057 1199 switch(type){ … … 1061 1203 title = "Re: " + data.subject; 1062 1204 Element("subject_" + new_border_ID).value = "Re: " + data.subject; 1063 useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); 1205 1206 if (data.is_local_message){ 1207 alert(get_lang("In the local file attachments, including images, will be disregarded. To forward / reply with the attachments, please first make the reopening of the message")+'.'); 1208 var imagens = data.body.match(/<img[^>]*>/g); 1209 if(imagens != null) 1210 for (var x = 0; x < imagens.length; x++) 1211 data.body = data.body.replace(imagens[x],''); 1212 }else{ 1213 useOriginalAttachments(new_border_ID,border_ID); 1214 } 1215 1064 1216 // Insert the signature automaticaly at message body if use_signature preference is set 1065 1217 if (preferences.use_signature == "1"){ … … 1077 1229 Element("subject_" + new_border_ID).value = "Re: " + data.subject; 1078 1230 Element("to_" + new_border_ID).value = data.to; 1079 useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); 1231 if(data.is_local_message){ 1232 alert(get_lang("In the local file attachments, including images, will be disregarded. To forward / reply with the attachments, please first make the reopening of the message")+'.'); 1233 var imagens = data.body.match(/<img[^>]*>/g); 1234 if(imagens != null) 1235 for (var x = 0; x < imagens.length; x++) 1236 data.body = data.body.replace(imagens[x],''); 1237 }else{ 1238 useOriginalAttachments(new_border_ID,border_ID); 1239 } 1240 1080 1241 block_quoted_body = make_body_reply(data.body, data.to, data.date_day, data.date_hour); 1081 1242 // Insert the signature automaticaly at message body if use_signature preference is set … … 1112 1273 Element('space_link_' + new_border_ID).style.display='none'; 1113 1274 } 1114 useOriginalAttachments(new_border_ID,border_ID,data.is_local_message); 1275 if (data.is_local_message){ 1276 alert(get_lang("In the local file attachments, including images, will be disregarded. To forward / reply with the attachments, please first make the reopening of the message")+'.'); 1277 var imagens = data.body.match(/<img[^>]*>/g); 1278 if(imagens != null) 1279 for (var x = 0; x < imagens.length; x++) 1280 data.body = data.body.replace(imagens[x],''); 1281 } 1282 else useOriginalAttachments(new_border_ID,border_ID); 1283 1115 1284 // Insert the signature automaticaly at message body if use_signature preference is set 1116 1285 if (preferences.use_signature == "1") … … 1160 1329 break; 1161 1330 case "forward": 1162 data.is_local_message = (document.getElementById("is_local_"+border_ID).value=="1")?true:false;1331 1163 1332 msg_forward_from = document.createElement('input'); 1164 1333 msg_forward_from.id = "msg_forward_from_" + new_border_ID; … … 1169 1338 document.getElementById("subject_" + new_border_ID).value = "Fw: " + data.subject; 1170 1339 var divFiles = Element("divFiles_"+new_border_ID); 1340 1341 1342 if (data.is_local_message) {//Local messages 1343 document.getElementById("is_local_forward"+new_border_ID).value = "1"; 1344 alert(get_lang("In the local file attachments, including images, will be disregarded. To forward / reply with the attachments, please first make the reopening of the message")+'.'); 1345 var imagens = data.body.match(/<img[^>]*>/g); 1346 if(imagens != null) 1347 for (var x = 0; x < imagens.length; x++) 1348 data.body = data.body.replace(imagens[x],''); 1349 } 1350 else{ 1351 1352 1353 1171 1354 var campo_arquivo; 1355 1172 1356 if (Element("attachments_" + border_ID)){ 1173 1357 var attachments = document.getElementById("attachments_" + border_ID).getElementsByTagName("a"); 1174 1358 1175 for (var i = (attachments.length > 1 ? 1 : 0); i < attachments.length; i++){1359 for (var i = 0; i < attachments.length; i++){ 1176 1360 if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") || 1177 1361 ((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1))) … … 1191 1375 } 1192 1376 else { 1193 var tempNomeArquivo = attachments[i].firstChild.nodeValue.split("(");1194 var nomeArquivo = t rim(tempNomeArquivo[0]);1377 var tempNomeArquivo = tmp.split("&newfilename="); 1378 var nomeArquivo = tempNomeArquivo[tempNomeArquivo.length - 1]; 1195 1379 } 1196 1380 … … 1218 1402 } 1219 1403 } 1404 } 1220 1405 // Insert the signature automaticaly at message body if use_signature preference is set 1221 if (preferences.use_signature == "1")1406 if (preferences.use_signature == "1") 1222 1407 RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + signature + '<div><br type="_moz"></div>'+ make_forward_body(data.body, data.to, data.date, data.subject, data.to_all, data.cc)); 1223 1408 else … … 1266 1451 Element("to_" + new_border_ID).value = data.to; 1267 1452 if (data.cc){ 1453 data.cc = data.cc.replace(/</gi,"<"); 1454 data.cc = data.cc.replace(/>/gi,">"); 1268 1455 Element("cc_" + new_border_ID).value = data.cc; 1269 Element("space_link_" + new_border_ID).style.display = 'none';1270 1456 Element("a_cc_link_" + new_border_ID).style.display = 'none'; 1457 if(Element("cco_" + new_border_ID) != null) 1458 Element("space_link_" + new_border_ID).style.display = 'none'; 1271 1459 Element("tr_cc_"+ new_border_ID).style.display = ''; 1272 1460 } 1273 1461 if (data.cco){ 1462 if(Element("cco_" + new_border_ID) != null){ 1274 1463 Element("cco_" + new_border_ID).value = data.cco; 1275 1464 Element("space_link_" + new_border_ID).style.display = 'none'; … … 1277 1466 Element("tr_cco_"+ new_border_ID).style.display = ''; 1278 1467 } 1468 } 1279 1469 Element("subject_" + new_border_ID).value = data.subject; 1280 1470 … … 1284 1474 var element_important_message = Element("important_message_" + new_border_ID); 1285 1475 if(element_important_message) { 1286 if(Element("is_important_" + border_ID).value == "1") element_important_message.checked = true; 1476 1477 if(Element("disposition_important_" + border_ID)) 1478 element_important_message.checked = true; 1287 1479 } 1288 1480 … … 1301 1493 tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); 1302 1494 a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; 1303 s_tmp = trim(escape(connector.serialize(a_tmp))); 1495 s_tmp = escape(connector.serialize(a_tmp)); 1496 1304 1497 divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; 1305 1498 divFiles.appendChild(link_attachment); … … 1315 1508 set_border_caption("border_id_" + new_border_ID, title); 1316 1509 1317 1510 resizeWindow(); 1511 //save_msg(new_border_ID); 1318 1512 return new_border_ID; //Preciso retornar o ID da nova mensagem. 1319 1513 } … … 1484 1678 { 1485 1679 var handler = function(data){ 1486 if(typeof(expresso_local_messages) != "undefined"){ 1680 1487 1681 if(data.msg_day == '') 1488 1682 { 1489 1683 header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder())); 1490 if(header){ 1684 1491 1685 data.fulldate=header.fulldate; 1492 1686 data.smalldate=header.smalldate; 1493 1687 data.msg_day = header.msg_day; 1494 1688 data.msg_hour = header.msg_hour; 1495 } 1496 } 1689 1497 1690 } 1498 1691 this.show_msg(data); … … 1564 1757 mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 1565 1758 1759 var content_body = RichTextEditor.getData('body_'+ID); 1760 //Remove imagens do corpo que estao com o checkbox desmarcados 1761 var files_checkbox = $("#divFiles_"+ID+" input:checkbox"); 1762 var files_unchecked = new Array(); 1763 for (var i = 0; i < files_checkbox.length; i++) 1764 if(files_checkbox[i].checked !== true) 1765 files_unchecked.push(connector.unserialize(unescape(trim(files_checkbox[i].value)))); 1766 1767 var imagens = content_body.match(/<img[^>]*>/g); 1768 1769 if(imagens != null) 1770 for (var x = 0; x < imagens.length; x++) 1771 for (var xx = 0; xx < files_unchecked.length; xx++) 1772 if(imagens[x].indexOf('indexPart='+files_unchecked[xx][3].replace(/'/g,'')) !== -1) 1773 content_body = content_body.replace(imagens[x],''); 1774 1775 //--------------------------------------------------------------------------// 1776 1566 1777 var textArea = document.createElement("TEXTAREA"); 1567 1778 textArea.style.display='none'; 1568 1779 textArea.name = "body"; 1569 textArea.value = RichTextEditor.getData('body_'+ID); 1780 textArea.value = content_body; 1781 1570 1782 var input_folder = document.createElement("INPUT"); 1571 1783 input_folder.style.display='none'; … … 1633 1845 handler_send_message(data_return,ID); 1634 1846 } 1635 else 1847 else{ 1636 1848 cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID); 1849 } 1850 } 1851 function is_valid_email(campo){ 1852 var invalidEmail = searchEmail(campo); 1853 var semicolon = campo.split(";"); 1854 1855 if((campo.replace(/^\s+|\s+$/g,"")) != ""){ 1856 if(invalidEmail[0] == true){ 1857 write_msg("Erro de SMTP: Os endereços de destinatário a seguir falharam: "+ invalidEmail[1]); 1858 return false; 1859 }else{ 1860 if(semicolon.length > 1){ 1861 var stringError = "Erro de SMTP: Os endereços devem ser separados apenas por vígula: "; 1862 for(var i= 0; i < semicolon.length; i++){ 1863 stringError = stringError + semicolon[i]; 1864 if(i+1 < semicolon.length) 1865 stringError = stringError + " ; "; 1866 } 1867 write_msg(stringError); 1868 return false; 1869 }else { 1870 return true; 1871 } 1872 } 1873 } 1874 else{ 1875 write_msg(get_lang("Message without receiver")); 1876 return false; 1877 } 1637 1878 } 1638 1879 function change_tr_properties(tr_element, newUid, newSubject){ … … 1657 1898 { 1658 1899 Element("send_button_"+border_id).style.visibility="visible"; 1659 var handler_delete_msg = function(data){refresh(preferences.alert_new_msg);}; 1660 1661 if (data == null || data.append != true ) 1900 var handler_delete_msg = function(data){refresh(preferences.alert_new_msg);RichTextEditor.execPosInstance('body_'+border_id);}; 1901 if(data === null) 1662 1902 { 1663 RichTextEditor.saveFlag = 0; 1664 if (! data.append) 1665 if(data == 'Post-Content-Length') 1666 write_msg(get_lang('The size of this message has exceeded the limit (%1B).', preferences.max_attachment_size ? preferences.max_attachment_size : Element('upload_max_filesize').value)); 1667 else 1903 write_msg(get_lang('ERROR saving your message.')); 1904 return null; 1905 } 1906 1907 if(data.append === "Over quota"){ 1908 write_msg(get_lang('ERROR saving your message over quota.')); 1909 return; 1910 } 1911 else if ( data.append !== true ) 1912 { 1913 if (data.append == null) 1668 1914 write_msg(get_lang('ERROR saving your message.')); 1669 1915 else … … 1685 1931 { 1686 1932 var newImage = false; 1933 RichTextEditor.saveFlag = 1; 1687 1934 openTab.imapUid[border_id] = data.msg_no; 1688 1935 openTab.imapBox[border_id] = data.folder_id; 1689 1936 1690 1937 var newTitle = document.getElementById('subject_'+border_id).value; 1691 if (newTitle == '') 1938 if (newTitle.length > 18) 1939 newTitle = newTitle.substr(18) + '...'; 1940 else if (newTitle == '') 1692 1941 newTitle = get_lang("No subject"); 1693 set_border_caption('border_id_'+border_id, newTitle); 1942 document.getElementById('font_border_id_'+border_id).innerHTML = newTitle; 1943 Element('border_id_'+border_id).title = newTitle; 1694 1944 1695 1945 // Replace the embedded images for new uids 1696 1946 var content_body = RichTextEditor.getData('body_'+border_id); 1697 1698 if (is_ie) 1947 var body_images = content_body.match(/msgNumber=\d*/g); 1948 var folder_images = content_body.match(/msgFolder=[^&]*&/g); 1949 1950 if (body_images != null) 1699 1951 { 1700 var content_body = mainField.document.getElementsByTagName('body').item(0).innerHTML; 1701 var body_images = content_body.match(/msg_num=\d*/g); 1702 var images_part = content_body.match(/msg_part=\d*/g); 1703 if (body_images) 1952 for (var i=0; i<body_images.length; i++) 1704 1953 { 1705 for (var i=0; i<body_images.length; i++){ 1706 content_body = content_body.replace(body_images[i],"msg_num="+openTab.imapUid[border_id]); 1954 if( folder_images != null) 1955 content_body = content_body.replace(folder_images[i], "msgFolder=INBOX" + cyrus_delimiter + draftsfolder +"&"); 1956 1957 1958 1959 1960 content_body = content_body.replace(body_images[i],"msgNumber="+openTab.imapUid[border_id]); 1961 } 1962 1963 var images_part = content_body.match(/indexPart=[0-9.]*/g); 1964 1965 if(images_part != null) 1966 { 1967 for (var x = 0; x < images_part.length; x++) 1968 { 1969 var position = images_part[x].substr(10,images_part[x].length); 1970 content_body = content_body.replace(images_part[x],'indexPart(||.|||.||)='+data.imagesParts[position]); 1971 } 1972 1707 1973 } 1708 1709 var allImgs = new Array (images_part.length); 1710 //var j=-1; 1711 for (var i in images_part){ 1712 1713 if (i == 0) 1714 var image_number = parseInt(images_part[i].substr(9)); 1715 else 1716 image_number = "null"; 1717 1718 if (! isNaN(image_number)) 1719 { 1720 if (! allImgs[image_number]) 1721 { 1722 allImgs[image_number] = true; 1723 //j--; 1724 } 1725 //content_body = content_body.replace(images_part[i],'msg_part='+j); 1726 } 1727 //content_body = content_body.replace(/msg_part=-/g,'msg_part='); 1728 } 1729 1974 content_body = content_body.replace(/indexPart\(\|\|\.\|\|\|\.\|\|\)=/g,'indexPart='); 1730 1975 } 1731 } 1732 else 1733 { 1734 for (var i = 0; i < bodyChildNodes.length; i++){ 1735 if (typeof(bodyChildNodes[i].tagName) != 'undefined' && bodyChildNodes[i].tagName.search(/img/i) != -1) 1736 { 1737 bodyChildNodes[i].src = bodyChildNodes[i].src.replace(/msg_num=\d*/g, "msg_num="+openTab.imapUid[border_id]); 1738 1739 var allImgs = new Array(); 1740 var image_number = parseInt(bodyChildNodes[i].src.match(/msg_part=\d*/g)[0].substr(9)); 1741 if (! allImgs[image_number]) 1742 { 1743 allImgs[image_number] = true; 1744 } 1745 } 1746 else 1747 { 1748 continue; 1749 } 1750 1751 } 1752 } 1976 1977 1753 1978 1754 1979 //Replace all files to new files 1755 1980 var divFiles = Element("divFiles_"+border_id); 1756 elFiles = divFiles.getElementsByTagName("input"); 1757 var countCheck =0; 1758 for (var i=0; i<elFiles.length; i++) { 1759 if(elFiles[i].value !=""){ 1760 if (elFiles[i].type == "checkbox") { 1761 var tmpData = connector.unserialize(decodeURIComponent(elFiles[i].value)); 1762 tmpData[1] = data.msg_no; 1763 elFiles[i].value = encodeURIComponent(connector.serialize(tmpData)); 1764 countCheck++; 1765 } 1766 else { 1767 elFiles[i].value =""; 1768 parantNodeFile = elFiles[i].parentNode.parentNode; 1769 parantNodeFile.removeChild(elFiles[i].parentNode); 1770 i--; 1771 } 1772 } 1773 } 1981 divFiles.innerHTML = ''; 1982 1774 1983 1775 1984 var attach_files = connector.unserialize(data.files); 1776 1985 if (attach_files != null) { 1777 1986 openTab.countFile[border_id] = attach_files.length; 1778 att_index = countCheck; 1779 for (att_index; att_index < attach_files.length; att_index++) 1780 { 1987 for (var att_index = 0; att_index < attach_files.length; att_index++){ 1781 1988 1782 1989 var link_attachment = document.createElement("a"); 1783 var fileName = attach_files[att_index].substr(0,attach_files[att_index].indexOf('_SIZE_')); 1784 var fileSize = parseInt(attach_files[att_index].substr(attach_files[att_index].indexOf('_SIZE_')+6))/1024 1785 link_attachment.innerHTML = fileName + " ("+borkb((parseInt(fileSize)*1024))+")"; 1786 1787 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','"+(att_index+2)+"','base64'"; 1990 1991 var fileName = Base64.decode(attach_files[att_index].name); 1992 var fileSize = attach_files[att_index].size / 1024; 1993 1994 1995 link_attachment.innerHTML = fileName + " ("+parseInt(fileSize)+" kb)"; 1996 1997 var encoding = /\.eml$/.exec(fileName)? '7bit' : 'base64'; 1998 var href = "'"+folder_id+"','"+data.msg_no+"','"+(att_index)+"','0."+(att_index+1)+"','"+encoding+"'"; 1788 1999 1789 2000 link_attachment.setAttribute("href", "javascript:download_attachments("+href+")"); … … 1793 2004 s_tmp = escape(connector.serialize(a_tmp)); 1794 2005 1795 var check_attachment = document.createElement(" INPUT");2006 var check_attachment = document.createElement("input"); 1796 2007 check_attachment.type = 'CHECKBOX'; 1797 2008 check_attachment.name = 'forwarding_attachments[]'; 1798 check_attachment.value = trim(s_tmp); 1799 1800 if (!divFiles.childNodes[0]) 1801 { 1802 divFiles.appendChild(document.createElement("BR")); 1803 } 1804 else 1805 { 1806 divFiles.insertBefore(document.createElement("BR"),divFiles.childNodes[0]); 1807 } 1808 1809 divFiles.insertBefore(link_attachment,divFiles.childNodes[0]); 1810 divFiles.insertBefore(check_attachment,divFiles.childNodes[0]); 1811 1812 check_attachment.checked = true; 1813 check_attachment.setAttribute("checked", "checked"); 2009 check_attachment.value = s_tmp; 2010 2011 1814 2012 1815 2013 divFiles.appendChild(check_attachment); 1816 2014 divFiles.appendChild(link_attachment); 2015 1817 2016 divFiles.appendChild(document.createElement("br")); 2017 2018 check_attachment.checked = true; 2019 check_attachment.setAttribute("checked", "checked"); 1818 2020 } 1819 2021 } … … 1843 2045 change_tr_properties(tr_msg, data.msg_no, data.subject); 1844 2046 } 1845 } else { 1846 refresh(); 1847 } 1848 1849 var save_link = Element("save_message_options_"+border_id); 1850 save_link.onclick = ''; 1851 save_link.className = 'message_options_inactive'; 1852 watch_changes_in_msg(border_id); 1853 write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name))); 1854 setTimeout( function(){RichTextEditor.saveFlag = 1;}, 1000 ); 1855 } 1856 } 1857 1858 function save_msg(border_id,withImage){ 2047 2048 } 2049 setTimeout( function(){RichTextEditor.saveFlag = 1;RichTextEditor.execPosInstance('body_'+border_id);}, 1000 ); 2050 } 2051 return null; 2052 } 2053 2054 function save_msg(border_id,withImage, out){ 1859 2055 if (typeof(withImage) == 'undefined') 1860 2056 withImage = false; … … 1867 2063 var folder_id = openTab.imapBox[border_id]; 1868 2064 else 1869 var folder_id = "INBOX /"+draftsfolder;2065 var folder_id = "INBOX" + cyrus_delimiter + draftsfolder; 1870 2066 1871 2067 if (folder_id == 'INBOX') // and folder name from border … … 1879 2075 tmp_folder_id=folder_id; 1880 2076 message_id = openTab.imapUid[border_id]; 1881 var handler_save_msg = function(data){return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id);} 2077 var handler_save_msg = function(data){ 2078 if(typeof(out) == 'undefined'){ 2079 return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); 2080 var save_link = Element("save_message_options_"+border_id); 2081 if(!withImage){ 2082 if(data.append === true){ 2083 save_link.className = 'message_options_inactive'; 2084 save_link.onclick = ''; 2085 watch_changes_in_msg(border_id); 2086 write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name))); 2087 } 2088 if(auto){ 2089 auto = false; 2090 } 2091 } 2092 else{ 2093 write_msg(get_lang('Wait a moment, your image is uploading ...')); 2094 var auto = true; 2095 setTimeout( function(){save_msg(border_id)}, 1000 ); 2096 } 2097 }else{ 2098 if(data.append === true){ 2099 write_msg(get_lang('Your message was save as draft in folder %1.', lang_folder(folder_name))); 2100 }else if(data.append == null){ 2101 write_msg(get_lang('ERROR saving your message.')); 2102 }if(data.append === "Over quota"){ 2103 write_msg(get_lang('ERROR saving your message over quota.')); 2104 } 2105 } 2106 2107 } 1882 2108 1883 2109 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id ); 1884 2110 mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 1885 2111 2112 var content_body = RichTextEditor.getData("body_"+border_id); 2113 //Remove imagens do corpo que estao com o checkbox desmarcados 2114 var files_checkbox = $("#divFiles_"+border_id+" input:checkbox"); 2115 var files_unchecked = new Array(); 2116 for (var i = 0; i < files_checkbox.length; i++) 2117 if(files_checkbox[i].checked !== true) 2118 files_unchecked.push(connector.unserialize(unescape(trim(files_checkbox[i].value)))); 2119 2120 var imagens = content_body.match(/<img[^>]*>/g); 2121 if(imagens != null) 2122 for (var x = 0; x < imagens.length; x++) 2123 for (var xx = 0; xx < files_unchecked.length; xx++) 2124 if(imagens[x].indexOf('indexPart='+files_unchecked[xx][3].replace(/'/g,'')) !== -1) 2125 content_body = content_body.replace(imagens[x],''); 2126 2127 if(files_unchecked.length > 0) 2128 RichTextEditor.setData("body_"+border_id,content_body); 2129 2130 1886 2131 var textArea = document.createElement("TEXTAREA"); 1887 2132 textArea.style.display='none'; 1888 2133 textArea.name = "body"; 1889 textArea.value = RichTextEditor.getData("body_"+border_id);2134 textArea.value = content_body; 1890 2135 var input_folder = document.createElement("INPUT"); 1891 2136 input_folder.style.display='none'; … … 1948 2193 } 1949 2194 else 1950 write_msg( 'ERROR saving your message.');2195 write_msg(get_lang('ERROR saving your message.')); 1951 2196 } 1952 2197 … … 1957 2202 tmp_folder_name=folder_name; 1958 2203 var handler_save_msg = function(data){return_saveas(data,this.tmp_border_id,this.tmp_folder_name);} 2204 2205 var content_body = RichTextEditor.getData("body_"+border_id); 2206 //Remove imagens do corpo que estao com o checkbox desmarcados 2207 var files_checkbox = $("#divFiles_"+border_id+" input:checkbox"); 2208 var files_unchecked = new Array(); 2209 for (var i = 0; i < files_checkbox.length; i++) 2210 if(files_checkbox[i].checked !== true) 2211 files_unchecked.push(connector.unserialize(unescape(trim(files_checkbox[i].value)))); 2212 2213 var imagens = content_body.match(/<img[^>]*>/g); 2214 2215 if(imagens != null) 2216 for (var x = 0; x < imagens.length; x++) 2217 for (var xx = 0; xx < files_unchecked.length; xx++) 2218 if(imagens[x].indexOf('indexPart='+files_unchecked[xx][3].replace(/'/g,'')) !== -1) 2219 content_body = content_body.replace(imagens[x],''); 2220 1959 2221 var textArea = document.createElement("TEXTAREA"); 1960 2222 textArea.style.display='none'; 1961 2223 textArea.name = "body"; 1962 textArea.value = RichTextEditor.getData("body_"+border_id);2224 textArea.value = content_body; 1963 2225 1964 2226 var input_folder = document.createElement("INPUT"); … … 1984 2246 function set_messages_flag(flag, msgs_to_set){ 1985 2247 var handler_set_messages_flag = function (data){ 1986 var _tab_sufix = getTabSufix();1987 var _chk_box;1988 var _fld_box;1989 2248 if(!verify_session(data)) 1990 2249 return; 1991 var msgs_to_set = data.msgs_to_set.split(","); // messages ids 1992 var rowids_to_set = data.rowids_to_set.split(","); // rows ids 2250 var msgs_to_set = data.msgs_to_set.split(","); 1993 2251 1994 2252 if(!data.status) { … … 1996 2254 Element('chk_box_select_all_messages').checked = false; 1997 2255 for (var i = 0; i < msgs_to_set.length; i++) { 1998 Element("check_box_message_" + rowids_to_set[i]).checked = false;1999 remove_className(Element( rowids_to_set[i]), 'selected_msg');2256 Element("check_box_message_" + msgs_to_set[i]).checked = false; 2257 remove_className(Element(msgs_to_set[i]), 'selected_msg'); 2000 2258 } 2001 2259 if(!data.msgs_unflageds) … … 2027 2285 } 2028 2286 proxy_mensagens.get_msg(msgs_to_set[i],current_folder, false, setFlag); 2029 } 2030 2031 _chk_box = Element("check_box_message_" + rowids_to_set[i]); 2032 _fld_box = (_tab_sufix ? Element("check_box_message_" + msgs_to_set[i]) : null); 2033 if(_chk_box){ 2287 2288 2289 } 2290 if(Element("check_box_message_" + msgs_to_set[i])){ 2034 2291 switch(data.flag){ 2035 2292 case "unseen": 2036 set_msg_as_unread(rowids_to_set[i]);2037 if (_fld_box)2038 2293 set_msg_as_unread(msgs_to_set[i]); 2039 _chk_box.checked = false; 2294 if(results_search_messages != "") 2295 set_msg_as_unread(results_search_messages, true); 2296 Element("check_box_message_" + msgs_to_set[i]).checked = false; 2040 2297 break; 2041 2298 case "seen": 2042 set_msg_as_read( rowids_to_set[i], false);2043 if (_fld_box)2044 set_msg_as_read( msgs_to_set[i]);2045 _chk_box.checked = false;2299 set_msg_as_read(msgs_to_set[i], false); 2300 if(results_search_messages != "") 2301 set_msg_as_read(results_search_messages, false, true); 2302 Element("check_box_message_" + msgs_to_set[i]).checked = false; 2046 2303 break; 2047 2304 case "flagged": 2048 set_msg_as_flagged(rowids_to_set[i]);2049 if (_fld_box)2050 2305 set_msg_as_flagged(msgs_to_set[i]); 2051 _chk_box.checked = false; 2306 if(results_search_messages != "") 2307 set_msg_as_flagged(results_search_messages, true); 2308 document.getElementById("check_box_message_" + msgs_to_set[i]).checked = false; 2052 2309 break; 2053 2310 case "unflagged": 2054 set_msg_as_unflagged(rowids_to_set[i]);2055 if (_fld_box)2056 2311 set_msg_as_unflagged(msgs_to_set[i]); 2057 _chk_box.checked = false; 2312 if(results_search_messages != "") 2313 set_msg_as_unflagged(results_search_messages, true); 2314 Element("check_box_message_" + msgs_to_set[i]).checked = false; 2058 2315 break; 2059 2316 } … … 2064 2321 2065 2322 var folder = get_current_folder(); 2066 if (msgs_to_set == 'get_selected_messages') {2323 if (msgs_to_set == 'get_selected_messages') 2067 2324 var msgs_to_set = this.get_selected_messages(); 2068 if ( (msgs_to_set) && (msgs_to_set.match(/_s/)) ) {2069 folder = get_selected_messages_folder();2070 if (!folder) {2071 alert(get_lang("You cant manipulate messages from multiple folders on search"));2072 return;2073 }2074 }2075 }2076 2325 else 2077 2326 folder = Element("input_folder_"+msgs_to_set+"_r").value; 2078 2327 2079 2328 if (msgs_to_set) 2080 if (folder && proxy_mensagens.is_local_folder(folder))2081 expresso_local_messages.set_messages_flag(msgs_to_set, flag); //expresso_local_messages.set_messages_flag(msgs_to_set.replace(/_s[^,]*/g,""), flag);2082 else2083 2329 cExecute ("$this.imap_functions.set_messages_flag&folder="+folder+"&msgs_to_set="+msgs_to_set+"&flag="+flag, handler_set_messages_flag); 2084 2330 else … … 2137 2383 var folder= Element('border_id_0').innerHTML; 2138 2384 var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML; 2385 2386 msgs_number = get_selected_messages(); 2387 if(msgs_number == false){ 2139 2388 var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML; 2389 }else{ 2390 msgs_number = msgs_number.split(","); 2391 var tbody = ""; 2392 for(var i = 0; i < msgs_number.length; i++){ 2393 tbody += "<tr id="+msgs_number[i]+" class=\"tr_msg_unread tr_msg_read2\">"+ Element(msgs_number[i]).innerHTML+"</tr>"; 2394 } 2395 } 2140 2396 var print_width = screen.width - 200; 2141 2397 var x = ((screen.width - print_width) / 2); … … 2151 2407 thead = thead.replace(seekDot, "style='display:none'"); 2152 2408 tbody = tbody.replace(seekDot, "style='display:none'"); 2153 2409 thead = thead.replace("<td style=\"cursor: pointer;\"></td>", ""); 2410 thead = thead.replace("<td style=\"cursor: pointer;\" style='display:none'><input title=\"Selecionar todas as mensagens.\" class=\"checkbox\" id=\"chk_box_select_all_messages\" type=\"checkbox\"></td>", ""); 2154 2411 while (1){ 2155 2412 try{ … … 2157 2414 var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>' 2158 2415 + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>' 2159 + '<body class="print-all-messages"><h1>ExpressoLivre - ExpressoMail</h1>'2416 + cabecalho + '</h4><hr>' 2160 2417 + '<h2>'+folder+'</h2><hr/><blockquote><font size="2">' 2161 2418 + '<table width="100%" cellpadding="0" cellspacing="0">' … … 2204 2461 else if(countAtt > 1) 2205 2462 for (var i = 1; i <attachments.getElementsByTagName('a').length; i++) 2206 att += attachments.getElementsByTagName('a')[i].innerHTML + " | ";2463 att += " | " + attachments.getElementsByTagName('a')[i].innerHTML; 2207 2464 } 2208 2465 2209 2466 var body = Element('body_'+border_ID); 2210 2467 2211 if(!is_ie)2212 {2213 var link = location.href.replace(/\/expressoMail1_2\/(.*)/, "");2214 var tab_tags = body.getElementsByTagName("IMG");2215 for(var i = 0; i < tab_tags.length;i++)2216 {2217 var _img = document.createElement("IMG");2218 _img.src = tab_tags[i].src;2219 if(tab_tags[i].src.toUpperCase().indexOf('/INC/SHOW_EMBEDDED_ATTACH.PHP?MSG_FOLDER=') > -1)2220 {2221 _img.src = link + '/expressoMail1_2'+tab_tags[i].src.substr(tab_tags[i].src.toUpperCase().indexOf('/INC/SHOW_EMBEDDED_ATTACH.PHP?MSG_FOLDER='));2222 }2223 tab_tags[i].parentNode.replaceChild(_img,tab_tags[i]);2224 }2225 }2226 2468 var print_width = screen.width - 200; 2227 2469 var x = ((screen.width - print_width) / 2); … … 2258 2500 try{ 2259 2501 var html ='<body>'; 2260 html += "<h4>ExpressoLivre - ExpressoMail</h4><hr>";2502 html += cabecalho + '</h4><hr>'; 2261 2503 html += '<table><tbody>'; 2262 2504 if(sender) … … 2289 2531 html += "</tbody></table><hr>"; 2290 2532 window_print.document.write(html + body.innerHTML); 2291 if(!is_ie){ 2533 2292 2534 var tab_tags = window_print.document.getElementsByTagName("IMG"); 2535 var link = location.href.replace(/\/expressoMail1_2\/(.*)/, ""); 2293 2536 for(var i = 0; i < tab_tags.length;i++){ 2294 var _img = document.createElement("IMG"); 2295 _img.src = tab_tags[i].src; 2537 var _img = tab_tags[i].cloneNode(true); 2538 if(tab_tags[i].src.toUpperCase().indexOf('INC/GET_ARCHIVE.PHP?MSGFOLDER=') > -1) 2539 _img.src = link + '/expressoMail1_2/'+tab_tags[i].src.substr(tab_tags[i].src.toUpperCase().indexOf('INC/GET_ARCHIVE.PHP?MSGFOLDER=')); 2540 2296 2541 tab_tags[i].parentNode.replaceChild(_img,tab_tags[i]); 2297 2542 } 2298 } 2543 2299 2544 break; 2300 2545 } … … 2319 2564 if (get_current_folder() == 'INBOX'+cyrus_delimiter+trashfolder){ 2320 2565 draw_paging(0); 2321 kill_current_box();2566 remove_rows(document.getElementById("table_box")); 2322 2567 Element('tot_m').innerHTML = 0; 2323 2568 Element('new_m').innerHTML = 0; … … 2339 2584 if (get_current_folder() == 'INBOX'+cyrus_delimiter+spamfolder){ 2340 2585 draw_paging(0); 2341 kill_current_box();2586 remove_rows(document.getElementById("table_box")); 2342 2587 } 2343 2588 tree_folders.getNodeById('INBOX'+cyrus_delimiter+spamfolder).alter({caption: get_lang("Spam")}); … … 2367 2612 write_msg(get_lang('Error compressing messages (ZIP). Contact the administrator.')); 2368 2613 } 2369 else 2370 download_attachments(null, null, data, null,null,'mensagens.zip'); 2614 else{ 2615 var filename = 'mensagens.zip'; 2616 if (data.match(/\.eml$/gi)) { 2617 filename = 'fonte_da_mensagem.eml'; 2618 } 2619 download_attachments(null, null, data, null,null,filename); 2620 } 2371 2621 } 2372 2622 … … 2379 2629 } 2380 2630 2381 function select_all_search_messages(select, id){ 2382 var search_box = Element("table_resultsearch_" + getNumBoxFromTabId(id)).firstChild; 2383 var felement = search_box.firstChild; 2384 while(felement) 2385 { 2386 if (select) { 2387 felement.firstChild.firstChild.checked = true; 2388 add_className(felement, 'selected_msg'); 2389 } 2390 else { 2391 felement.firstChild.firstChild.checked = false; 2392 remove_className(felement, 'selected_msg'); 2393 } 2394 felement = felement.nextSibling; 2395 } 2631 function select_all_search_messages(select, aba){ 2632 jQuery(function() { 2633 if(select){ 2634 jQuery("#"+aba+" tr").each(function(i, o) { 2635 2636 o.firstChild.firstChild.checked = true; 2637 add_className(o, 'selected_msg'); 2638 }); 2639 }else{ 2640 jQuery("#"+aba+" tr").each(function(i, o) { 2641 2642 o.firstChild.firstChild.checked = false; 2643 remove_className(o, 'selected_msg'); 2644 }); 2645 } 2646 }); 2647 2648 2649 2396 2650 } 2397 2651 … … 2426 2680 } 2427 2681 } 2682 function save_image2(info){ 2683 var obj = jQuery.parseJSON(unescape(info)); 2684 download_attachments(obj.folder, obj.message, obj.thumbIndex, obj.pid, obj.encoding, obj.type.replace("/",".")); 2685 } 2428 2686 2429 2687 function nospam(msgs_number, border_ID, folder){ 2430 2688 if (folder == 'null') 2431 2689 folder = get_current_folder(); 2432 var new_folder = 'INBOX'; 2690 var new_folder = ''; 2691 if(folder.substr(0,4) == 'user'){ 2692 arrayFolder = folder.split(cyrus_delimiter); 2693 new_folder = 'user'+cyrus_delimiter+arrayFolder[1]; 2694 } 2695 else{ 2696 new_folder = 'INBOX'; 2697 } 2433 2698 var new_folder_name = get_lang('INBOX'); 2434 2699 var handler_move_msgs = function(data){ … … 2449 2714 2450 2715 if (parseInt(msgs_number) > 0 || msgs_number.length > 0) 2451 cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=false"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+ preferences.delete_and_show_previous_message+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs);2716 cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=false"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+0+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs); 2452 2717 else 2453 2718 write_msg(get_lang('No selected message.')); … … 2457 2722 if (folder == 'null') 2458 2723 folder = get_current_folder(); 2459 var new_folder = 'INBOX'+cyrus_delimiter+'Spam'; 2724 var new_folder = ''; 2725 if(folder.substr(0,4) == 'user') 2726 { 2727 arrayFolder = folder.split(cyrus_delimiter); 2728 new_folder = 'user'+cyrus_delimiter+arrayFolder[1]+cyrus_delimiter+spamfolder; 2729 } 2730 else 2731 { 2732 new_folder = 'INBOX' + cyrus_delimiter + spamfolder; 2733 } 2460 2734 var new_folder_name = 'Spam'; 2735 var not_opem_previus = true; 2461 2736 var handler_move_msgs = function(data){ 2462 proxy_mensagens.proxy_move_messages(folder, msgs_number, border_ID, new_folder, new_folder_name); 2463 if (openTab.type[currentTab] > 1) 2737 proxy_mensagens.proxy_move_messages(folder, msgs_number, border_ID, new_folder, new_folder_name, not_opem_previus); 2738 if (openTab.type[currentTab] > 1){ 2739 if(preferences.delete_and_show_previous_message == 1) 2464 2740 delete_border(currentTab,'false'); 2741 } 2465 2742 } 2466 2743 … … 2471 2748 2472 2749 if(parseInt(msgs_number) > 0 || msgs_number.length > 0) 2473 cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=true"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+ preferences.delete_and_show_previous_message+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs);2750 cExecute ("$this.imap_functions.spam&folder="+folder+"&spam=true"+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+0+"&cyrus_delimiter="+cyrus_delimiter, handler_move_msgs); 2474 2751 else 2475 2752 write_msg(get_lang('No selected message.')); … … 2565 2842 if ( er.test(wfolders_tree._selected.id) ) 2566 2843 { 2567 archive_msgs('INBOX/Lixeira/tmpMoveToLocal',wfolders_tree._selected.id,data); 2568 cExecute('$this.imap_functions.delete_mailbox',function(){},'del_past=INBOX/Lixeira/tmpMoveToLocal'); 2844 alert( "Mensagens não podem ser importadas em pastas locais" ); 2845 //archive_msgs('INBOX/Lixeira/tmpMoveToLocal',wfolders_tree._selected.id,data); 2846 //cExecute('$this.imap_functions.delete_mailbox',function(){},'del_past=INBOX/Lixeira/tmpMoveToLocal'); 2569 2847 } 2570 2848 else{ … … 2614 2892 } 2615 2893 function import_calendar(data){ 2894 var import_url = '$this.db_functions.import_vcard&msg_folder='+data; 2895 2616 2896 function handler_import_calendar(data){ 2617 2897 if(data === true){ 2618 2898 write_msg(get_lang("The event was imported successfully.")); 2619 2899 } 2900 else if( data['url'] ) 2901 { 2902 var form = document.createElement( "form" ); 2903 2904 form.setAttribute( "action", DEFAULT_URL + data['url'] + '&isPost=true' ); 2905 form.setAttribute( "method", "POST" ); 2906 2907 document.body.appendChild( form ); 2908 2909 form.submit(); 2910 } 2911 else 2912 write_msg(get_lang(data)); 2620 2913 } 2621 2914 if(confirm(get_lang("Do you confirm this import to your Calendar?"))){ 2622 cExecute('$this.db_functions.import_vcard&msg_folder='+data,handler_import_calendar); 2623 } 2915 cExecute( import_url +'&from_ajax=true',handler_import_calendar); 2916 } 2917 } 2918 function open_msg_part(data){ 2919 var handler_open_msg_part = function (data) 2920 { 2921 if(data.append == 1) 2922 { 2923 proxy_mensagens.get_msg(data.msg_number,data.msg_folder,false,show_msg); 2924 partMsgs.push(data.msg_number); 2925 } 2926 else 2927 write_msg(data.append); 2928 } 2929 cExecute('$this.imap_functions.ope_msg_part&msg_folder='+data+'&save_folder=INBOX'+cyrus_delimiter+trashfolder , handler_open_msg_part); 2624 2930 } 2625 2931 function hack_sent_queue(data,rowid_message) { … … 2696 3002 var er_Email = new RegExp("<(.*?)>"); 2697 3003 // TODO Use validateEmail of common functions ! 2698 var er_ValidaEmail = new RegExp("^[_a-z 0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$");3004 var er_ValidaEmail = new RegExp("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,3})$"); 2699 3005 2700 3006 for (i=0; i < arrayEmailsFull.length; i++){ … … 2702 3008 tempEmail = email == null ? arrayEmailsFull[i]:email[1]; 2703 3009 tempEmail = tempEmail.replace(/^\s+|\s+$/g,""); 3010 2704 3011 if (tempEmail != '') { 2705 3012 singleEmail = er_ValidaEmail.exec(tempEmail); 2706 2707 3013 if (singleEmail == null) { 2708 3014 arrayInvalidEmails[0] = true; 2709 arrayInvalidEmails[1] += (email == null ? arrayEmailsFull[i] : email[1]) + " ;";3015 arrayInvalidEmails[1] += (email == null ? arrayEmailsFull[i] : email[1]) + ""; 2710 3016 } 2711 3017 } -
trunk/expressoMail1_2/js/messages_controller.js
r4826 r5134 13 13 var real_folder = folder.substr(6); 14 14 var msgs = expresso_local_messages.get_local_range_msgs(real_folder,msg_range_begin,preferences.max_email_per_page,sort_box_type,sort_box_reverse,search_box_type,preferences.preview_msg_subject,preferences.preview_msg_tip); 15 eval('call_back(msgs)'); 15 if(call_back) 16 call_back(msgs); 17 else{ 18 call_back = function(data) 19 { 20 alternate_border(0); 21 draw_box(data, get_current_folder()); 22 } 23 call_back(msgs); 24 } 16 25 draw_tree_local_folders(); 17 26 }else { … … 38 47 if (msgs_number == 'selected') 39 48 msgs_number = get_selected_messages(); 40 41 if (!this.is_local_folder(folder)) 49 if (!this.is_local_folder(folder)){ 42 50 delete_msgs(folder, msgs_number, border_ID); 43 else { 51 }else { 52 if((folder != 'local_Trash') && (expresso_local_messages.as_trash())){ 53 expresso_local_messages.move_messages('Trash', msgs_number); 54 this.aux_interface_remove_mails(msgs_number, 'local_Trash', border_ID); 55 draw_tree_local_folders(); 56 refresh(); 57 }else{ 44 58 expresso_local_messages.delete_msgs(msgs_number, border_ID); 45 59 draw_tree_local_folders(); 46 update_local_box(); 60 refresh(); 61 } 47 62 } 48 63 } … … 236 251 else 237 252 if ((!this.is_local_folder(folder)) && (!this.is_local_folder(new_folder))) { //Move entre pastas locais... 253 if(new_folder_name == 'Spam'){ 254 move_msgs_not_previus(folder, msgs_number, border_ID, new_folder, new_folder_name); 255 }else{ 238 256 move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name); 239 257 } 240 else if ((!this.is_local_folder(folder)) && (this.is_local_folder(new_folder))) {258 }else if ((!this.is_local_folder(folder)) && (this.is_local_folder(new_folder))) { 241 259 if(msgs_number=='selected') 242 260 archive_msgs(folder,new_folder); 243 261 else 244 262 archive_msgs(folder,new_folder,msgs_number); 263 264 245 265 draw_tree_local_folders(); 266 refresh(); 246 267 } 247 268 else { … … 290 311 291 312 messages_proxy.prototype.aux_interface_remove_mails = function(msgs_number,new_folder_name,border_ID,previous_msg) { 313 if(!msgs_number) 314 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 315 316 if(msgs_number === ""){ 317 write_msg(get_lang('No selected message.')); 318 return; 319 } 320 292 321 Element('chk_box_select_all_messages').checked = false; 293 322 mail_msg = Element("tbody_box"); 294 323 msgs_number = msgs_number.split(","); 295 324 var msg_to_delete; 325 this.previous = 0; 296 326 for (var i=0; i<msgs_number.length; i++){ 297 327 msg_to_delete = Element(msgs_number[i]); … … 299 329 if ( (msg_to_delete.style.backgroundColor != '') && (preferences.use_shortcuts == '1') ) 300 330 select_msg('null', 'down'); 331 332 if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete && currentTab.toString().indexOf("_r") > 0) 333 for(var ii=0; ii < mail_msg.rows.length; ii++){ 334 if(mail_msg.rows[ii] === msg_to_delete){ 335 if(ii == 0){ 336 break; 337 }else{ 338 this.previous = mail_msg.rows[(ii - 1)].attributes[0]; 339 this.previous = parseInt(this.previous.value); 340 break; 341 } 342 } 343 } 301 344 mail_msg.removeChild(msg_to_delete); 302 345 } … … 307 350 write_msg(get_lang("The messages were moved to folder ") + new_folder_name); 308 351 352 if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete && this.previous){ 353 proxy_mensagens.get_msg(this.previous, folder, true, show_msg); 354 }else if(currentTab != 0){ 309 355 if (border_ID != '' && border_ID != 'null'){ 310 356 delete_border(border_ID,'false'); 357 }else{ 358 delete_border(currentTab,'false'); 359 } 311 360 } 312 361 if(folder == get_current_folder()) 313 362 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - msgs_number.length; 314 refresh();315 316 363 } 317 364 -
trunk/expressoMail1_2/js/report_window.js
r4830 r5134 11 11 report_window.prototype.make_report_window = function(ID_msg){ 12 12 _this = this; 13 var title = get_lang(" Describe the problem to report to technical support(optional)");13 var title = get_lang("More information about the problem (optional)"); 14 14 15 15 tree = document.createElement("DIV"); … … 52 52 msg_confirmation.style.width = "240px"; 53 53 msg_confirmation.style.height = "350px"; 54 msg_confirm = get_lang("Attention! The original message will be sent along with the original source of the email message");54 msg_confirm = get_lang("Attention! The information contained in the e-mail will be sent to the support team"); 55 55 msg_confirmation.innerHTML = "<br><b><font color='BLACK' nowrap>"+msg_confirm+"</font></b>"; 56 56 tree.appendChild(msg_confirmation); -
trunk/expressoMail1_2/js/rich_text_editor.js
r5083 r5134 99 99 var textArea = document.createElement("TEXTAREA"); 100 100 textArea.id = pObj; 101 textArea.style.height = '500';102 101 textArea.style.width = '100%'; 103 102 parentDiv.appendChild(textArea); … … 367 366 if(selection !== undefined && selection !== null) var selectionRanges = selection.getRanges(); 368 367 369 editor.insertHtml('<div><br type="_moz"></div>'+data); 368 var fontSize = ''; 369 var fontFamily = ''; 370 370 371 if(selection !== null) selection.selectRanges(selectionRanges); 371 if(typeof(preferences.font_size_editor) !== 'undefined') 372 fontSize = 'font-size:' + preferences.font_size_editor; 373 374 if(fontSize != '') 375 fontFamily = ';' 376 377 if(typeof(preferences.font_family_editor) !== 'undefined') 378 fontFamily += 'font-family:' + preferences.font_family_editor + ';'; 379 380 var divBr = '<div style="'+fontSize+fontFamily+'"><br type="_moz"></div>'; 372 381 373 editor.execCommand("autogrow"); //Atualiza tamanho do editor 382 editor.insertHtml(divBr+divBr+divBr+data); 383 384 if(selection !== null) selection.selectRanges(selectionRanges); 374 385 375 386 //Caso não for uma resposta votla o foco para o input to … … 396 407 CKEDITOR.remove(CKEDITOR.instances[id]); 397 408 409 var height = document.body.scrollHeight; 410 height -= 425; 411 398 412 $('#'+id).ckeditor( 399 413 function() {RichTextEditor.execPosInstance(id)}, 400 414 { 401 toolbar:'mail' 415 toolbar:'mail', 416 height: height 402 417 }); 403 418 -
trunk/expressoMail1_2/js/search.js
r4993 r5134 16 16 this.txtfields = new Array("txt_ass","txt_de","txt_body","txt_para","txt_cc","txt_cco", "since_date", "before_date", "on_date"); 17 17 this.selectFields = new Array("flagged", "seen", "answered", "recent"); 18 this.localResults = 0;19 18 } 20 19 … … 227 226 228 227 // Gears - local 229 if ( preferences.use_local_messages == 1 && EsearchE.localResults != 0)228 if ( preferences.use_local_messages == 1 ) 230 229 { 231 230 temp = expresso_local_messages.list_local_folders(); … … 234 233 local_folders.push(temp[x][0]); 235 234 } 235 } 236 236 237 if ( local_folders.length > 0 ) 237 238 _gears = expresso_local_messages.search( local_folders, expresso_local_messages.getFilter() ); 238 _data['gears_num_msgs'] = _gears.length;239 }else{240 _data['gears_num_msgs'] = 0;241 }242 239 243 240 _data['data'] = data['data']; 244 241 _data['num_msgs'] = data['num_msgs']; 245 242 _data['gears_num_msgs'] = _gears.length; 246 243 247 244 delete_border( data['currentTab'], false); … … 263 260 264 261 if(size > parseInt(preferences.max_email_per_page)) { 265 this.totalPages = parseInt(size/preferences.max_email_per_page);262 this.totalPages = Math.ceil(size/preferences.max_email_per_page); 266 263 if((size/preferences.max_email_per_page) > this.totalPages) 267 264 this.totalPages++; … … 270 267 if(this.page != 0) { 271 268 _link = document.createElement("A"); 269 if( this.value ) 270 _link.href = 'javascript:EsearchE.quickSearchMail( false, '+0+', false, "'+currentTab+'" )'; 271 else{ 272 272 _link.href = 'javascript:EsearchE.page=0;'; 273 273 _link.href += 'cExecute("$this.imap_functions.search_msg",openpage,"condition='+this.condition+'&sort_type='+this.sort_type+'&page=0¤t_tab='+currentTab+'");'; 274 } 274 275 } 275 276 else { … … 319 320 var _link = document.createElement('A'); 320 321 _link.innerHTML = ( _page + 1 ) + " "; 322 if( this.value ) 323 _link.href = 'javascript: EsearchE.quickSearchMail( false, '+i+', false, "'+currentTab+'" )'; 324 else{ 321 325 _link.href = 'javascript:EsearchE.page='+i+';'; 322 326 _link.href += 'cExecute("$this.imap_functions.search_msg",openpage,"condition='+this.condition+'&sort_type='+this.sort_type+'&page='+_page+'¤t_tab='+currentTab+'");'; 327 } 323 328 } 324 329 _link.innerHTML = " ... "; … … 339 344 if(this.page != (this.totalPages - 1)) { 340 345 _link = document.createElement("A"); 346 if( this.value ) 347 _link.href = 'javascript: EsearchE.quickSearchMail( false, '+(this.totalPages-1)+', false, "'+currentTab+'" )'; 348 else{ 341 349 _link.href = 'javascript:EsearchE.page='+(this.totalPages-1)+';'; 342 350 _link.href += 'cExecute("$this.imap_functions.search_msg",openpage,"condition='+this.condition+'&sort_type='+this.sort_type+'&page='+(this.totalPages-1)+'¤t_tab='+currentTab+'");'; 351 } 343 352 } 344 353 else { … … 360 369 var sort_type = sortType; 361 370 371 if( this.value ) 372 return this.quickSearchMail( false, false, sortType, border_id ); 373 362 374 var is_local = border_id.match('.*_local_.*'); 363 375 … … 383 395 if ( local_folders.length > 0 ){ 384 396 expresso_local_messages.setSortType(sortType); 385 gears = expresso_local_messages.search( expresso_local_messages.getFolders(), expresso_local_messages.getFilter() );397 gears = expresso_local_messages.search( local_folders, expresso_local_messages.getFilter() ); 386 398 } 387 399 } … … 396 408 if (gears.length > 0) 397 409 { 398 this.localResults = gears.length;399 410 allMsg['data_gears'] = gears; 400 }else{401 this.localResults = 0;402 411 } 403 412 … … 434 443 435 444 if ( local_folders.length > 0 ) 436 gears = expresso_local_messages.search( expresso_local_messages.getFolders(), expresso_local_messages.getFilter() );445 gears = expresso_local_messages.search( local_folders, expresso_local_messages.getFilter() ); 437 446 438 447 data['data_gears'] = gears; … … 473 482 { 474 483 var td = document.createElement("TD"); 484 add_className(td, 'td_msg'); 475 485 if (j == 0) 476 486 { … … 480 490 chk_onclick = "changeBgColor(window.event,"+uid_msg+");"; 481 491 else 482 chk_onclick = "changeBgColor(event,"+uid_msg+");"; 483 var td1 = '<input type="checkbox" onclick="' + chk_onclick + '" id=" check_box_message_'+tr.id+'"></input>';492 chk_onclick = "changeBgColor(event,"+uid_msg+");"; //'search_' + numBox 493 var td1 = '<input type="checkbox" onclick="' + chk_onclick + '" id="' + border_id + '_check_box_message_'+uid_msg+'"></input>'; 484 494 485 495 } … … 510 520 { 511 521 td.setAttribute("width", colSizes[1][3]); 512 td.id = "td_message_important_"+ tr.id;522 td.id = "td_message_important_"+uid_msg; 513 523 if (aux.flag.match("F")) 514 524 { … … 551 561 if( j == 6 ) 552 562 { 553 if ( aux.from.length > 29)563 if ( aux.from !== null && aux.from.length > 29) 554 564 aux.from = aux.from.substr(0,29) + "..."; 555 565 … … 634 644 635 645 // Form resultado 636 searchE.prototype.mount_result = function( Data, sort_type, keep_border )646 searchE.prototype.mount_result = function( Data, sort_type, keep_border, keep_filled, division ) 637 647 { 638 648 var data = ( Data['data'] ) ? Data['data'] : Data['data_gears']; … … 648 658 sort_type = this.sort_type; 649 659 650 var tab = numBox;651 652 660 if ( keep_border ) { 653 661 var border_id = currentTab; 654 662 } 655 663 else { 656 tab = count_borders() + 1;664 numBox++; 657 665 658 666 if( Data['data'] ) 659 var border_id = create_border(get_lang("Server Results"), "search_" + tab);667 var border_id = create_border(get_lang("Server Results"), "search_" + numBox); 660 668 661 669 if( Data['data_gears']) 662 var border_id = create_border(get_lang("Local Results"), "search_local_msg" + tab);670 var border_id = create_border(get_lang("Local Results"), "search_local_msg" + numBox); 663 671 } 664 672 … … 667 675 668 676 currentTab = border_id; 669 openTab.content_id[currentTab] = Element('content_id_search_' + tab);677 openTab.content_id[currentTab] = Element('content_id_search_' + numBox); 670 678 openTab.type[currentTab] = 1; 671 679 openTab.condition[currentTab] = this.condition; … … 673 681 if ( keep_border ) { 674 682 var content_search = Element('content_id_' + border_id); 675 var div_scroll_result = Element("divScrollMain_"+tab); 683 var div_scroll_result = Element("divScrollMain_"+numBox); 684 676 685 content_search.removeChild(div_scroll_result); 686 687 if( !keep_filled ) 688 div_scroll_result = false; 677 689 } 678 690 679 691 var table = document.createElement("TABLE"); 680 table.id = "table_resultsearch_" + tab;692 table.id = "table_resultsearch_" + numBox; 681 693 table.frame = "void"; 682 694 table.rules = "rows"; … … 686 698 687 699 var tbody = document.createElement("TBODY"); 688 tbody.id = "tbody_box_" + tab;700 tbody.id = "tbody_box_" + numBox; 689 701 690 702 for( var i=0; i < data.length; i++) 691 703 { 704 if(data[i] !== null){ 692 705 var tr = EsearchE.make_tr_message(data[i],border_id,i); 693 694 706 tbody.appendChild(tr); 695 707 } 708 } 696 709 697 710 //global_search++; //Tabs from search must not have the same id on its tr's // use numBox instead of this! … … 700 713 701 714 var colgr_element = buildColGroup(1); 702 colgr_element.setAttribute("id","colgroup_main_"+ tab);715 colgr_element.setAttribute("id","colgroup_main_"+numBox); 703 716 table.appendChild(colgr_element); 704 717 705 718 var content_search = Element('content_id_' + border_id); 719 720 if( !div_scroll_result ) 721 { 706 722 var div_scroll_result = document.createElement("DIV"); 707 div_scroll_result.id = "divScrollMain_"+tab;723 div_scroll_result.id = "divScrollMain_"+numBox; 708 724 div_scroll_result.style.overflowY = "scroll"; 709 725 div_scroll_result.style.overflowX = "hidden"; … … 714 730 div_scroll_result.style.width ="100%"; 715 731 } 732 } 733 if( division ) 734 { 735 var _div = document.createElement("div"); 736 _div.className = 'local-messages-search-warning'; 737 _div.innerHTML = division; 738 div_scroll_result.appendChild(_div); 739 } 716 740 717 741 if(is_ie) … … 730 754 table_element.addEventListener("mousedown",startColResize,false); 731 755 } 732 table_element.setAttribute("id", "table_message_header_box_"+ tab);756 table_element.setAttribute("id", "table_message_header_box_"+numBox); 733 757 table_element.className = "table_message_header_box"; 734 758 if (!is_ie) … … 772 796 773 797 // Ordernar Pasta 774 if ( sort_type == 'SORTBOX' )798 if ( sort_type == 'SORTBOX' /*|| sort_type == 'SORTBOX_REVERSE'*/ ) 775 799 { 776 800 if( Data['data'] ) … … 801 825 td_element2 = createTDElement(1,6,"th_resizable","left"); 802 826 803 if (sort_type == 'SORTFROM' )827 if (sort_type == 'SORTFROM' || sort_type == 'SORTWHO' /*|| sort_type == 'SORTWHO_REVERSE' || sort_type == 'SORTFROM_REVERSE'*/ ) 804 828 { 805 829 if(Data['data']) … … 830 854 td_element3 = createTDElement(1,7,"th_resizable","left"); 831 855 832 if (sort_type == 'SORTSUBJECT' )856 if (sort_type == 'SORTSUBJECT' /*|| sort_type == 'SORTSUBJECT_REVERSE'*/) 833 857 { 834 858 if( Data['data']) … … 859 883 td_element4 = createTDElement(1,8,"th_resizable","center"); 860 884 861 if ( sort_type == 'SORTDATE' )885 if ( sort_type == 'SORTDATE' /*|| sort_type == 'SORTDATE_REVERSE'*/ ) 862 886 { 863 887 if( Data['data'] ) … … 888 912 td_element5 = createTDElement(1,9,"th_resizable","center"); 889 913 890 if ( sort_type == 'SORTSIZE' )914 if ( sort_type == 'SORTSIZE' /*|| sort_type == 'SORTSIZE_REVERSE'*/ ) 891 915 { 892 916 if( Data['data'] ) … … 928 952 929 953 var colgr_element = buildColGroup(1); 930 colgr_element.setAttribute("id","colgroup_head_"+ tab);954 colgr_element.setAttribute("id","colgroup_head_"+numBox); 931 955 table_element.appendChild(colgr_element); 932 956 933 if( parseInt( Data['gears_num_msgs'] ) > 0 && ! Data['data_gears'])957 if( parseInt( Data['gears_num_msgs'] ) > 0 && !keep_filled) 934 958 { 935 959 var _div_gears = document.createElement("div"); … … 941 965 } 942 966 943 var _divScroll = document.getElementById("divScrollHead_"+tab); 944 945 if(!_divScroll){ 967 var _divScroll = document.getElementById("divScrollHead_"+numBox); 968 969 if( _divScroll ){ 970 content_search.removeChild(_divScroll); 971 _divScroll = false; 972 } 973 946 974 _divScroll = document.createElement("DIV"); 947 _divScroll.id = "divScrollHead_"+tab;975 _divScroll.id = "divScrollHead_"+numBox; 948 976 _divScroll.style.overflowY = "hidden"; 949 977 _divScroll.style.overflowX = "hidden"; … … 955 983 _divScroll.appendChild(table_element); 956 984 content_search.appendChild(_divScroll); 957 } 985 958 986 /*end of "put header"*/ 959 987 if ( !expresso_offline ) … … 1067 1095 1068 1096 // Search; 1069 searchE.prototype.func_search = function(value)1097 searchE.prototype.func_search_complex = function() 1070 1098 { 1071 1099 var fields = "##"; … … 1111 1139 } 1112 1140 } 1113 1141 if ((trim(Element("since_date").value) != "") && (trim(Element("before_date").value) != "")){ 1142 if(!(validate_date_order(trim(Element("since_date").value), trim(Element("before_date").value)))){ 1143 alert(get_lang('Invalid date on field %1', get_lang('Before Date'))); 1144 return false; 1145 } 1146 } 1114 1147 if(trim(Element("on_date").value) != "") 1115 1148 { … … 1171 1204 } 1172 1205 } 1173 1174 if ( value )1175 {1176 fields = "##ALL " + "<=>" +url_encode(value) + "##";1177 }1178 1206 1179 1207 if(fields == "##") … … 1234 1262 { 1235 1263 var allMsg = [3]; 1264 var count = ( data['num_msgs'] ) ? data['num_msgs'] : "0"; 1236 1265 var tmp = []; 1237 1266 … … 1241 1270 tmp = expresso_local_messages.search( local_folders, fields ); 1242 1271 } 1243 var count = data['num_msgs'] ? data['num_msgs'] : tmp.length > 0 ? tmp.length : "0"; 1244 EsearchE.localResults = tmp.length; 1272 1245 1273 if( data['num_msgs'] ) 1246 1274 { … … 1254 1282 } 1255 1283 1256 if( data['num_msgs'] == 0 && tmp.length < 0)1284 if( ( data['num_msgs'] ) == 0 ) 1257 1285 { 1258 1286 alert( get_lang("None result was found.") ); … … 1260 1288 else 1261 1289 { 1262 if(tmp.length > 0 && !data['num_msgs'])1290 if( (tmp.length > 0) && (!data['num_msgs']) ) 1263 1291 { 1264 allMsg['data_gears'] = tmp;1292 EsearchE.viewLocalMessage(); 1265 1293 } 1266 1294 else 1295 { 1296 if(count > 0) 1297 EsearchE.func_clean(); 1267 1298 write_msg( count + " " + get_lang("results found") ); 1268 1299 EsearchE.mount_result( allMsg, 'SORTDATE' ); 1269 1300 } 1270 1301 } 1271 1302 } 1272 1303 … … 1280 1311 else 1281 1312 cExecute( args, handler, params); 1313 } 1314 1315 searchE.prototype.func_search = function(value, page, sort, border_id) 1316 { 1317 if( !value ) 1318 this.func_search_complex(); 1319 else 1320 this.quickSearchMail( value, page, sort, border_id ); 1321 } 1322 1323 searchE.prototype.quickSearchMail = function(value, page, sort, border_id) 1324 { 1325 var local_folders = new Array(); 1326 var temp; 1327 var not_found_corrent_folder = true; 1328 1329 // if( Element("check_all_msg").checked ) 1330 // { 1331 this.all_mailboxes(); 1332 var nm_box = new Array; 1333 for(var i=0; i < EsearchE.all_boxes.length; i++) 1334 { 1335 nm_box[i] = EsearchE.all_boxes[i]/* + fields*/; 1336 } 1337 if (preferences.use_local_messages == 1) 1338 { 1339 temp = expresso_local_messages.list_local_folders(); 1340 for (var x in temp) 1341 { 1342 local_folders.push(temp[x][0]); 1343 } 1344 } 1345 this.sort = sort || this.sort || "SORTDATE"; 1346 this.page = isNaN(page) ? ( value ? 0 : this.page ) : page; 1347 this.value = value || this.value || false; 1348 1349 if( !this.value ) 1350 return alert( "Busca sem caracteres." ); 1351 1352 var args = "$this.imap_functions.quickSearchMail"; 1353 var params = { page: this.page, sort: this.sort, search: this.value }; 1354 1355 var selection1 = [], selection2 = []; 1356 1357 for( var i = 0; i < nm_box.length; i++ ) 1358 if( nm_box[i] === current_folder ) 1359 continue; 1360 else if( /^user/.test(nm_box[i]) ) 1361 selection2[selection2.length] = nm_box[i]; 1362 else 1363 selection1[selection1.length] = nm_box[i]; 1364 1365 if( expresso_offline ) 1366 handler('none'); 1367 else 1368 { 1369 var url = [], labels = []; 1370 1371 params['folder'] = current_folder; 1372 url[0] = args + "&" + $.param( params ); 1373 labels[0] = "mensagem na sua pasta atual"; 1374 1375 if(selection1.length) 1376 { 1377 params['folder'] = selection1; 1378 url[1] = args + "&" + $.param( params ); 1379 labels[1] = "mensagens nas suas outras pastas"; 1380 } 1381 if(selection2.length) 1382 { 1383 params['folder'] = selection2; 1384 url[2] = args + "&" + $.param( params ); 1385 labels[2] = "mensagens nas suas pastas compartilhadas"; 1386 } 1387 var link = ' <a href="#" onclick="connector.cancelRequest(); clean_msg(); return false;">cancelar<a/>'; 1388 1389 write_msg( "pesquisando " + labels[0] + link, true ); 1390 1391 var keepFilled = false; 1392 1393 var handler = function( data ) 1394 { 1395 data = $.parseJSON( Base64.decode(data) ); 1282 1396 1397 var allMsg = { 1398 num_msgs: ( data['num_msgs'] || 0 ), 1399 data: ( data['data'] || data['msgs'] || data ) 1400 }; 1401 1402 // Gears - local 1403 if ( local_folders.length > 0 ){ 1404 expresso_local_messages.setSortType('SORTDATE'); 1405 var tmp = expresso_local_messages.search( local_folders, "##ALL <=>" + url_encode(value) + "##" ); 1406 1407 if( tmp.length > 0 ) 1408 if( !allMsg['num_msgs'] ){ 1409 clean_msg(); 1410 not_found_corrent_folder = false; 1411 if(tmp.length) 1412 allMsg['gears_num_msgs'] = tmp.length; 1413 }else 1414 allMsg['gears_num_msgs'] = tmp.length; 1283 1415 } 1284 // clean; 1416 1417 if( !allMsg['num_msgs'] && !url.length && not_found_corrent_folder){ 1418 clean_msg(); 1419 //alert( get_lang("None result was found.") ); 1420 return EsearchE.viewLocalMessage(); 1421 } 1422 1423 if( allMsg['num_msgs'] ) 1424 EsearchE.total = allMsg['num_msgs'] = Math.max( (EsearchE.total || 0), allMsg['num_msgs'] ); 1425 1426 EsearchE.mount_result( allMsg, EsearchE.sort, ( keepFilled || border_id === currentTab ), keepFilled, "Foram encontradas " + data['msgs'].length + " "+labels.shift()+"." ); 1427 1428 keepFilled = true; 1429 1430 write_msg( "pesquisando " + labels[0] + link, true ); 1431 1432 if( url.length ) 1433 cExecute( url.shift(), handler ); 1434 else 1435 clean_msg(); 1436 } 1437 1438 cExecute( url.shift(), handler ); 1439 } 1440 } 1441 1442 // clean; 1285 1443 searchE.prototype.func_clean = function() 1286 1444 { -
trunk/expressoMail1_2/js/sharemailbox.js
r4457 r5134 43 43 Element('em_input_saveAcl').checked = false; 44 44 Element('em_input_saveAcl').disabled = true; 45 Element('em_input_deleteAcl').disabled = true; 46 Element('em_input_writeAcl').disabled = true; 45 47 46 48 if (data[user].indexOf('lrs',0) >= 0) 47 49 { 48 50 Element('em_input_sendAcl').disabled = false; 51 Element('em_input_deleteAcl').disabled = false; 52 Element('em_input_writeAcl').disabled = false ; 49 53 Element('em_input_readAcl').checked = true; 50 54 } 51 55 else 56 { 52 57 Element('em_input_sendAcl').disabled = true; 53 58 59 } 54 60 if (data[user].indexOf('d',0) >= 0) 55 61 { 56 62 Element('em_input_deleteAcl').checked = true; 63 Element('em_input_deleteAcl').disabled = false; 57 64 } 58 65 if (data[user].indexOf('wi',0) >= 0) 59 66 { 60 67 Element('em_input_writeAcl').checked = true; 68 Element('em_input_writeAcl').disabled = false 61 69 } 62 70 … … 91 99 if (Element('em_input_readAcl').checked) { 92 100 Element('em_input_sendAcl').disabled = false; 101 Element('em_input_deleteAcl').disabled = false; 102 Element('em_input_writeAcl').disabled = false; 93 103 acl = 'lrs'; 94 104 } … … 96 106 Element('em_input_sendAcl').disabled = true; 97 107 Element('em_input_sendAcl').checked = false; 108 Element('em_input_deleteAcl').disabled = true; 109 Element('em_input_deleteAcl').checked = false; 110 Element('em_input_writeAcl').disabled = true; 111 Element('em_input_writeAcl').checked = false; 112 98 113 } 99 114 … … 174 189 "<td valign='bottom'><br>"+ 175 190 get_lang('Organization')+": " + 176 "<select id='em_combo_org' onchange='javascript:sharemailbox.get_available_users(this.value);'></select>"+191 "<select id='em_combo_org'></select>"+ 177 192 178 193 "<br><br>"+get_lang('Search user')+":<br>" + 179 '<input id="em_input_searchUser" size="35" autocomplete="off" onkeyup="javascript:sharemailbox.optionFinderTimeout(this )"><br>'+194 '<input id="em_input_searchUser" size="35" autocomplete="off" onkeyup="javascript:sharemailbox.optionFinderTimeout(this, event);"><br>'+ 180 195 181 196 '<font color="red"><span id="em_span_searching"> </span></font><br>'+ … … 291 306 Element('em_input_sendAcl').disabled = true; 292 307 Element('em_input_saveAcl').disabled = true; 308 Element('em_input_deleteAcl').disabled = true; 309 Element('em_input_writeAcl').disabled = true; 293 310 win.open(); 294 311 } … … 305 322 } 306 323 307 cShareMailbox.prototype.optionFinder = function(id) 308 { 309 var oWait = document.getElementById("em_span_searching"); 310 var oText = document.getElementById(id); 311 312 //Limpa todo o select 313 314 var select_available_users_tmp = document.getElementById('em_select_available_users') 315 for(var i = 0;i < select_available_users_tmp.options.length; i++) 316 select_available_users_tmp.options[i--] = null; 317 318 var RegExp_name = new RegExp("\\b"+oText.value, "i"); 319 320 //Inclui usuário começando com a pesquisa 321 if (typeof(select_available_users_clone) != "undefined"){ 322 for(i = 0; i < select_available_users_clone.length; i++){ 323 if (RegExp_name.test(select_available_users_clone[i].text)) 324 { 325 sel = select_available_users_tmp.options; 326 option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value); 327 sel[sel.length] = option; 328 } 329 } 330 } 331 oWait.innerHTML = ' '; 324 cShareMailbox.prototype.optionFinder = function(id) { 325 326 var sentence = Element(id).value; 327 328 var url = '$this.ldap_functions.get_available_users2&context=' + 329 Element('em_combo_org').value + 330 ( sentence ? '&sentence=' + sentence: '' ); 331 332 return userFinder( sentence, 'em_select_available_users', url, 'em_span_searching'); 332 333 } 333 334 -
trunk/expressoMail1_2/js/shortcut.js
r4787 r5134 23 23 } 24 24 25 var ele = opt.target 25 var ele = opt.target; 26 26 if(typeof opt.target == 'string') ele = document.getElementById(opt.target); 27 27 var ths = this; … … 266 266 shortcut.add("E",function(){exec_msg_action('forward');},{'disable_in_input':true}); 267 267 shortcut.add("R",function(){exec_msg_action('reply');},{'disable_in_input':true}); 268 shortcut.add("T",function(){ var msg_id = get_msg_id(); if(msg_id) new_message("reply_to_all_with_history",msg_id);},{'disable_in_input':true}); 268 269 shortcut.add("O",function(){show_head_option();},{'disable_in_input':true}); 269 270 shortcut.add("M",function(){show_address_full();},{'disable_in_input':true}); … … 362 363 else 363 364 { 364 shortcut.add(" down",function(){select_msg('null', 'down');},{'type':'keypress','disable_in_input':false});365 shortcut.add(" up",function(){select_msg('null', 'up');},{'type':'keypress','disable_in_input':false});365 shortcut.add("Up",function(){select_msg('null', 'up', true);},{'disable_in_input':false}); 366 shortcut.add("Down",function(){select_msg('null', 'down', true);},{'disable_in_input':false}); 366 367 367 368 shortcut.add("Shift+down",function(){ -
trunk/expressoMail1_2/preferences.php
r5075 r5134 40 40 else 41 41 $GLOBALS['phpgw']->template->set_var('checked_save_deleted_msg',''); 42 43 if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['default_fields_quick_search']) 44 $GLOBALS['phpgw']->template->set_var('checked_default_fields_quick_search','checked'); 45 else 46 $GLOBALS['phpgw']->template->set_var('checked_default_fields_quick_search',''); 42 47 43 48 if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['delete_trash_messages_after_n_days']) … … 129 134 $GLOBALS['phpgw']->template->set_var('text_signature',''); 130 135 131 if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature']){ 132 $GLOBALS['phpgw']->template->set_var('type_signature_option_'.$GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'].'_selected','selected'); 133 $GLOBALS['phpgw']->template->set_var('type_signature_td_'.($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'] == 'html' ? 'text' : 'html'),'display:none'); 134 } 135 else{ 136 $GLOBALS['phpgw']->template->set_var('type_signature_option_text_selected','selected'); 137 $GLOBALS['phpgw']->template->set_var('type_signature_td_html','display:none'); 138 } 139 136 137 if($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['catalog_search']) 138 { 139 140 } 141 142 140 143 // BEGIN FCKEDITOR 141 144 $oFCKeditor = new FCKeditor('html_signature') ; … … 263 266 264 267 268 if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['default_fields_quick_search']) 269 $GLOBALS['phpgw']->preferences->change('expressoMail', 'default_fields_quick_search', $_POST['default_fields_quick_search']); 270 else 271 $GLOBALS['phpgw']->preferences->add('expressoMail', 'default_fields_quick_search', $_POST['default_fields_quick_search']); 272 273 265 274 if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_shortcuts']) 266 275 $GLOBALS['phpgw']->preferences->change('expressoMail','use_shortcuts',$_POST['use_shortcuts']); … … 300 309 $GLOBALS['phpgw']->preferences->add('expressoMail','signature',$_POST['signature']); 301 310 302 if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['type_signature'])303 $GLOBALS['phpgw']->preferences->change('expressoMail','type_signature',$_POST['type_signature']);304 else305 $GLOBALS['phpgw']->preferences->add('expressoMail','type_signature',$_POST['type_signature']);306 307 311 if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['hide_folders']) 308 312 $GLOBALS['phpgw']->preferences->change('expressoMail','hide_folders',$_POST['check_menu']); … … 334 338 $GLOBALS['phpgw']->preferences->add('expressoMail','keep_archived_messages',$_POST['keep_archived_messages']); 335 339 340 if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['default_fields_quick_search']) 341 $GLOBALS['phpgw']->preferences->change('expressoMail','default_fields_quick_search',$_POST['default_fields_quick_search']); 342 else 343 $GLOBALS['phpgw']->preferences->add('expressoMail','default_fields_quick_search',$_POST['default_fields_quick_search']); 336 344 $GLOBALS['phpgw']->preferences->save_repository(); 337 345 … … 376 384 $GLOBALS['phpgw']->template->set_var('html_text',lang('Rich Text')); 377 385 $GLOBALS['phpgw']->template->set_var('lang_config_signature',lang('Signature Configuration')); 378 $GLOBALS['phpgw']->template->set_var('lang_type_signature',lang('Signature type'));379 386 $GLOBALS['phpgw']->template->set_var('big',lang('Big')); 380 387 //$GLOBALS['phpgw']->template->set_var('lang_use_signature_digital_cripto',lang('Possibilitar <b>assinar/criptografar</b> digitalmente a mensagem?')); … … 392 399 $GLOBALS['phpgw']->template->set_var('lang_personal_catalog', lang('Personal Catalog')); 393 400 $GLOBALS['phpgw']->template->set_var('lang_all_catalog', lang('All Catalogs')); 401 $GLOBALS['phpgw']->template->set_var('lang_default_fields_quick_search', lang('Show default fields in the quick search screen')); 394 402 395 403 $GLOBALS['phpgw']->template->set_var('url_offline','offline.php'); … … 427 435 $GLOBALS['phpgw']->template->set_var('checked_mainscreen_showmail','checked'); 428 436 $GLOBALS['phpgw']->template->set_var('checked_show_name_print_messages','checked'); 437 $GLOBALS['phpgw']->template->set_var('checked_default_fields_quick_search','checked'); 429 438 $save_in_folder_selected = "INBOX".$e_server['imapDelimiter'].$specialFolders["Sent"]; 430 439 } -
trunk/expressoMail1_2/setup/phpgw_en.lang
r4843 r5134 449 449 Send this mail as text plain expressoMail1_2 en Send this mail as text plain 450 450 The text format will be lost expressoMail1_2 en The text format will be lost 451 You cant manipulate messages from multiple folders on search expressoMail1_2 en You cant manipulate messages from multiple folders on search -
trunk/expressoMail1_2/setup/phpgw_es-es.lang
r4843 r5134 596 596 zip mails to import expressoMail1_2 es-es Archivo .zip o .eml: 597 597 Show TO: in place of FROM: only in Automatic SEND folder expressoMail1_2 es-es Cambiar remitente por destinatário en la columna QIUEM solamente en la carpeta Enviado 598 You cant manipulate messages from multiple folders on search expressoMail1_2 es-es Imposible manipular mensajes de varias carpetas a partir de una busqueda.599 598 View the user name in the header of the messages printed? expressoMail1_2 es-es Ver el nombre de usuario en el encabezado de los mensajes impresos? 600 599 Displays the user name in the header print email expressoMail1_2 es-es Muestra el nombre de usuario en el correo electrónico imprimir el encabezado -
trunk/expressoMail1_2/setup/phpgw_pt-br.lang
r5083 r5134 63 63 cannot create folder. try other folder name expressoMail1_2 pt-br Erro ao criar a pasta. Certifique-se de que não tentou criá-la com um nome que contém a palavra \"local_\" ou que possui algum caractere especial. 64 64 cannot rename folder. try other folder name expressoMail1_2 pt-br Impossível renomear pasta, tente outro nome. 65 Cannot import target event. Please check if the format is right. expressoMail1_2 pt-br ImpossÃvel importar o e-mail, Por favor cheque se o formato está correto. 65 66 Caracter "#" is not allowed! expressoMail1_2 pt-br Caracter "#" não é permitido! 66 67 CC expressoMail1_2 pt-br Com Cópia … … 102 103 Delete automatically the messages in trash folder in how many days expressoMail1_2 pt-br Apagar automaticamente as mensagens na pasta lixeira após quantos dias 103 104 Delete expressoMail1_2 pt-br Apagar 105 Default font editor expressoMail1_2 pt-br Fonte padrão do editor 106 Default font size editor expressoMail1_2 pt-br Tamanho de fonte padrão do editor 104 107 Delete folder expressoMail1_2 pt-br Excluir pasta 105 108 Delete trash messages after how many days? expressoMail1_2 pt-br Apagar mensagens após quantos dias na lixeira? … … 164 167 ERROR saving your message. expressoMail1_2 pt-br Ocorreu um ERRO ao salvar sua mensagem. 165 168 ERROR emptying your Spam folder. expressoMail1_2 pt-br Ocorreu um ERRO ao limpar sua pasta Spam. 166 Everytime you receive new messages you will be informed expressoMail1_2 pt-br Cada vez que você receber novas mensagens quevocê será informado169 Everytime you receive new messages you will be informed expressoMail1_2 pt-br Cada vez que você receber novas mensagens você será informado 167 170 Exclusion expressoMail1_2 pt-br Exclusão 168 171 Export expressoMail1_2 pt-br Exportar … … 252 255 Invalid signature expressoMail1_2 pt-br Erro indeterminado: Não foi possível validar a assinatura digital da mensagem. 253 256 italic expressoMail1_2 pt-br Italico 257 The %1 folder is not created. It is necessary to finish your request. expressoMail1_2 pt-br Sua pasta \"%1\" não está criada. É necessário criá-la para que funcione corretamente. 258 ERROR saving your message. expressoMail1_2 pt-br Ocorreu um ERRO ao salvar sua mensagem. 259 In the local file attachments, including images, will be disregarded. To forward / reply with the attachments, please first make the reopening of the message expressoMail1_2 pt-br No arquivamento local os anexos, incluindo imagens, serão desconsiderados. Para encaminhar/responder com os anexos, por favor, primeiro faça o desarquivamento da mensagem 254 260 It allow you to remove attachments from messages expressoMail1_2 pt-br Permite que você remova anexos de mensagens 255 261 It allow you to send emails with important flag, but you can receive unwanted messages with important flag expressoMail1_2 pt-br Ela permite que você envie e-mails com sinalização de importante, mas você pode receber mensagens indesejadas com sinalização de importante … … 293 299 Mark as expressoMail1_2 pt-br Marcar como 294 300 Mark as Spam expressoMail1_2 pt-br Marcar como Spam 301 Is Spam expressoMail1_2 pt-br Spam 295 302 Max size expressoMail1_2 pt-br Tamanho máximo 296 303 Medium expressoMail1_2 pt-br Médio … … 311 318 Message untouched and authentic expressoMail1_2 pt-br Mensagem íntegra e autêntica 312 319 Message untouched with signer different from sender expressoMail1_2 pt-br Mensagem Íntegra, com e-mail do signatário diferente do remetente 313 message without receiver expressoMail1_2 pt-br Você deve fornecer pelo menos um endereço de destinatário de email.320 Message without receiver expressoMail1_2 pt-br Você deve fornecer pelo menos um endereço de destinatário de email. 314 321 Message with read notification expressoMail1_2 pt-br Mensagem com confirmação de leitura. 315 322 minute ago expressoMail1_2 pt-br minuto atrás 316 323 minutes ago expressoMail1_2 pt-br minutos atrás 317 324 Monday expressoMail1_2 pt-br Segunda-feira 318 More actions expressoMail1_2 pt-br Mais ações325 More actions expressoMail1_2 pt-br Mais Ações 319 326 More expressoMail1_2 pt-br Mais 320 327 More options expressoMail1_2 pt-br Mais opções … … 537 544 To use local messages, install Google Gears expressoMail1_2 pt-br Para utilizar mensagens locais no expresso, instale o Google Gears 538 545 To use local messages you have to install google gears. Would you like to install it now? expressoMail1_2 pt-br Para utilizar o recurso de mensagens locais, é preciso instalar o Google Gears. Você gostaria de instala-lo agora mesmo? 546 To use local messages you have to install google gears. Would you like to be redirected to gears installation page? expressoMail1_2 pt-br Para utilizar o recurso de mensagens locais, é preciso instalar o Google Gears. Você gostaria de ser encaminhado para a página de instalação do mesmo? 539 547 Trash expressoMail1_2 pt-br Lixeira 540 548 Trash Folder name admin pt-br Nome da pasta lixeira 541 549 Tuesday expressoMail1_2 pt-br Terça-feira 542 550 Type the subject of the message for receiving a phone warning expressoMail1_2 pt-br Digite o assunto da mensagem que deseja ser alertado por telefone 543 Type without spaces, dots or special characters! expressoMail1_2 pt-br Digite sem espaços,pontos ou caracteres especiais!551 Type without spaces, dots or special characters! expressoMail1_2 pt-br Digite sem pontos ou caracteres especiais! 544 552 Unanswered/Unforwarded expressoMail1_2 pt-br Não Respondida/Encaminhada 545 553 Unarchive expressoMail1_2 pt-br Desarquivar … … 563 571 Users from your organization expressoMail1_2 pt-br Usuários da sua organização 564 572 Use shortcuts? expressoMail1_2 pt-br Usar teclas de atalho? 573 Use plain text editor with standard ? expressoMail1_2 pt-br Usar editor de texto simples como padrão ? 565 574 Validity of certificate: expressoMail1_2 pt-br Validade do certificado: 566 575 View HTML source expressoMail1_2 pt-br Ver código html … … 577 586 What is your timezone? expressoMail1_2 pt-br Qual o seu fuso-horário? 578 587 When delete message, send it automatically to trash folder expressoMail1_2 pt-br Ao excluir um mensagem, mover automaticamente esta mensagem para a pasta lixeira 579 When user send an email with image in body message, it changes the size expressoMail1_2 pt-br Quando o usuário envia um e-mail com a imagem no corpo da mensagem ,ela muda o tamanho588 When user send an email with image in body message, it changes the size expressoMail1_2 pt-br Quando o usuário envia um e-mail com a imagem no corpo da mensagem ela muda o tamanho 580 589 When you are away from computer it saves automatically the message you are writing expressoMail1_2 pt-br Quando você estiver longe do computador. Isto salva automaticamente a mensagem que está a escrever 581 Where should the quick search be performed by default? expressoMail1_2 pt-br Aonde a pesquisa rápida deve atuar por padrão?582 It is where the keyword should be searched when the user executes a quick search. expressoMail1_2 pt-br Aonde a busca deve ser realizada quando o usuário realizar uma pesquisa rápida.590 Where should the quick search be performed by default? expressoMail1_2 pt-br Onde a pesquisa rápida deve atuar por padrão? 591 It is where the keyword should be searched when the user executes a quick search. expressoMail1_2 pt-br Onde a busca deve ser realizada quando o usuário realizar uma pesquisa rápida. 583 592 Who expressoMail1_2 pt-br Quem 584 593 With all expressoMail1_2 pt-br com todas … … 617 626 Your message to %1 has not been saved or sent. To %2 will be necessary open it again. Discard your message? expressoMail1_2 pt-br Sua mensagem para %1 não foi salva ou enviada. Para %2 será preciso abrir novamente. Descartar sua mensagem? 618 627 Your message was rejected by antivirus. Perhaps your attachment has been infected. expressoMail1_2 pt-br Sua mensagem foi rejeitada pelo anti-virus. Seu anexo pode estar infectado. 628 Invalid recipients in the message expressoMail1_2 pt-br Destinatario(s) invalido(s) na mensagem 619 629 Your message was save as draft in folder %1. expressoMail1_2 pt-br Sua mensagem foi salva como rascunho na pasta %1. 620 630 Your message was sent and save. expressoMail1_2 pt-br Sua mensagem foi enviada e salva. … … 622 632 Your message was sent to queue expressoMail1_2 pt-br Sua mensagem foi enviada com sucesso para a fila 623 633 Your search argument must be longer than %1 characters. expressoMail1_2 pt-br Seus argumentos para a pesquisa precisam ter mais que %1 dígitos. 624 Your search argument must be longer than %1 characters. Use quotes to refine your search expressoMail1_2 pt-br Seus argumentos para a pesquisa precisam ter mais que %1 dígitos. Use aspas para refinar a sua pesquisa.625 634 Your session could not be verified. expressoMail1_2 pt-br Sua sessão expirou. Entre novamente no Expresso. 626 635 Your Spam folder was empty. expressoMail1_2 pt-br Sua pasta Spam foi limpa. … … 646 655 View extended information about users expressoMail1_2 pt-br Ver informações extendidas nas buscas por usuários? 647 656 Do you want to use SpellChecker in email editor? expressoMail1_2 pt-br Quer usar o corretor ortográfico no editor de emails? 648 It allow you to check the spelling of your emails expressoMail1_2 pt-br Possib lita a correção ortográfica de emails.657 It allow you to check the spelling of your emails expressoMail1_2 pt-br Possibilita a correção ortográfica de emails. 649 658 Increases th maximum size of show messages? expressoMail1_2 pt-br Você quer que se aumente o limite de tamanho de emails que são mostrados? 650 659 Increases the maximum size of show emails from 100kb to 1mb' expressoMail1_2 pt-br Essa opção aumenta o tamanho máximo dos emails mostrados de 100KB para 1MB. … … 656 665 Warning expressoMail1_2 pt-br Atenção 657 666 Discard expressoMail1_2 pt-br Descartar 658 Send messages with return recipient option by default expressoMail1_2 pt-br Sempre enviar mensagens com confirmação de leitura?659 With this option every new email will get the return recipient option marked expressoMail1_2 pt-br Com essa opção ativa todo novo e-mail terá marcada a opção de Confirmação de leitura padrão.660 You must manual y close one of your tabs before opening a new one expressoMail1_2 pt-br Você deve fechar uma de suas abas de edição manualmente para poder abrir outra.661 Auto close the first tab on reaching the maximum number of tabs? expressoMail1_2 pt-br Fechar autom áticamente a primeira aba ao atingir o número máximo de abas?667 Send messages with return recipient option by default expressoMail1_2 pt-br Sempre enviar mensagens com solicitação de confirmação de leitura? 668 With this option every new email will get the return recipient option marked expressoMail1_2 pt-br Com essa opção ativa todo novo e-mail terá marcada a opção de confirmação de leitura padrão 669 You must manually close one of your tabs before opening a new one expressoMail1_2 pt-br Você deve fechar uma de suas abas de edição manualmente para poder abrir outra 670 Auto close the first tab on reaching the maximum number of tabs? expressoMail1_2 pt-br Fechar automaticamente a primeira aba ao atingir o número máximo de abas? 662 671 gears firefox windows url expressoMail1_2 pt-br URL de instalação do Gears para o Firefox - windows 663 672 gears firefox linux url expressoMail1_2 pt-br URL de instalação do Gears para o Firefox - linux … … 670 679 Error exporting messages, try again latter expressoMail1_2 pt-br Não foi possível exportar as mensagens selecionadas. 671 680 Exporting selected messages, this can take some time. expressoMail1_2 pt-br Exportando mensagens, isso pode levar algum tempo. 672 You cant manipulate messages from multiple folders on search expressoMail1_2 pt-br Impossível manipular mensagens de múltiplas pastas a partir de uma busca.673 681 Report error expressoMail1_2 pt-br Reportar erro 674 Describe the problem to report to technical support (optional) expressoMail1_2 pt-br Descreva o problema para reportar para a equipe de suporte técnico (opcional) 675 Attention! The original message will be sent along with the original source of the email message expressoMail1_2 pt-br Atenção! A mensagem original será enviado junto com a fonte original da mensagem de e-mail682 More information about the problem (opcional) expressoMail1_2 pt-br Maiores informações sobre o problema (opcional) 683 Attention! The information contained in the e-mail will be sent to the support team expressoMail1_2 pt-br Atenção! As informações do contidas no e-mail serão enviadas para a equipe de suporte 676 684 allow hidden copy expressoMail1_2 pt-br Liberar todos os usuários a enviar email com cópia oculta 685 Email report error expressoMail1_2 pt-br Reportar erro de e-mail 677 686 Results expressoMail1_2 pt-br Resultados 678 687 Please, enter a parameter to search expressoMail1_2 pt-br Por favor, insira um parâmetro para a busca … … 685 694 Quick Search Contacts expressoMail1_2 pt-br Busca rápida de contatos 686 695 All Catalogs expressoMail1_2 pt-br Todos catálogos 687 Use plain text editor with standard ? expressoMail1_2 pt-br Usar editor de texto simples como padrão ? 696 of expressoMail1_2 pt-br de 697 ERROR saving your message. expressoMail1_2 pt-br Erro ao salvar mensagem. 698 Messages: add+ expressoMail1_2 pt-br Mensagens: adicionar+ 699 no folder found expressoMail1_2 pt-br nenhuma pasta encontrada 700 no folder selected expressoMail1_2 pt-br nenhuma pasta selecionada 701 select a message to preview expressoMail1_2 pt-br selecione uma mensagem para pre-visualizar 702 Select messages to attach... expressoMail1_2 pt-br Selecione mensagens para anexar... 703 My folders expressoMail1_2 pt-br Minhas pastas 704 Shared folders expressoMail1_2 pt-br Pastas compartilhadas 705 Local folders expressoMail1_2 pt-br Pastas locais 706 Attach expressoMail1_2 pt-br Anexar 707 Your message have %1 characters, the message needs to have less then 10000 characters expressoMail1_2 pt-br Sua mensagem tem %1 caracteres, a mensagem precisa ter menos de 10 mil caracteres 708 Wait a moment, your image is uploading ... expressoMail1_2 pt-br Espere um momento, sua imagem está sendo carregada ... 709 Reached maximum tab limit. Want to close this tab expressoMail1_2 pt-br Limite máximo de abas foi atingido. Deseja fechar esta aba? 710 It's not possible rename this folder. try other folder name expressoMail1_2 pt-br Erro ao renomear a pasta. Certifique-se de que não tentou renomea-la com um nome que contém a palavra \"local_\" ou que possui algum caractere especial. 711 SMTP Error: The following recipient addresses failed: %1 expressoMail1_2 pt-br Erro de SMTP: Os endereços de destinatário a seguir falharam: %1 712 The recipients addresses failed %1 expressoMail1_2 pt_br Os destinatarios são invalidos : %1 713 Message size greater than allowed(Default rule) expressoMail_2 pt_br Tamanho da mensagem maior do que o permitido(Regra Padrão) 714 (no subject) expressoMail1_2 pt_br (sem assunto) 715 Message file too big. expressoMail1_2 pt_br Tamanho da mensagem muito grande. 716 <strong>Tip:</strong> <span>For faster save, click over the image with <em>right button</em>.</span> expressoMail1_2 pt-br <strong>Dica:</strong> <span>Para salvar rapidamente, clique sobre a imagem com o <em>botão direito</em> do mouse.</span> 717 Shortcut: %1 expressoMail1_2 pt-br Atalho: %1 718 Open message expressoMail1_2 pt-br Abrir mensagem 719 Simple text mode expressoMail1_2 pt-br Modo texto simples 720 Please enter a parameter to search expressoMail1_2 pt-br Por favor, insira um parâmetro para a busca 721 this exhibits a sample of message within the message subject column preferences pt-br Exibe uma amostra da mensagem com o conteúdo da coluna Assunto 722 this exhibits a sample of message within a tool-tip box preferences pt-br Exibe uma amostra da mensagem em uma caixa tool-tip 723 This exhibits employeenumber and ou from LDAP in searchs preferences pt-br Exibe informações adicionais nas buscas do LDAP 724 what is the minimum number of characters in searching contacts preferences pt-br Qual é o número mínimo de caracteres ao pesquisar contatos 725 Increases the maximum size of show emails from 100kb to 1mb preferences pt-br Aumenta o tamanho máximo de emails mostrados de 100kb para 1mb 726 How to show nested messages preferences pt-br Como mostrar mensagens aninhadas 727 ERROR saving your message over quota. expressoMail1_2 pt-br Mensagem não salva pois excede a quota. 728 Display default fields on the quick search screen? preferences pt-br Mostrar campos padrão na tela de busca rápida de contatos? 688 729 -
trunk/expressoMail1_2/setup/setup.inc.php
r4306 r5134 12 12 $setup_info['expressoMail1_2']['name'] = 'expressoMail1_2'; 13 13 $setup_info['expressoMail1_2']['title'] = 'Expresso Mail'; 14 $setup_info['expressoMail1_2']['version'] = '2. 2.2';14 $setup_info['expressoMail1_2']['version'] = '2.4.0'; 15 15 $setup_info['expressoMail1_2']['app_order'] = 2; 16 16 $setup_info['expressoMail1_2']['tables'][] = 'phpgw_expressomail_contacts'; … … 37 37 $setup_info['expressoMail1_2']['depends'][] = array( 38 38 'appname' => 'phpgwapi', 39 'versions' => Array('2. 2')39 'versions' => Array('2.4.0') 40 40 ); 41 41 ?> -
trunk/expressoMail1_2/setup/tables_update.inc.php
r4306 r5134 111 111 return $setup_info['expressoMail1_2']['currentver']; 112 112 } 113 $test[] = '2.2.2'; 114 function expressoMail1_2_upgrade2_2_2() { 115 $setup_info['expressoMail1_2']['currentver'] = '2.2.4'; 116 return $setup_info['expressoMail1_2']['currentver']; 117 } 118 $test[] = '2.2.4'; 119 function expressoMail1_2_upgrade2_2_4() { 120 $setup_info['expressoMail1_2']['currentver'] = '2.4.0'; 121 return $setup_info['expressoMail1_2']['currentver']; 122 } 113 123 ?> -
trunk/expressoMail1_2/templates/default/config.tpl
r4832 r5134 103 103 <td>{lang_Max_attachment_size}</td> 104 104 <td> 105 <input size="1" name="newsettings[expressoMail_Max_attachment_size]" value="{value_expressoMail_Max_attachment_size}"> Mb<span style='position:relative; left:20px;'>Max: {php_upload_limit}Mb.</span> 105 <input size="2" name="newsettings[expressoMail_Max_attachment_size]" value="{value_expressoMail_Max_attachment_size}"> Mb<span style='position:relative; left:20px;'>Max: {php_upload_limit}Mb.</span> 106 <span style="color: red;margin-left: 30px"> *Valor 0 ou vazio = desativa a funcionalidade </span> 106 107 <input type="hidden" name="valida_alert" value="{lang_Value_exceeds_the_PHP_upload_limit_for_this_server}" /> 107 108 </td> … … 121 122 <input size="80" name="newsettings[expressoMail_googlegears_url]" value="{value_expressoMail_googlegears_url}"> 122 123 </td> 124 </tr> 125 <tr bgcolor="{row_off}"> 126 <td>{lang_gears_firefox_windows_url}</td> 127 <td> 128 <input size="60" name="newsettings[expressoMail_gears_firefox_windows]" value="{value_expressoMail_gears_firefox_windows}"> 129 </td> 130 </tr> 131 <tr bgcolor="{row_on}"> 132 <td>{lang_gears_firefox_linux_url}</td> 133 <td> 134 <input size="60" name="newsettings[expressoMail_gears_firefox_linux]" value="{value_expressoMail_gears_firefox_linux}"> 135 </td> 136 </tr> 137 <tr bgcolor="{row_off}"> 138 <td>{lang_gears_ie_url}</td> 139 <td> 140 <input size="60" name="newsettings[expressoMail_gears_ie]" value="{value_expressoMail_gears_ie}"> 141 </td> 123 142 </tr> 124 143 <tr bgcolor="{row_on}"> … … 157 176 </tr> 158 177 159 160 <tr bgcolor="{row_off}">161 <td>{lang_gears_firefox_windows_url}</td>162 <td>163 <input size="60" name="newsettings[expressoMail_gears_firefox_windows]" value="{value_expressoMail_gears_firefox_windows}">164 </td>165 </tr>166 <tr bgcolor="{row_on}">167 <td>{lang_gears_firefox_linux_url}</td>168 <td>169 <input size="60" name="newsettings[expressoMail_gears_firefox_linux]" value="{value_expressoMail_gears_firefox_linux}">170 </td>171 </tr>172 <tr bgcolor="{row_off}">173 <td>{lang_gears_ie_url}</td>174 <td>175 <input size="60" name="newsettings[expressoMail_gears_ie]" value="{value_expressoMail_gears_ie}">176 </td>177 </tr>178 178 <!-- END body --> 179 179 <!-- BEGIN footer --> -
trunk/expressoMail1_2/templates/default/expressomail.css
r4492 r5134 7 7 8 8 /* thumbs list on message screen */ 9 .expressomail-thumbs { font-size:11px; width:100%; ma rgin:20px 0 0 0; border-top:1px solid #AAA;}9 .expressomail-thumbs { font-size:11px; width:100%; max-width:100%; margin:20px 0 0 0; border-top:1px solid #AAA; float: left} 10 10 .expressomail-thumbs-label {} 11 11 .message_options {} 12 12 .expressomail-thumbs span.message_tips { display:block; padding-left:18px; line-height:18px;height:18px; background-image: url(images/menu/ktip.png); background-repeat:no-repeat;} 13 13 ul.expressomail-thumbs-list { list-style:none; margin:0; padding:0;} 14 ul.expressomail-thumbs-list li {height:80px; max-width:120x; max-height:80px; display:block; float:left; margin: 5px; padding:0;}15 ul.expressomail-thumbs-list li img {width: 100%; height:100%; border: 2px solid #FDE7BC;}14 ul.expressomail-thumbs-list li {height:80px; max-width:120px; max-height:80px; display:block; float:left; margin: 5px; padding:0;} 15 ul.expressomail-thumbs-list li img {width:auto; height:100%; border: 2px solid #FDE7BC;} 16 16 .expressomail-thumbs-link { font-size:11px;} 17 .jcarousel-container { width: auto;} 18 19 20 17 21 18 22 /* todo o resto */ 19 23 table.expressomail-message-body {width:100%; height:100%;} 20 table.table_message {background-image: url(../../../phpgwapi/templates/default/images/fundo_msg.png); background-repeat:repeat-x;} 21 .table_message{ 22 cursor: default; 23 border-width: 1px; 24 border-spacing: 0px 0px; 25 border-style: outset; 24 table.table_message { 25 background: #96b3d3; /* Old browsers */ 26 background: -moz-linear-gradient(top, #96b3d3 0%, #b4c9e4 30%, #d9e6ef 65%, #e2e9f1 70%, #e9f0f8 78%, #e8f1fa 83%, #dbe5ef 96%, #d9e3ed 100%); /* FF3.6+ */ 27 background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#96b3d3), color-stop(30%,#b4c9e4), color-stop(65%,#d9e6ef), color-stop(70%,#e2e9f1), color-stop(78%,#e9f0f8), color-stop(83%,#e8f1fa), color-stop(96%,#dbe5ef), color-stop(100%,#d9e3ed)); /* Chrome,Safari4+ */ 28 background: -webkit-linear-gradient(top, #96b3d3 0%,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%); /* Chrome10+,Safari5.1+ */ 29 background: -o-linear-gradient(top, #96b3d3 0%,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%); /* Opera 11.10+ */ 30 background: -ms-linear-gradient(top, #96b3d3 0%,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%); /* IE10+ */ 31 background: linear-gradient(top, #96b3d3 0%,#b4c9e4 30%,#d9e6ef 65%,#e2e9f1 70%,#e9f0f8 78%,#e8f1fa 83%,#dbe5ef 96%,#d9e3ed 100%); /* W3C */ 32 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#96b3d3', endColorstr='#d9e3ed',GradientType=0 ); /* IE6-9 */ 33 } 34 table.expressomail-message-body tr{vertical-align:top;} 35 36 37 38 39 .table_message_options{ 40 background-color: #000; 41 42 /* Apenas para ie qualquer versao */ 43 -moz-border-collapse: separate; 26 44 border-color: gray; 27 border-collapse: separate; 28 border-radius: 3px; 45 46 border-spacing: 0; 47 border-style: outset; 48 border-width: 0.01; 49 cursor: default; 50 padding: 1px; 29 51 -moz-border-radius: 3px; 30 52 -webkit-border-radius: 3px; 53 54 55 } 56 57 .table_message_options_ie{ 58 59 border-collapse: collapse; 60 background-color: #000; 61 border-color: gray; 62 border-spacing: 0; 63 border-style: outset; 64 border-width: 1; 65 cursor: default; 66 padding: 1px; 67 -moz-border-radius: 3px; 68 -webkit-border-radius: 3px; 69 70 71 } 72 73 .table_message{ 74 background-color: #000; 75 76 /* Apenas para ie qualquer versao */ 77 -moz-border-collapse: separate; 78 border-color: gray; 79 border-radius: 3px 3px 3px 3px; 80 border-spacing: 0; 81 border-style: outset; 82 border-width: 1px; 83 cursor: default; 84 padding: 1px; 85 -moz-border-radius: 3px; 86 -webkit-border-radius: 3px; 87 88 31 89 } 32 90 33 91 .div_message_scroll { background: none repeat scroll 0% 0% WHITE; overflow: auto; padding-right: 5px;} 92 a.message-attach-link { margin-left: 20px;} 93 94 .messagescol td label {padding-right:20px;} 95 .messagescol td.message-general-options .checkbox {margin: 5px 5px 0 0;} 96 97 .ui-dialog-dragging { 98 opacity:0.4; 99 filter:alpha(opacity=40); /* For IE8 and earlier */ 100 } -
trunk/expressoMail1_2/templates/default/index.tpl
r5083 r5134 22 22 <td> 23 23 <div id="search_div" align="center" style="white-space:nowrap"></div> 24 <input type="text" id="em_message_search" size="1 6" maxlength="22" onfocus="javascript:onFocusQuickSearchEmail(this); return false;"/>24 <input type="text" id="em_message_search" size="18" /> 25 25 <a style="padding:1 8px; width:16px; height:16px; background: url(templates/default/images/search.gif) no-repeat center; margin: 0 3px;" class="" onMouseOut="window.status='';return true;" title='{lang_Open_Search_Window}' onMouseOver="window.status='{lang_Open_Search_Window}';return true;" href="javascript:void(0);" onClick="javascript:search_emails(Element('em_message_search').value)"></a> 26 26 27 <a style="padding:1 8px; width:16px; height:16px; background: url(templates/default/images/users.gif) no-repeat center;" class="" onMouseOut="window.status='';return true;" title='{lang_search_user}' onMouseOver="window.status='{lang_search_user}' ;return true;" href="javascript:void(0);" onClick="javascript:emQuickSearch(Element('em_message_search').value, 'null', 'null')"></a> 27 28 </td> … … 131 132 </table> 132 133 </div> 133 <link href="../library/jquery/css/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css"> 134 <script type="text/javascript" src="../library/jquery/jquery-ui.min.js"></script> 135 <link href="templates/default/quick_search.css" rel="stylesheet" type="text/css"> 136 <div style="display:none; width: auto; min-height: 0px; height: 410px;" id="dialog-modal" title="{lang_quick_search_users_dialog_title}"> 137 <div style="width:910px;height:410px;"> 138 <div class="acc-list" style="width:370px;height:85%;float:left;border:1px solid #DDD;background-color:#EEE;border-radius:3px;margin-left:1px;"> 139 <h3 id="title_usuarios"></h3> 140 <ul id="selectable" style="width:370px; height:350px;"></ul> 141 <div class="demo" style="width:100%;margin-top:-5px;"> 142 <div id="slider"></div> 143 <p> 144 <label for="amount">{lang_page}: </label> 145 <input type="text" id="amount" style="border:0; font-weight:bold; width:85%" /> 146 </p> 147 </div> 148 </div> 149 <div style="width:525px;height:90%;float:left;"> 134 <link href="../library/jquery/css/redmond/jquery-ui.css" rel="stylesheet" type="text/css"> 135 <script type="text/javascript" src="../library/jquery/jquery-ui.min.js"></script> 136 137 <script type="text/javascript" src="js/QuickCatalogSearch.js"></script> 138 <link href="templates/default/quick_search.css" rel="stylesheet" type="text/css"> 139 <div style="display:none; width: auto; min-height: 0px; height: 410px; overflow: hidden" id="dialog-modal" class="dialog-modal expressomail-qs-container" title="{lang_quick_search_users_dialog_title}"> 150 140 <div id="accordion"> 151 141 <div class="ui-widget" align="right"> 152 <label>{lang_search}: </label> 153 <input type="text" id="busca" size=30></input> 142 <fieldset class="search-field ui-corner-all" style> 143 <span class="ui-icon ui-icon-search"></span> 144 <input class="search" id="busca" onFocus="setFocus();" onBlur="removeFocus();" onkeypress="javascript: if(checkEnter(event)) {buscaContato(this.value); }" type="text" /> 145 </fieldset> 146 <fieldset class="search-catalog-options ui-corner-all"> 154 147 <select id="combobox"> 155 148 <!-- Pegar essas opções das preferências --> … … 158 151 <option value="all">{lang_all_catalogs}</option> 159 152 </select> 160 <input type="button" value="Buscar" onClick=buscaContato(busca.value); />161 <input type="button" value="?" onClick="alert('Busca rápida de contatos versão 0.1\nPrognus Software Livre')" />162 </div>163 <fieldset id="fieldset1" style="width:490px;height:85%;float:right;">164 <legend>{lang_contact_details}</legend>165 <div style="float:left;"> <span id="detalhes_contato">---</span> </div>166 153 </fieldset> 154 <input class="button" type="button" value="Buscar" onClick="buscaContato(busca.value);"/> 155 <input class="button" type="button" value="?" onClick="show_help()" /> 167 156 </div> 168 157 </div> 158 <fieldset id="fieldset1" class="details-container ui-corner-all"> 159 <legend>{lang_contact_details}</legend> 160 <div style="overflow: auto; height: 230px;" id="detalhes_contato"></div> 161 </fieldset> 162 <div class="acc-list"> <ul id="selectable"></ul></div> 163 <div class="demo" style="float: left; margin-top: 10px; width: 100%; height: 20px; padding:5px 0 0 0;"> 164 <div id="slider" style="width: 448px;"></div> 165 <p style="margin-top: -15px; margin-bottom: 0pt; margin-left: 453px; float: left;"> 166 <label for="amount">{lang_page}: </label> 167 <input type="text" id="amount-text" style="border:0; font-weight:bold;" readonly="true" /> 168 </p> 169 169 </div> 170 </div> 171 <div style="display:none; width: auto; min-height: 0px; height: 380px;" id="dialog-modal_help" title="{lang_dialog_help} Help busca rápida de contatos"> 172 <fieldset id="fieldset2"> 173 <legend>{lang_help} Busca rápida de contatos</legend> 174 <div> 175 <strong>Para a utilização dessa funcionalidade, podem ser usados os seguintes atalhos:</strong><br><br><br> 176 <ul> 177 <li>Ir para a página anterior - Seta para esquerda</li> 178 <li>Mover para contato acima - Seta para cima</li> 179 <li>Mover para contato abaixo - Seta para baixo</li> 180 <li>Mover para a próxima página - Seta para direita</li> 181 <li>Adicionar contato selecionado - Enter</li> 182 <li>Fechar - Esc</li> 183 </ul> 170 184 </div> 185 </fieldset> 186 </div> 171 187 <!-- END list --> -
trunk/expressoMail1_2/templates/default/main.css
r4815 r5134 8 8 word-wrap: break-word !important; /* Internet Explorer 5.5+ */ 9 9 font-family: monospace !important; 10 /*font-size: 10pt !important;*/ 10 11 font-size: 11px !important; 11 12 } 12 13 * { 13 /** { 14 14 font-family: Verdana, Arial, Helvetica, sans-serif; 15 } 15 }*/ 16 16 17 17 .checkbox{ … … 33 33 background: #ffffff; 34 34 border-bottom: 1px solid #f4f8fb; 35 font-family: Arial;35 font-family: Verdana, Arial, Helvetica, sans-serif;; 36 36 font-size: 13px; 37 37 cursor: pointer; … … 151 151 border-collapse: collapse; 152 152 border-color: #bbbbbb; 153 font-family: Arial;153 font-family: Verdana,Arial,Helvetica,sans-serif; 154 154 font-size: 13px; 155 155 cursor: pointer; … … 188 188 -moz-border-radius: 9px 9px 0px 0px; 189 189 -moz-user-select: none; 190 -webkit-border-radius: 9px 9px 0px 0px; 191 border-radius: 9px 9px 0px 0px; 190 192 cursor: pointer; 191 193 } … … 202 204 -moz-border-radius: 9px 9px 0px 0px; 203 205 -moz-user-select: none; 206 -webkit-border-radius: 9px 9px 0px 0px; 207 border-radius: 9px 9px 0px 0px; 204 208 cursor: pointer; 205 209 } … … 223 227 .tr_message_header{ 224 228 background-color: #EEEEEE; 229 font-family: Verdana, Arial, Helvetica, sans-serif; 225 230 cursor: default; 226 231 border-style: none none none none; … … 552 557 /* hack para o chrome */ 553 558 @media screen and (-webkit-min-device-pixel-ratio:0){ 554 input[type="file"] 555 { 556 width:500px; 559 input[type="file"]{ 560 background-color: #FFF; 561 border: 1px solid #e4e4e4; 562 height: 20px; 563 width: 350px; 564 vertical-align: middle; 557 565 } 558 566 } -
trunk/expressoMail1_2/templates/default/preferences.tpl
r1121 r5134 215 215 </td> 216 216 </tr> 217 218 <tr bgcolor="{tr_color1}"> 219 <td>{lang_catalog_search}</td> 220 <td align="center"> 221 <select name="catalog_search"> 222 <option {global_selected} value="1">{lang_global_catalog}</option> 223 <option {personal_selected} value="2">{lang_personal_catalog}</option> 224 <option {all_selected} value="3">{lang_all_catalog}</option> 225 </select> 226 </td> 227 </tr> 228 <tr bgcolor="{tr_color2}"> 229 <td> 230 {lang_default_fields_quick_search} 231 </td> 232 <td align="center"> 233 <input type="checkbox" name="use_signature" value=1 {checked_default_fields_quick_search}> 234 </td> 235 </tr> 236 217 237 <tr bgcolor="{th_bg}"> 218 238 <td colspan="2" > -
trunk/expressoMail1_2/templates/default/quick_search.css
r5075 r5134 1 1 /* Estilos da tela de busca rápida de contatos */ 2 2 3 body { font-size:11px;} 4 fieldset, div {margin:0;} 5 .ui-autocomplete-input { height:22px; width:200px; margin-right:-1px; } 6 #wrap-progressbar { height:22px; width:122px; float:left; } 7 #wrap-progressbar #inner-progressbar { text-align:center; width:100px; } 8 #wrap-progressbar #inner-progressbar span { font-size:10px; line-height:12px; } 9 #wrap-progressbar #inner-progressbar #progressbar { width:100px; height:10px; } 10 .clear {clear:both;} 11 #fieldset1 label {width:495px;display:inline-block; border:4px solid #72A9D3;} 12 fieldset { border:1px solid #AAA; border-radius:5px; margin:5px; } 13 ul {list-style:none; margin:0; padding:0;} 14 15 #list-acc-users li, #search-result-users li {margin-right:5px;border-radius:3px;} 16 #list-acc-mails li {margin-right:5px;padding-bottom:4px;border-radius:3px;} 17 #list-acc-users li:hover, #list-acc-mails li:hover, #search-result-users li:hover {background-color:#DDD;} 18 #list-acc-users li span.ui-icon, #list-acc-mails li span.ui-icon, #search-result-users li span.ui-icon {display:none; margin:2px;} 19 #list-acc-users li input, #list-acc-mails li input, #search-result-users li input {margin-top:5px;} 20 #list-acc-users li label, #list-acc-mails li label, #search-result-users li label {margin-top:-5px;} 21 #list-acc-users li:hover span, #list-acc-mails li:hover span, #search-result-users li:hover span {display:inline;} 22 #search-result-users li span.ui-icon {display:none;} 23 .ui-icon {float:right;} 24 #icon-bar1 .ui-icon {float:left; margin:0 3px;} 25 #icon-bar1 span {float:left; margin:2px 3px 0 0;} 26 .ui-icon-trash, .ui-icon-edit, .ui-icon-close, .ui-icon-plus, .ui-icon-pencil {background-color:#EEE;} 27 .ui-icon-trash:hover, .ui-icon-edit:hover, .ui-icon-close:hover, .ui-icon-plus:hover, .ui-icon-pencil:hover {background-color:#BBB;} 28 .ui-autocomplete-input {width:170px;} 29 .ui-accordion .ui-accordion-content{padding:5px;} 3 .expressomail-qs-container { font-size:11px;} 4 .expressomail-qs-container legend { font-size:1.1em; font-weight: bold; } 5 .expressomail-qs-container #accordion { margin: 5px;} 6 .expressomail-qs-container fieldset, .expressomail-qs-container div {margin:0;} 7 .expressomail-qs-container .ui-autocomplete-input { height:22px; width:200px; margin-right:-1px; } 8 .expressomail-qs-container #wrap-progressbar { height:22px; width:122px; float:left; } 9 .expressomail-qs-container #wrap-progressbar #inner-progressbar { text-align:center; width:100px; } 10 .expressomail-qs-container #wrap-progressbar #inner-progressbar span { font-size:10px; line-height:12px; } 11 .expressomail-qs-container #wrap-progressbar #inner-progressbar #progressbar { width:100px; height:10px; } 12 .expressomail-qs-container .clear {clear:both;} 13 /*.expressomail-qs-container #fieldset1 label {width:495px;display:inline-block; border:4px solid #72A9D3;}*/ 14 .expressomail-qs-container fieldset { border:1px solid #AAA; border-radius:5px; margin:5px; } 15 .expressomail-qs-container #ul {list-style:none; margin:0; padding:0;} 16 .expressomail-qs-container #fieldset1 {color:#444;} 17 .expressomail-qs-container #fieldset1 label {font-weight:bold; display:block;} 30 18 31 .foot-note {width:905px; padding:5px;margin-top:20px;border-top:1px solid #ddd;} 32 .acc-list {font-family: "Trebuchet MS", Tahoma, Verdana, Arial, sans-serif; font-size:11px; color:#555; } 33 .acc-list h3{font-family: "Trebuchet MS", Tahoma, Verdana, Arial, sans-serif; font-size:11px; color:#555; margin:0; padding:5px 3px; background-color:#fff;} 34 .acc-list ul{ margin:5px 0;} 35 .acc-list ul li{ border-radius:3px; padding:10px;} 36 .acc-list ul li:hover {background-color:#DDD;} 37 .acc-list ul li.active {background-color:#EB8F00;} 38 .acc-list ul li strong {display:block;} 39 .acc-list ul li em {display:block;} 19 .expressomail-qs-container #list-acc-users li, .expressomail-qs-container #search-result-users li {margin-right:5px;border-radius:3px;} 20 .expressomail-qs-container #list-acc-mails li {margin-right:5px;padding-bottom:4px;border-radius:3px;} 21 .expressomail-qs-container #list-acc-users li:hover, .expressomail-qs-container #list-acc-mails li:hover, .expressomail-qs-container #search-result-users li:hover {background-color:#DDD;} 22 .expressomail-qs-container #list-acc-users li span.ui-icon, .expressomail-qs-container #list-acc-mails li span.ui-icon, .expressomail-qs-container #search-result-users li span.ui-icon {display:none; margin:2px;} 23 .expressomail-qs-container #list-acc-users li input, .expressomail-qs-container #list-acc-mails li input, .expressomail-qs-container #search-result-users li input {margin-top:5px;} 24 .expressomail-qs-container #list-acc-users li label, .expressomail-qs-container #list-acc-mails li label, .expressomail-qs-container #search-result-users li label {margin-top:-5px;} 25 .expressomail-qs-container #list-acc-users li:hover span, .expressomail-qs-container #list-acc-mails li:hover span, .expressomail-qs-container #search-result-users li:hover span {display:inline;} 26 .expressomail-qs-container #search-result-users li span.ui-icon {display:none;} 27 .expressomail-qs-container .ui-icon {float:right;} 28 .expressomail-qs-container #icon-bar1 .ui-icon {float:left; margin:0 3px;} 29 .expressomail-qs-container #icon-bar1 span {float:left; margin:2px 3px 0 0;} 30 .expressomail-qs-container .ui-icon-trash, .expressomail-qs-container .ui-icon-edit, .expressomail-qs-container .ui-icon-close, .expressomail-qs-container .ui-icon-plus, .expressomail-qs-container .ui-icon-pencil {background-color:#EEE;} 31 .expressomail-qs-container .ui-icon-trash:hover, .expressomail-qs-container .ui-icon-edit:hover, .expressomail-qs-container .ui-icon-close:hover, .expressomail-qs-container .ui-icon-plus:hover, .expressomail-qs-container .ui-icon-pencil:hover {background-color:#BBB;} 32 .expressomail-qs-container .ui-autocomplete-input {width:170px;} 33 .expressomail-qs-container .ui-accordion .ui-accordion-content{padding:5px;} 40 34 41 /*Específico do selectable*/ 42 #feedback { font-size: 1.4em; } 43 #selectable .ui-selecting { background: #DDECF7; } 44 /* #selectable .ui-selected { background: #F39814; color: white; } Aqui eu troquei a cor de quando era selecionada a linha */ 45 #selectable .ui-selected { background: #72A9D3; color: white; } 46 47 #selectable { list-style-type: none; margin: 0; padding: 0; width: 100%; } 48 ul#selectable { overflow: hidden; width: 370px;} 49 ul#selectable li { width: 300px; overflow:hidden; } 50 ul#selectable li.ui-selected { width: 81%; } 51 ul#selectable li div { width: 6000px; } 52 .ui-button-icon-only { width: 1.2em; } 53 .ui-icon { margin-left: -8px; } 54 .ui-widget button { border: 0 solid; } 55 56 #dialog-modal { height: 416px; } 35 .expressomail-qs-container .foot-note {width:905px; padding:5px;margin-top:20px;border-top:1px solid #ddd;} 36 .expressomail-qs-container .acc-list {font-family: "Trebuchet MS", Tahoma, Verdana, Arial, sans-serif; font-size:11px; color:#555; } 37 .expressomail-qs-container .acc-list h3{font-family: "Trebuchet MS", Tahoma, Verdana, Arial, sans-serif; font-size:11px; color:#555; margin:0; padding:5px 3px; background-color:#fff;} 38 .expressomail-qs-container .acc-list ul{ margin:5px 0;} 39 .expressomail-qs-container .acc-list ul li{ border-radius:3px; padding:5px;} 40 .expressomail-qs-container .acc-list ul li:hover {background-color:#DDD;} 41 .expressomail-qs-container .acc-list ul li.active {background-color:#EB8F00;} 42 .expressomail-qs-container .acc-list ul li strong {display:block;} 43 .expressomail-qs-container .acc-list ul li em {display:block;} 44 45 /*Específico do selectable*/ 46 .expressomail-qs-container #feedback { font-size: 1.4em; } 47 .expressomail-qs-container #selectable .ui-selecting { background: #DDECF7; } 48 /* #selectable .ui-selected { background: #F39814; color: white; } Aqui eu troquei a cor de quando era selecionada a linha */ 49 .expressomail-qs-container #selectable .ui-selected { background: #72A9D3; color: white; } 50 51 .expressomail-qs-container #selectable { list-style-type: none; margin: 0; padding: 0; width: 100%; } 52 .expressomail-qs-container ul#selectable { overflow: hidden; width: 444px; height: 250px;} 53 .expressomail-qs-container ul#selectable li { width: 435px; overflow:hidden; } 54 .expressomail-qs-container ul#selectable li.ui-selected { width: 100%; } 55 .expressomail-qs-container ul#selectable li div { width: 6000px; } 56 .expressomail-qs-container .ui-button-icon-only { width: 1.2em; } 57 .expressomail-qs-container .ui-icon { margin-left: -8px; } 58 .expressomail-qs-container .ui-widget button { border: 0 solid; } 59 60 .expressomail-qs-container .menu-control { float:right; margin-left:380px; position: absolute; z-index: 100; padding-top:5px;} 61 .expressomail-qs-container .acc-list { width:444px;height:250px;float:left;border:1px solid #DDD;background-color:#EEE;border-radius:3px;margin-left:1px; margin: 10px 5px 5px 1px;} 62 .expressomail-qs-container .details-container { width:300px;height:246px; float:right; margin: 5px 0;} 63 64 .expressomail-qs-container .acc-list .demo {width:100%;margin-top:20px;} 65 66 .dialog-modal.expressomail-qs-container { height: 416px; padding:5px; } 67 68 .ui-dialog .ui-dialog-buttonpane { padding: 0; border:none; margin: 0;} 69 .expressomail-qs-container .menu-control .ui-button-text-only .ui-button-text { padding: 0.1em 0.6em; } 70 71 /* search area definition */ 72 fieldset.search-field, fieldset.search-catalog-options { 73 border:1px solid #CFCFCF; 74 padding: 5px; 75 } 76 77 fieldset.search-field input, fieldset.search-catalog-options select{ 78 display: inline-block; 79 border: none; 80 background-color: #FFF; 81 } 82 83 fieldset.search-field span { 84 display: inline-block; 85 margin:0 0 -3px 5px; 86 } 87 88 /* #search area definition */ 89 fieldset.search-field { max-width: 190px; width: 190px; margin: 0px; text-align: left; display: inline;} 90 fieldset.search-field input { max-width: 165px; width: 165px; } 91 92 fieldset.search-catalog-options { max-width: 124px; width: 120px; margin: 0px; text-align: left; display: inline;} 93 fieldset.search-catalog-options select { max-width: 120px; width: 120px; } 94 95 96 .ui-dialog .ui-dialog-titlebar-minimize { 97 height: 18px; 98 margin: -10px 0 0; 99 padding: 1px; 100 position: absolute; 101 right: 1.8em; 102 top: 50%; 103 width: 19px; 104 } 105 106 .ui-dialog-buttonpane .ui-button { 107 margin-top: 0; 108 padding-top: 0; 109 } 57 110 58 111 112 .button-mod { margin-top: -2.5em; }
Note: See TracChangeset
for help on using the changeset viewer.