Changeset 5172
- Timestamp:
- 11/11/11 16:42:49 (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.attachment.inc.php
r5134 r5172 363 363 364 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' ))365 if( !$name && isset($structure->disposition) && (strtolower($structure->disposition) === 'attachment' || strtolower($structure->ctype_primary) == 'image' || strtolower($structure->ctype_primary.'/'.$structure->ctype_secondary) == 'application/octet-stream')) 366 366 foreach ($structure->d_parameters as $i => $v) 367 367 if(strpos($i , 'filename') !== false) 368 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' ) )369 if( !$name && isset($structure->disposition) && (strtolower($structure->disposition) === 'attachment' || strtolower($structure->ctype_primary) == 'image' || strtolower($structure->ctype_primary.'/'.$structure->ctype_secondary) == 'application/octet-stream') ) 370 370 foreach ($structure->ctype_parameters as $i => $v) 371 371 if(strpos($i , 'name') !== false) … … 439 439 $name = $part->ctype_parameters['name']; 440 440 441 //Attachments com nomes grandes são quebrados em varias partes VER RFC2231 442 if( !$name && isset($part->disposition) && (strtolower($part->disposition) === 'attachment' || strtolower($part->ctype_primary) == 'image' || strtolower($part->ctype_primary.'/'.$part->ctype_secondary) == 'application/octet-stream') ) 443 foreach ($part->d_parameters as $i => $v) 444 if(strpos($i , 'filename') !== false) 445 $name .= urldecode(str_ireplace(array('ISO-8859-1','UTF-8','US-ASCII'),'',$v)); 446 if( !$name && isset($part->disposition) && (strtolower($part->disposition) === 'attachment' || strtolower($part->ctype_primary) == 'image' || strtolower($part->ctype_primary.'/'.$part->ctype_secondary) == 'application/octet-stream') ) 447 foreach ($part->ctype_parameters as $i => $v) 448 if(strpos($i , 'name') !== false) 449 $name .= urldecode(str_ireplace(array('ISO-8859-1','UTF-8','US-ASCII'),'',$v)); 450 //////////////////////////////////////////////////////////////////////////////////// 451 441 452 if($name && (strlen($name) - (strrpos($name, '.')+1) === 3 )) 442 453 $ext = strtolower(substr ( $name , (strrpos($name, '.')+1) )); -
trunk/expressoMail1_2/inc/class.exporteml.inc.php
r5134 r5172 183 183 // apenas um arquivo a ser exportado, 184 184 // não seja criado em zip 185 // 186 // Funcao altarada para exportar uma ou 187 // varia mensagens de um pesquisa 188 185 189 function makeAll($params) { 190 //Exporta menssagens selecionadas na pesquisa 191 if($params['folder'] === 'false'){ 192 193 $this->folder = $params['folder']; 194 $error = False; 195 $fileNames = ""; 196 197 $sel_msgs = explode(",", $params['msgs_to_export']); 198 @reset($sel_msgs); 199 $sorted_msgs = array(); 200 foreach($sel_msgs as $idx => $sel_msg) { 201 $sel_msg = explode(";", $sel_msg); 202 if(array_key_exists($sel_msg[0], $sorted_msgs)){ 203 $sorted_msgs[$sel_msg[0]] .= ",".$sel_msg[1]; 204 } 205 else { 206 $sorted_msgs[$sel_msg[0]] = $sel_msg[1]; 207 } 208 } 209 210 unset($sorted_msgs['']); 211 212 213 // Verifica se as n mensagens selecionadas 214 // se encontram em um mesmo folder 215 if (count($sorted_msgs)==1){ 216 217 $array_names_keys = array_keys($sorted_msgs); 218 $this->folder = mb_convert_encoding($array_names_keys[0], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 219 $msg_number = explode(',', $sorted_msgs[$array_names_keys[0]]); 220 $tempDir = $this->tempDir; 221 $this->connectImap(); 222 223 //verifica se apenas uma mensagem foi selecionada e exportar em .eml 224 if(count($msg_number) == 1){ 225 $header = $this->getHeader($msg_number[0]); 226 $body = $this->getBody($msg_number[0]); 227 $sEMLData = $this->parseEml($header, $body); 228 $fileName = $this->CreateFileEml($sEMLData, $tempDir, $msg_number[0]."_".$_SESSION[ 'phpgw_session' ][ 'session_id' ]); 229 230 231 imap_close($this->mbox_stream); 232 if (!$fileName) { 233 return false; 234 }else{ 235 return $tempDir.'/'.$fileName; 236 } 237 } 238 239 //cria um .zip com as mensagens selecionadas 240 for($i = 0; $i < count($msg_number); $i++) 241 { 242 $header = $this-> getHeader($msg_number[$i]); 243 $body = $this-> getBody($msg_number[$i]); 244 $sEMLData = $this -> parseEml($header, $body); 245 $fileName = $this -> CreateFileEml($sEMLData, $tempDir, $msg_number[$i]); 246 247 if(!$fileName) 248 { 249 $error = True; 250 break; 251 } else{ 252 $fileNames .= "\"".$fileName."\" "; 253 } 254 } 255 imap_close($this->mbox_stream); 256 257 $nameFileZip = 'False'; 258 if($fileNames && !$error) 259 { 260 $nameFileZip = $this -> createFileZip($fileNames, $tempDir); 261 if($nameFileZip) 262 { 263 $file = $tempDir.'/'.$nameFileZip; 264 } else { 265 $file = false; 266 } 267 } 268 else 269 { 270 $file = false; 271 } 272 273 return $file; 274 275 //exporta mensagens de diferentes pastas 276 }else{ 277 $array_names_keys = array_keys($sorted_msgs); 278 279 for($i = 0; $i < count($array_names_keys); $i++){ 280 $this->folder = mb_convert_encoding($array_names_keys[$i], "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 281 $msg_number = explode(',', $sorted_msgs[$array_names_keys[$i]]); 282 $tempDir = $this->tempDir; 283 $this->connectImap(); 284 285 for($j = 0; $j < count($msg_number); $j++) 286 { 287 $header = $this-> getHeader($msg_number[$j]); 288 $body = $this-> getBody($msg_number[$j]); 289 $sEMLData = $this -> parseEml($header, $body); 290 $fileName = $this -> CreateFileEml($sEMLData, $tempDir, $msg_number[$j]); 291 292 if(!$fileName) 293 { 294 $error = True; 295 break; 296 } else{ 297 $fileNames .= "\"".$fileName."\" "; 298 } 299 } 300 imap_close($this->mbox_stream); 301 } 302 $nameFileZip = 'False'; 303 if($fileNames && !$error) 304 { 305 $nameFileZip = $this -> createFileZip($fileNames, $tempDir); 306 if($nameFileZip) 307 { 308 $file = $tempDir.'/'.$nameFileZip; 309 } else { 310 $file = false; 311 } 312 } 313 else 314 { 315 $file = false; 316 } 317 return $file; 318 } 319 }else{ 186 320 // Exportacao de mensagens arquivadas localmente 187 321 if($params['l_msg'] == "t") … … 235 369 { 236 370 $this-> folder = $params['folder']; 237 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8");371 $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8, ISO-8859-1, UTF7-IMAP"); 238 372 $array_ids = explode(',', $params['msgs_to_export']); 239 373 $error = False; … … 293 427 return $file; 294 428 } 429 } 295 430 } 296 431 -
trunk/expressoMail1_2/inc/class.imap_functions.inc.php
r5158 r5172 595 595 function get_info_msgs($params) { 596 596 include_once("class.exporteml.inc.php"); 597 598 if(array_key_exists('messages', $params)){ 599 $sel_msgs = explode(",", $params['messages']); 600 @reset($sel_msgs); 601 $sorted_msgs = array(); 602 foreach($sel_msgs as $idx => $sel_msg) { 603 $sel_msg = explode(";", $sel_msg); 604 if(array_key_exists($sel_msg[0], $sorted_msgs)){ 605 $sorted_msgs[$sel_msg[0]] .= ",".$sel_msg[1]; 606 } 607 else { 608 $sorted_msgs[$sel_msg[0]] = $sel_msg[1]; 609 } 610 } 611 unset($sorted_msgs['']); 612 613 $return = array(); 614 $array_names_keys = array_keys($sorted_msgs); 615 616 for($i = 0; $i < count($sorted_msgs); $i++){ 617 618 $new_params = array(); 619 $attach_params = array(); 620 621 $new_params["msg_folder"]= $array_names_keys[$i]; 622 $attach_params["folder"] = $params["folder"]; 623 $msgs = explode(",",$sorted_msgs[$array_names_keys[$i]]); 624 $exporteml = new ExportEml(); 625 $unseen_msgs = array(); 626 foreach($msgs as $msg_number) { 627 $new_params["msg_number"] = $msg_number; 628 //ini_set("display_errors","1"); 629 $msg_info = $this->get_info_msg($new_params); 630 631 $this->mbox = $this->open_mbox($array_names_keys[$i]); //Não sei porque, mas se não abrir de novo a caixa dá erro. 632 $msg_info['header'] = $this->get_info_head_msg($msg_number); 633 634 $attach_params["num_msg"] = $msg_number; 635 $msg_info['array_attach'] = $exporteml->get_attachments_in_array($attach_params); 636 imap_close($this->mbox); 637 $this->mbox=false; 638 array_push($return,serialize($msg_info)); 639 640 if($msg_info['Unseen'] == "U" || $msg_info['Recent'] == "N"){ 641 array_push($unseen_msgs,$msg_number); 642 } 643 } 644 } 645 if($unseen_msgs){ 646 $msgs_list = implode(",",$unseen_msgs); 647 $array_msgs = array('folder' => $new_params["msg_folder"], "msgs_to_set" => $msgs_list, "flag" => "unseen"); 648 $this->set_messages_flag($array_msgs); 649 } 650 return $return; 651 }else{ 597 652 $return = array(); 598 653 $new_params = array(); … … 626 681 $this->set_messages_flag($array_msgs); 627 682 } 628 629 683 return $return; 684 } 630 685 } 631 686 … … 2069 2124 if($mbox_stream) 2070 2125 imap_close($mbox_stream, CL_EXPUNGE); 2126 2127 $return['status'] = true; 2071 2128 return $return; 2072 2129 } … … 3469 3526 } 3470 3527 3471 3472 function move_search_messages($params){ 3473 $params['selected_messages'] = urldecode($params['selected_messages']); 3474 $params['new_folder'] = urldecode($params['new_folder']); 3475 $params['new_folder_name'] = urldecode($params['new_folder_name']); 3528 function move_delete_search_messages($params){ 3529 $move = false; 3530 $msg_no_move = ""; 3531 3532 $params['selected_messages'] = urldecode($params['selected_messages_move']); 3533 $params['new_folder'] = urldecode($params['new_folder_move']); 3534 $params['new_folder_name'] = urldecode($params['new_folder_name_move']); 3476 3535 $sel_msgs = explode(",", $params['selected_messages']); 3477 3536 @reset($sel_msgs); … … 3485 3544 $sorted_msgs[$sel_msg[0]] = $sel_msg[1]; 3486 3545 } 3487 } 3546 } 3488 3547 @ksort($sorted_msgs); 3489 3548 $last_return = false; … … 3491 3550 $params['msgs_number'] = $msgs_number; 3492 3551 $params['folder'] = $folder; 3493 if($params['new_folder'] && $folder != $params['new_folder']){ 3494 $last_return = $this -> move_messages($params); 3495 } 3496 elseif(!$params['new_folder'] || $params['delete'] ){ 3497 $last_return = $this -> delete_msgs($params); 3552 3553 $last_return = $this->move_messages($params); 3554 3555 if($last_return['status']){ 3556 $move = true; 3557 }else{ 3558 $msg_no_move = $params['msgs_number']; 3559 } 3560 } 3561 $sel_msgs = null; 3562 $params['selected_messages'] = urldecode($params['selected_messages_delete']); 3563 $params['new_folder'] = urldecode($params['new_folder_delete']); 3564 $params['new_folder_name'] = urldecode($params['new_folder_name_delete']); 3565 $sel_msgs = explode(",", $params['selected_messages']); 3566 @reset($sel_msgs); 3567 $sorted_msgs = array(); 3568 foreach($sel_msgs as $idx => $sel_msg) { 3569 $sel_msg = explode(";", $sel_msg); 3570 if(array_key_exists($sel_msg[0], $sorted_msgs)){ 3571 $sorted_msgs[$sel_msg[0]] .= ",".$sel_msg[1]; 3572 } 3573 else { 3574 $sorted_msgs[$sel_msg[0]] = $sel_msg[1]; 3575 } 3576 } 3577 @ksort($sorted_msgs); 3578 $last_return = false; 3579 foreach($sorted_msgs as $folder => $msgs_number) { 3580 $params['msgs_number'] = $msgs_number; 3581 $params['folder'] = $folder; 3582 3583 $params['folder'] = $params['new_folder_delete']; 3584 $last_return = $this->delete_msgs($params); 3585 $last_return['deleted'] = true; 3586 if($last_return['status']){ 3587 $move = true; 3588 }else{ 3589 $msg_no_move = $params['msgs_number']; 3590 } 3591 3592 } 3593 3594 if($move) 3595 $last_return['move'] = true; 3596 3597 if($msg_no_move != "") 3598 $last_return['no_move'] = $msg_no_move; 3599 3600 return $last_return; 3601 } 3602 3603 function move_search_messages($params){ 3604 $params['selected_messages'] = urldecode($params['selected_messages']); 3605 $params['new_folder'] = urldecode($params['new_folder']); 3606 $params['new_folder_name'] = urldecode($params['new_folder_name']); 3607 $sel_msgs = explode(",", $params['selected_messages']); 3608 $move = false; 3609 $msg_no_move = ""; 3610 3611 @reset($sel_msgs); 3612 $sorted_msgs = array(); 3613 foreach($sel_msgs as $idx => $sel_msg) { 3614 $sel_msg = explode(";", $sel_msg); 3615 if(array_key_exists($sel_msg[0], $sorted_msgs)){ 3616 $sorted_msgs[$sel_msg[0]] .= ",".$sel_msg[1]; 3617 } 3618 else { 3619 $sorted_msgs[$sel_msg[0]] = $sel_msg[1]; 3620 } 3621 } 3622 @ksort($sorted_msgs); 3623 $last_return = false; 3624 foreach($sorted_msgs as $folder => $msgs_number) { 3625 $params['msgs_number'] = $msgs_number; 3626 $params['folder'] = $folder; 3627 3628 if($params['delete'] === 'true'){ 3629 $params['folder'] = $params['new_folder']; 3630 $last_return = $this->delete_msgs($params); 3498 3631 $last_return['deleted'] = true; 3499 } 3500 } 3632 3633 if($last_return['status']){ 3634 $move = true; 3635 }else{ 3636 $msg_no_move = $params['msgs_number']; 3637 } 3638 3639 }else{ 3640 $last_return = $this->move_messages($params); 3641 3642 if($last_return['status']){ 3643 $move = true; 3644 }else{ 3645 $msg_no_move = $params['msgs_number']; 3646 } 3647 } 3648 } 3649 3650 if($move) 3651 $last_return['move'] = true; 3652 3653 if($msg_no_move != "") 3654 $last_return['no_move'] = $msg_no_move; 3655 3501 3656 return $last_return; 3502 3657 } … … 5066 5221 5067 5222 if(!isset($params['sort'])) 5068 $params['sort'] = SORTDATE;5223 $params['sort'] = 'SORTDATE_REVERSE'; 5069 5224 5070 5225 $params['search'] = mb_convert_encoding($params['search'], 'UTF-8',mb_detect_encoding($params['search'].'x', 'UTF-8, ISO-8859-1')); … … 5081 5236 { 5082 5237 $imap = $this->open_mbox( $folder ) ; 5083 $msgIds = imap_sort( $imap , SORTDATE , 0, SE_UID , $search ,'UTF-8');5238 $msgIds = imap_sort( $imap , SORTDATE , 1 , SE_UID , $search ,'UTF-8'); 5084 5239 5085 5240 $count += count($msgIds); … … 5140 5295 } 5141 5296 5142 $return['msgs'] = $this->array_msort($return['msgs'] , array( $sA => SORT_ASC));5143 5297 5298 if($params['sort'] !== 'SORTDATE_REVERSE') 5144 5299 if(strpos($params['sort'],'REVERSE') !== false) 5145 $return['msgs'] = array_reverse($return['msgs']); 5146 5300 $return['msgs'] = $this->array_msort($return['msgs'] , array( $sA => SORT_DESC)); 5301 else 5302 $return['msgs'] = $this->array_msort($return['msgs'] , array( $sA => SORT_ASC)); 5147 5303 5148 5304 $k = -1; -
trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
r5134 r5172 316 316 //$retorno = $retorno_personal + $retorno_global; 317 317 $retorno = array_merge($retorno_personal, $retorno_global); 318 $retorno['search_for'] = $params['search_for']; 318 319 319 $retorno['type_catalog'] = "A"; 320 $retorno['search_for'] = $params['search_for']; 320 321 return $retorno; 321 322 } … … 336 337 $DBService = ServiceLocator::getService('db'); 337 338 $results = $DBService->search_contacts($params['search_for']); 339 $DBService = ServiceLocator::getService('db'); 340 $results2 = $DBService->search_groups($params['search_for']); 341 $results = array_merge($results, $results2); 338 342 339 343 if(!$all) 340 344 $results['type_catalog'] = "P"; 341 $results['search_for'] = $params['search_for'];342 345 343 346 foreach($results as $i=>$value) 344 347 $results[$i]['type_contact'] = "P"; 345 348 349 $results['search_for'] = $params['search_for']; 346 350 return $results; 347 351 } … … 444 448 $info_return['type_catalog'] = "G"; 445 449 446 $info_return['search_for'] = $params['search_for'];447 450 $info_return['extra_ldap_fields'] = $campos_extras; 448 451 449 452 foreach($info_return as $i=>$value) 450 453 $info_return[$i]['type_contact'] = "G"; 454 455 $info_return['search_for'] = $params['search_for']; 451 456 return $info_return; 452 457 } -
trunk/expressoMail1_2/js/QuickCatalogSearch.js
r5134 r5172 10 10 emQuickCatalogSearch.prototype.showList = function(data, begin, end, ID, field) 11 11 { 12 data_= data;13 14 15 16 12 data_ = data; 13 id_ = ID; 14 field_ = field; 15 begin_ = begin; 16 end_ = end; 17 17 18 19 18 keypress_read(data); 19 configure_slider(data); 20 20 create_list(data, true); 21 22 21 details_results(data); 22 23 23 id = '1'; 24 24 _this = this; … … 36 36 func_add_contact = function () { 37 37 }; 38 39 38 _this.showWindow(el_A); 40 39 } 41 42 40 41 43 42 /* Leitura das teclas de atalho */ 44 43 function keypress_read(data) { 45 $("#dialog-modal"). keydown(function (e) {44 $("#dialog-modal").unbind('keydown').keydown(function (e) { 46 45 var keyCode = e.keyCode; 47 arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13, esc: 27 };48 var slider = $( "#slider" 46 arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13, esc: 27, space: 32}; 47 var slider = $( "#slider" ); 49 48 switch (keyCode) 50 49 { 51 case arrow.enter: 50 case arrow.enter: 52 51 if(!search_focus){ 53 52 i = $(".ui-selected:last").attr("value") + 1; 54 add_contact_field($("#contact_" + i).html()); 53 if($("#actions_"+i).clone().find(".ui-button-text").text() == '+') 54 add_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); 55 else{ 56 remove_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); 57 } 55 58 document.getElementById("busca").value = ""; 56 $("#dialog-modal").unbind('keydown'); 57 $("#dialog-modal").dialog("close"); 59 $("#dialog-modal").dialog("close"); 58 60 } 59 61 break; 60 62 case arrow.left: 61 slider.slider("value", $( "#slider" ).slider( "value" ) - 1); 62 create_list(data_, false); 63 if(!search_focus){ 64 slider.slider("value", $( "#slider" ).slider( "value" ) - 1); 65 create_list(data_, false); 66 } 63 67 break; 64 68 case arrow.right: 65 if((($( "#slider" ).slider( "value" ))) == Math.ceil(data_.length/6)) 66 break; 67 slider.slider( "value", $( "#slider" ).slider( "value" ) + 1); 68 create_list(data_, false); 69 if(!search_focus){ 70 if((($( "#slider" ).slider( "value" ))) == Math.ceil(data_.length/6)) 71 break; 72 slider.slider( "value", $( "#slider" ).slider( "value" ) + 1); 73 create_list(data_, false); 74 } 69 75 break; 70 76 case arrow.up: 71 show_detail(data_, "up"); 77 if(!search_focus){ 78 show_detail(data_, "up"); 79 } 72 80 break; 73 81 case arrow.down: 74 show_detail(data_, "down"); 75 break; 76 } 82 if(!search_focus){ 83 show_detail(data_, "down"); 84 } 85 break; 86 case arrow.space: 87 88 if(!search_focus){ 89 i = $(".ui-selected:last").attr("value") + 1; 90 if($("#actions_"+i).clone().find(".ui-button-text").text() == '+') 91 { 92 add_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); 93 }else{ 94 remove_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); 95 } 96 document.getElementById("busca").value = ""; 97 } 98 break; 99 } 77 100 }); 78 101 } 79 102 80 103 … … 88 111 $('li.ui-selected').next().addClass("ui-selected"); 89 112 id_contact++; 90 113 } 91 114 else { 92 115 if(id_contact == (($( "#slider" ).slider( "value" ) -1)*6)) … … 95 118 $('li.ui-selected').prev().addClass("ui-selected"); 96 119 id_contact--; 97 } 120 } 98 121 line_contact.removeClass("ui-selected").addClass("ui-selectee"); 99 var details = $("#detalhes_contato").empty(); 122 var details = $("#detalhes_contato").empty(); 100 123 switch(data_['type_catalog']) { 101 124 case 'G': 102 125 var extra_fields = (data_['extra_ldap_fields']).split("#"); 103 126 if(preferences.default_fields_quick_search != 0) { 104 127 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 128 details.append('<p><label class="attribute">Telefone </label>' + '<span class="value">' + data_[id_contact].telephonenumber[0] + '</span></p>'); 106 129 } 107 130 for (var i=0; i<=extra_fields.length-1; i++) 108 109 110 131 { 132 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 133 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 111 134 if(data_[id_contact][valor.toLowerCase()] != undefined) { 112 135 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; … … 114 137 details.append(tmp_campo + '<span class="value">' + data_[id_contact][valor.toLowerCase()][j] + "</span></p>"); 115 138 tmp_campo = ""; 116 117 118 119 139 } 140 } 141 } 142 break; 120 143 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>'); 144 if(utf8_decoder(data_[id_contact].cn) == 'undefined') 145 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].title) + '</label>' + '<span class="value">' + data_[id_contact].short_name + '</span></p>'); 146 else 147 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn) + '</label>' + '<span class="value">' + data_[id_contact].mail + '</span></p>'); 122 148 if(data_[id_contact].telephonenumber != null) 123 149 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data_[id_contact].telephonenumber + '</span></p>'); 124 break;150 break; 125 151 default: 126 152 var extra_fields = (data_['extra_ldap_fields']).split("#"); 127 153 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>'); 154 if(utf8_decoder(data_[id_contact].cn) == 'undefined') 155 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].title) + '</label>' + '<span class="value">' + data_[id_contact].short_name + '</span></p>'); 156 else 157 details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn) + '</label>' + '<span class="value">' + data_[id_contact].mail + '</span></p>'); 129 158 if(data_[id_contact].telephonenumber != null) 130 159 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data_[id_contact].telephonenumber + '</span></p>'); 131 } 160 } 161 if(data_[id_contact].mail[0] == 'undefined') 162 break; 132 163 if(data_[id_contact].mail[0].length > 1) { 133 164 for (var i=0; i<=extra_fields.length-1; i++) { 134 135 165 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 166 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 136 167 if(data_[id_contact][valor.toLowerCase()] != undefined) { 137 168 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; … … 139 170 details.append(tmp_campo + '<span class="value">' + data_[id_contact][valor.toLowerCase()][j] + "</span></p>"); 140 171 tmp_campo = ""; 141 142 143 144 145 146 }172 } 173 } 174 } 175 } 176 break; 177 } 147 178 } 179 148 180 149 150 151 /* 152 * Método que cria a lista de contatos 153 */ 181 /* 182 * Método que cria a lista de contatos 183 */ 154 184 function create_list(data, begin, uiValue) { 155 185 var sliderValue = 1; … … 158 188 if(uiValue) 159 189 sliderValue = uiValue; 160 190 $("#detalhes_contato").empty(); 161 191 var paginas = Math.ceil(data.length/6); 162 $("#title_usuarios").html( get_lang("Results") ); 163 var selectable = $("#selectable"); 164 selectable.empty(); 165 var Ul = document.createElement("ul"); 192 $("#title_usuarios").html( get_lang("Results") ); 193 var selectable = $("#selectable"); 194 selectable.empty(); 195 var acento = data.search_for; 196 var Ul = document.createElement("ul"); 197 var caracteresInvalidos = 'àèìòùâêîôûäëïöüáéíóúãõÀÈÌÒÙÂÊÎÔÛÄËÏÖÜÁÉÍÓÚÃÕ'; 198 var caracteresValidos = 'aeiouaeiouaeiouaeiouaoAEIOUAEIOUAEIOUAEIOUAO'; 199 200 var i = new Number(); 201 var j = new Number(); 202 var cString = new String(); 203 var varRes = ''; 204 205 for (i = 0; i < data.search_for.length; i++) { 206 cString = data.search_for.substring(i, i + 1); 207 for (j = 0; j < caracteresInvalidos.length; j++) { 208 if (caracteresInvalidos.substring(j, j + 1) == cString){ 209 cString = caracteresValidos.substring(j, j + 1); 210 } 211 } 212 varRes += cString; 213 } 214 data.search_for = varRes; 215 166 216 for (i=((sliderValue -1)*6)+1; i<(((sliderValue -1)*6)+1)+6; i++) { 167 217 var Op = document.createElement("li"); 168 218 if(i > data.length) 169 170 171 data[i-1].mail = "No mail";219 break; 220 if (data['type_catalog'] != 'G' && (data[i-1].mail == null || data[i-1].mail == "")) 221 data[i-1].mail = get_lang("No mail"); 172 222 173 223 if(i == (((sliderValue -1)*6)+1)) { 174 224 Op.setAttribute("class", "ui-selected"); 175 225 Op.setAttribute("className", "ui-selected"); 176 }177 else {178 226 } 227 else { 228 Op.setAttribute("class", "ui-selectee"); 179 229 Op.setAttribute("className", "ui-selectee"); 180 } 181 var contact_name = utf8_decoder(data[i-1].cn); 182 if(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) != -1 && data.search_for.indexOf(" ") == -1 && data.search_for.indexOf("@") == -1) 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); 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>'; 185 $(Op).val(i - 1); 230 } 231 var contact_name = utf8_decoder(data[i-1].cn); 232 if(contact_name == 'undefined'){ 233 contact_name = utf8_decoder(data[i-1].title); 234 if(contact_name != 'undefined'){ 235 data[i-1].mail = data[i-1].short_name; 236 } 237 } 238 var exist = "add_contact_field"; 239 var signal = "+"; 240 var btnClass = "add"; 241 var emailList = $("#" + field_ + "_" + id_).val(); 242 var emails_adicionados = emailList.split(","); 243 for(aux=0; aux<emails_adicionados.length -1; aux++) { 244 if(emails_adicionados[aux].match(/<([^<]*)>[\s]*$/)[1] == utf8_decoder(data[i-1].mail)){ 245 emails_adicionados[aux] = "%"; 246 exist = "remove_contact_field"; 247 signal = "x"; 248 btnClass = "remove"; 249 } 250 } 251 252 if(contact_name.toLowerCase().indexOf(acento.toLowerCase()) != -1 && acento.indexOf(" ") == -1 && acento.indexOf("@") == -1) 253 contact_name = contact_name.substring(0, contact_name.toLowerCase().indexOf(acento.toLowerCase())) + "<u>" + contact_name.substr(contact_name.toLowerCase().indexOf(acento.toLowerCase()), acento.length) + "</u>" + contact_name.substring(contact_name.toLowerCase().indexOf(acento.toLowerCase()) + acento.length); 254 else if(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) != -1 && data.search_for.indexOf(" ") == -1 && data.search_for.indexOf("@") == -1) 255 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 var line = '<span class="menu-control"><button class="'+btnClass+'" id="actions_'+i+'" onClick="'+exist+'(document.getElementById(\'contact_' + i + '\').innerHTML, this, \'contact_' + i + '\')">'+ signal +'</button></span><div id="contact_' + i + '" onDblClick="'+exist+'(this.innerHTML, document.getElementById(\'actions_'+i+'\'), \'contact_' + i + '\')"><div class="name_contact"><strong class="name">' + contact_name + '</strong><em class="email">' + utf8_decoder(data[i-1].mail) + '</em></div></div>'; 257 Op.innerHTML = line; 258 $(Op).val(i - 1); 186 259 selectable.append(Op); 187 } 260 $("#contact_"+i).click(function(){ 261 document.getElementById("amount-text").focus(); 262 }); 263 } 188 264 selectable.append(Ul); 189 265 var first_contact; … … 198 274 }); 199 275 } 200 var details = $("#detalhes_contato").empty(); 276 var details = $("#detalhes_contato").empty(); 277 201 278 switch (data['type_catalog']) { 202 279 case 'G': … … 220 297 break; 221 298 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>'); 299 if(utf8_decoder(data[first_contact].cn) != 'undefined') 300 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn) + '</label>' + '<span class="value">' + data[first_contact].mail + '</span></p>'); 301 else 302 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].title) + '</label>' + '<span class="value">' + data[first_contact].short_name + '</span></p>'); 223 303 if(data[first_contact].telephonenumber != null) 224 304 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber + '</span></p>'); 225 305 break; 226 default: 306 default: 227 307 var extra_fields = (data['extra_ldap_fields']).split("#"); 228 308 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>"); 309 if(utf8_decoder(data[first_contact].cn) != 'undefined') 310 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn) + '</label>' + '<span class="value">' + data[first_contact].mail + '</span></p>'); 311 else 312 details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].title) + '</label>' + '<span class="value">' + data[first_contact].short_name + '</span></p>'); 230 313 if(data[first_contact].telephonenumber != null) 231 314 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber + "</span></p>"); 232 315 } 233 if(data[first_contact].mail != "No mail") {234 if(data[first_contact].mail [0].length > 1) {316 if(data[first_contact].mail != get_lang("No mail")) { 317 if(data[first_contact].mail.length > 1) { 235 318 for (var i=0; i<=extra_fields.length-1; i++) { 236 319 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); … … 251 334 $( "#amount-text" ).val( string_results ); 252 335 $("button").button(); 336 //$("button.remove").button({icons:{primary:"ui-icon-close"}, text: false}); 337 //$("button.add").button({icons:{primary:"ui-icon-plus"}, text: false}); 253 338 if(!is_ie) 254 339 document.getElementById("amount-text").focus(); 255 $("#selectable li:first button:first").focus();340 $("#selectable li:first").focus(); 256 341 removeFocus(); 257 342 } 258 343 259 344 260 345 /* Método que configura os detalhes do resultado da busca */ 261 346 function details_results(data) { 262 $(function() { 263 $( "#selectable" ).selectable({ 264 stop: function() { 265 var details = $("#detalhes_contato").empty(); 266 $( ".ui-selected", this ).each(function() { 267 switch(data['type_catalog']) { 268 case 'G': 269 var extra_fields = (data['extra_ldap_fields']).split("#"); 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++) { 275 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 276 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 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 = ""; 282 } 283 } 284 } 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: 292 var extra_fields = (data['extra_ldap_fields']).split("#"); 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>"); 297 } 298 if(data[this.value].mail[0].length > 1) { 347 $(function() { 348 $( "#selectable" ).selectable({ 349 stop: function() { 350 var details = $("#detalhes_contato").empty(); 351 $( ".ui-selected", this ).each(function() { 352 if(data.length > 0){ 353 switch(data['type_catalog']) { 354 case 'G': 355 var extra_fields = (data['extra_ldap_fields']).split("#"); 356 if(preferences.default_fields_quick_search != 0) { 357 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn[0]) + "</label>" + '<span class="value">' + data[this.value].mail[0] + "</span></p>"); 358 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber[0] + "</span></p>"); 359 } 299 360 for (var i=0; i<=extra_fields.length-1; i++) { 300 301 361 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 362 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 302 363 if(data[this.value][valor.toLowerCase()] != undefined) { 303 364 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; … … 305 366 details.append(tmp_campo + '<span class="value">' + data[this.value][valor.toLowerCase()][j] + "</span></p>"); 306 367 tmp_campo = ""; 307 } 308 } 309 } 310 } 311 break; 312 } 313 }); 314 } 315 }); 316 }); 317 } 318 319 320 /* 321 * Método que configura o slider e os resultados 322 */ 368 } 369 } 370 } 371 break; 372 case 'P': 373 if(utf8_decoder(data[this.value].cn) == 'undefined') 374 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].title) + "</label>" + '<span class="value">' + data[this.value].short_name + "</span></p>"); 375 else 376 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn) + "</label>" + '<span class="value">' + data[this.value].mail + "</span></p>"); 377 if(data[this.value].telephonenumber != null) 378 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber + "</span></p>"); 379 break; 380 default: 381 var extra_fields = (data['extra_ldap_fields']).split("#"); 382 if(preferences.default_fields_quick_search != 0 || data[this.value].type_contact == "P") { 383 if(utf8_decoder(data[this.value].cn) == 'undefined') 384 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].title) + "</label>" + '<span class="value">' + data[this.value].short_name + "</span></p>"); 385 else 386 details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn) + "</label>" + '<span class="value">' + data[this.value].mail + "</span></p>"); 387 if(data[this.value].telephonenumber != null) 388 details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber + "</span></p>"); 389 } 390 if(data[this.value].mail[0] == 'undefined') 391 break; 392 if(data[this.value].mail[0] != get_lang("No mail")) { 393 if(data[this.value].mail[0].length > 1) { 394 for (var i=0; i<=extra_fields.length-1; i++) { 395 var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); 396 var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); 397 if(data[this.value][valor.toLowerCase()] != undefined) { 398 var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; 399 for(j=0; j<data[this.value][valor.toLowerCase()].length; j++) { 400 details.append(tmp_campo + '<span class="value">' + data[this.value][valor.toLowerCase()][j] + "</span></p>"); 401 tmp_campo = ""; 402 } 403 } 404 } 405 } 406 } 407 break; 408 } 409 } 410 }); 411 } 412 }); 413 }); 414 } 415 416 417 /* 418 * Método que configura o slider e os resultados 419 */ 323 420 function configure_slider(data) { 324 421 var paginas = (Math.ceil(data.length/6)); 325 326 327 328 329 330 331 422 $("#title_usuarios").html( get_lang("Results") ); 423 $(function() { 424 $( "#slider" ).slider({ 425 value:1, 426 min: 1, 427 max: paginas, 428 step: 1, 332 429 slide: function( event, ui ) { 333 430 create_list(data, false, ui.value); 334 var string_results = ui.value + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")";431 var string_results = ui.value + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"; 335 432 $( "#amount-text" ).val( string_results ); 336 337 433 } 434 }); 338 435 $("#selectable li:first button:first").focus(); 339 340 436 }); 437 } 341 438 342 439 var search_focus = false; 343 440 344 441 function setFocus() {search_focus = true;return;} 345 442 346 443 function removeFocus() {search_focus = false;return;} 347 444 348 445 function checkEnter(e) { 349 350 351 446 var kC = window.event ? event.keyCode : 447 e && e.keyCode ? e.keyCode : 448 e && e.which ? e.which : null; 352 449 if (kC) 353 450 return kC == 13; 354 451 else 355 356 452 return false; 453 } 357 454 358 359 360 361 455 456 /* 457 * Faz a busca direto da tela modal 458 */ 362 459 function buscaContato(param) { 363 460 $("#busca, #detalhes_contato, #selectable").empty(); … … 365 462 alert(get_lang("Please enter a parameter to search")); 366 463 return; 464 } 465 if(param.length < preferences.search_characters_number) { 466 alert(get_lang("parameter must be at least") + " " + preferences.search_characters_number + " " + get_lang("characters")); 467 return false; 468 } 469 var catalog = $("#combobox").val(); 470 var handler_emQuickSearch = function(data) { 471 data_ = data; 472 if(data_.length > 0) { 473 configure_slider(data_); 474 create_list(data, true); 475 details_results(data_); 367 476 } 368 if(param.length < preferences.search_characters_number) { 369 alert(get_lang("parameter must be at least") + " " + preferences.search_characters_number + " " + get_lang("characters")); 370 return false; 477 else { 478 $("#detalhes_contato, #selectable").empty(); 479 var selectable = $("#selectable"); 480 var Ul = document.createElement("ul"); 481 Ul.onclick = function(){ 482 }; 483 var Op = document.createElement("li"); 484 Op.innerHTML = '<span class="menu-control"></span><div id="no_results"><div class="name_contact"><strong class="name">Nenhum Resultado Encontrado</strong></div></div>'; 485 selectable.append(Op); 486 selectable.append(Ul); 487 var string_results = "0 " + get_lang("of") + " 0 (0 " + get_lang("Results") + ")"; 488 $( "#amount-text" ).val( string_results ); 489 details_results(data); 490 configure_slider(data); 371 491 } 372 var catalog = $("#combobox").val();373 var handler_emQuickSearch = function(data) {374 data_ = data;375 if(data_.length > 0) {376 configure_slider(data_);377 create_list(data_, true);378 details_results(data_);379 }380 else {381 $("#detalhes_contato, #selectable").empty();382 configure_slider(data);383 }384 }385 cExecute ("$this.ldap_functions.quicksearchcontact&search_for="+param+"&field=TO&ID=0&catalog="+catalog, handler_emQuickSearch);386 492 } 387 493 cExecute ("$this.ldap_functions.quicksearchcontact&search_for="+param+"&field=TO&ID=0&catalog="+catalog, handler_emQuickSearch); 494 } 495 496 function verifyEmails(emailAux, contato) { 497 var contact_id = contato.split("_"); 498 if(contact_id[1] != 0) 499 { 500 var ini = parseInt((contact_id[1]/6).toFixed(0)); 501 if(ini != 0 && ini != 1){ 502 ini = ini * 6; 503 var fim = ini+1; 504 } 505 else{ 506 ini = 1; 507 var fim = ini; 508 } 509 fim = fim +5; 510 var contact2 = ""; 511 for(aux = ini; aux <= fim; aux++){ 512 if(contact_id[1] != aux){ 513 if($("#"+contact_id[0]+"_"+aux).find('.email').text() == emailAux){ 514 contact2 = contact_id[0]+"_"+aux; 515 var button = document.getElementById("actions_"+aux); 516 var div = document.getElementById(contact2); 517 if($("#actions_"+aux).find('.ui-button-text').text() == '+'){ 518 button.onclick = function(){ 519 remove_contact_field(div.innerHTML, button, contact2); 520 }; 521 div.ondblclick = function(){ 522 remove_contact_field(div.innerHTML, button, contact2); 523 }; 524 $("#actions_"+aux).find('.ui-button-text').text('x'); 525 } 526 else{ 527 button.onclick = function(){ 528 add_contact_field(div.innerHTML, button, contact2); 529 }; 530 div.ondblclick = function(){ 531 add_contact_field(div.innerHTML, button, contact2); 532 }; 533 $("#actions_"+aux).find('.ui-button-text').text('+'); 534 } 535 } 536 } 537 } 538 } 539 } 540 /* 541 * Método que adiciona o contato selecionado no campo do email (To, CC, CCo) 542 */ 543 function add_contact_field(contact, button, divs) { 544 545 var nome = $(contact).clone().find('.name').text(); 546 var email = $(contact).clone().find('.email').text(); 547 548 if(email == get_lang("No mail")){ 549 alert(get_lang("It is not possible to add this contact as a recipient because it does not have email")); 550 if(!is_ie) 551 document.getElementById("amount-text").focus(); 552 return; 553 } 554 555 verifyEmails(email, divs); 556 557 final_contact = "\""+nome +"\" <"+email+">, "; 558 559 var emailList = document.getElementById(field_ + "_" + id_).value; 560 561 if (emailList[0] != '"' && emailList.indexOf(",") < 0) 562 emailList = emailList.substr(end_); 563 if(emailList.lastIndexOf(",") > 0) 564 emailList = emailList.substr(0, emailList.lastIndexOf(",") + 1); 388 565 389 /*390 * Método que adiciona o contato selecionado no campo do email (To, CC, CCo)391 */392 function add_contact_field(contact) {393 var emailList = document.getElementById(field_ + "_" + id_).value;394 var contact_parsed = contact.replace(/<[\/]*u>/gi, '');395 contact_parsed = contact_parsed.replace(/<u[^>]*>/gi, '');396 contact_parsed = contact_parsed.replace(/<\/?[^>]+>/gi, ' ');397 contact_parsed = contact_parsed.replace(/^\s+|\s+$/gi, "").replace(/\s{2,}/gi, "|");398 var tokens_contact = contact_parsed.split("|");399 if (tokens_contact[1].indexOf("(") > 0)400 tokens_contact[1] = tokens_contact[1].substr(0, (tokens_contact[1].indexOf("("))-2);401 402 var final_contact;403 if(tokens_contact[2] == undefined)404 final_contact = "\"" + tokens_contact[0] + "" + "\" <" + tokens_contact[1] + ">, ";405 else406 {407 if(tokens_contact[3] == undefined)408 final_contact = "\"" + tokens_contact[0] + "" + tokens_contact[1] + "\" <" + tokens_contact[2] + ">, ";409 else410 final_contact = "\"" + tokens_contact[0] + "" + tokens_contact[1] + "" + tokens_contact[2] + "\" <" + tokens_contact[3] + ">, ";411 }412 if (emailList[0] != '"' && emailList.indexOf(",") < 0)413 emailList = emailList.substr(end_);414 if(emailList.lastIndexOf(",") > 0)415 emailList = emailList.substr(0, emailList.lastIndexOf(",") + 1);416 417 566 final_contact = final_contact.replace(/\/n/, ""); 418 new_emailList = emailList + final_contact; 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 { 426 document.getElementById(field_ + "_" + id_).focus(); 427 } 428 429 430 431 $(this).unbind('keypress'); 432 $(this).dialog("close"); 433 } 434 435 /* 436 * Método que remove o contato selecionado no campo do email (To, CC, CCo) 437 */ 438 function remove_contact_field(contact) { 439 var contact_parsed = contact.replace(/<\/?[^>]+>/gi, ' '); 440 contact_parsed = contact_parsed.replace(/^\s+|\s+$/gi, "").replace(/\s{2,}/gi, "|"); 441 442 var tokens_contact = contact_parsed.split("|"); 443 if (tokens_contact[2].indexOf("(") > 0) 444 tokens_contact[2] = tokens_contact[2].substr(0, (tokens_contact[2].indexOf("("))-2); 445 var final_contact; 446 if(tokens_contact[3] == undefined) 447 final_contact = "\"" + tokens_contact[0] + " " + tokens_contact[1] + "\" <" + tokens_contact[2] + ">"; 448 else 449 final_contact = "\"" + tokens_contact[0] + " " + tokens_contact[1] + " " + tokens_contact[2] + "\" <" + tokens_contact[3] + ">"; 450 567 new_emailList = emailList + final_contact; 568 document.getElementById(field_ + "_" + id_).value = new_emailList; 569 570 button.onclick = function(){ 571 remove_contact_field(document.getElementById(divs).innerHTML, button, divs); 572 }; 573 var div = document.getElementById(divs); 574 575 div.ondblclick = function(){ 576 remove_contact_field(div.innerHTML, button, divs); 577 }; 578 579 button.innerHTML = '<span class="ui-button-text" style="">x</span>'; 580 } 581 582 583 /* 584 * Método que remove o contato selecionado no campo do email (To, CC, CCo) 585 */ 586 function remove_contact_field(contact, button, divs) { 587 var email = $(contact).clone().find('.email').text(); 451 588 var exist = false; 589 452 590 var emailList = $("#" + field_ + "_" + id_).val(); 453 var emails_adicionados = emailList.split(","); 591 var emails_adicionados = emailList.split(","); 592 593 verifyEmails(email, divs); 594 454 595 for(i=0; i<emails_adicionados.length -1; i++) { 455 emails_adicionados[i].replace(/^\s+|\s+$/g, ''); 456 if(emails_adicionados[i] == final_contact) {457 596 597 if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)[1] == email) { 598 emails_adicionados[i] = "%"; 458 599 exist = true; 459 } 460 } 600 } 601 } 602 461 603 if (exist == false) 462 463 464 604 return false; 605 var novos_contatos = emails_adicionados.join(","); 606 novos_contatos = novos_contatos.replace(/%,/g, ""); 465 607 $("#" + field_ + "_" + id_).val(novos_contatos); 466 } 608 609 button.onclick = function(){ 610 add_contact_field(document.getElementById(divs).innerHTML, button, divs); 611 }; 612 613 var div = document.getElementById(divs); 614 615 div.ondblclick = function(){ 616 add_contact_field(div.innerHTML, button, divs); 617 }; 618 619 button.innerHTML = '<span class="ui-button-text" style="">+</span>'; 620 } 467 621 468 622 469 623 /* Decoder utf8 */ 470 624 function utf8_decoder ( str_data ) { 471 var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;472 str_data += '';625 var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0; 626 str_data += ''; 473 627 while ( i < str_data.length ) { 474 628 c1 = str_data.charCodeAt(i); 475 629 if (c1 < 128) { 476 477 630 tmp_arr[ac++] = String.fromCharCode(c1); 631 i++; 478 632 } else if ((c1 > 191) && (c1 < 224)) { 479 c2 = str_data.charCodeAt(i+1); 480 tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); 481 i += 2; 482 } else { 483 c2 = str_data.charCodeAt(i+1); 484 c3 = str_data.charCodeAt(i+2); 485 tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 486 i += 3; 487 } 488 } 489 490 return tmp_arr.join(''); 633 c2 = str_data.charCodeAt(i+1); 634 tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); 635 i += 2; 636 } else { 637 c2 = str_data.charCodeAt(i+1); 638 c3 = str_data.charCodeAt(i+2); 639 tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 640 i += 3; 641 } 491 642 } 643 return tmp_arr.join(''); 644 } 492 645 493 646 494 647 /* Mostra tela de help */ 495 648 function show_help() { … … 499 652 width: 540, 500 653 modal: true, 501 closeOnEscape: true 654 closeOnEscape: true, 655 close : function (event, ui) { 656 $( "#amount-text" ).focus(); 657 event.stopPropagation(); 658 } 502 659 }); 503 660 }); 504 661 } 505 506 662 663 $("#dialog-modal_help").live("dialogclose", function(){ 664 if(!is_ie) 665 $( "#amount-text" ).focus(); 666 }); 667 668 507 669 emQuickCatalogSearch.prototype.showWindow = function (div) { 508 670 $(this).bind('keydown'); 509 510 511 512 671 $(function() { 672 $( "#dialog:ui-dialog" ).dialog( "destroy" ); 673 $( "#dialog-modal" ).dialog({ 674 resizable: false, 513 675 // height: "auto", 514 676 width: 780, 515 677 modal: true, 516 678 position: 'bottom', 517 518 519 679 closeOnEscape: true, 680 close: function (event, ui) { 681 event.stopPropagation(); 520 682 $(this).unbind('keydown'); 521 683 if (is_ie) { … … 528 690 }, 529 691 open: function () { 530 $("#selectable li:first button:first").focus(); 531 }, 532 focus: function (event, ui) { 692 removeFocus(); 693 $("#selectable li:first").focus(); 694 document.getElementById("amount-text").focus(); 695 }, 696 focus: function (event, ui) { 533 697 //$(this).unbind('keydown'); 534 535 698 }, 699 beforeClose: function (event, ui) { 536 700 $(this).unbind('keydown'); 537 701 }, 538 702 buttons:[ 539 703 { 540 704 text: "Fechar", 541 705 click: function(){ 542 $("#detalhes_contato, #selectable, #busca").empty();543 $(this).dialog("close");706 $("#detalhes_contato, #selectable, #busca").empty(); 707 $(this).dialog("close"); 544 708 if (is_ie) { 545 709 var range= document.getElementById(field_ + "_" + id_).createTextRange(); … … 548 712 } else { 549 713 document.getElementById(field_ + "_" + id_).focus(); 550 }714 } 551 715 }, 552 716 style: "margin-top: -2.1em" 553 717 } 554 718 ] 555 556 719 }); 720 }); 557 721 $(".ui-dialog .ui-dialog-titlebar") 558 722 .append('<a href="#" class="ui-dialog-titlebar-minimize ui-corner-all" role="button"><span class="ui-icon ui-icon-minusthick">minimize</span></a>') … … 561 725 $(".ui-icon-minusthick, .ui-icon-newwin").toggleClass('ui-icon-minusthick').toggleClass('ui-icon-newwin'); 562 726 }); 563 727 564 728 $("#dialog-modal button, input.button").button(); 565 729 } -
trunk/expressoMail1_2/js/abas.js
r5134 r5172 155 155 } 156 156 157 if (! id_value) // Is new message?157 if (! id_value){ // Is new message? 158 158 var ID = parseInt(BordersArray[(BordersArray.length-1)].sequence) + 1; 159 else 159 if(isNaN(ID)){ 160 var aux = BordersArray[(BordersArray.length-1)].sequence.split("_"); 161 ID = parseInt(aux[1]) + 1; 162 } 163 }else 160 164 { 161 165 if (Element("border_id_"+id_value)) // It's opened already! -
trunk/expressoMail1_2/js/common_functions.js
r5134 r5172 684 684 685 685 function search_emails(value){ 686 var resize = false; 687 resize = resize_borders(); 688 if (!resize){ 689 var str_continue = ''; 690 var bolContinue = true; 691 str_continue = '\n' + get_lang('You must manually close one of your tabs before opening a new one'); 692 if (preferences.auto_close_first_tab == 1){ 693 var children = Element('border_tr').childNodes; 694 var bolDelete = true; 695 for (var i=0; i<children.length; i++) { 696 if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')) 697 { 698 bolDelete = true; 699 var num_child = children[i].id.toString().substr(10); 700 alternate_border(num_child); 701 if (editTest(num_child)){ 702 bolDelete = false; 703 } 704 if (bolDelete || bolContinue){ 705 str_fechar = '\n' + get_lang('Reached maximum tab limit. Want to close this tab'); 706 var confirmacao = confirm(str_fechar); 707 if(confirmacao){ 708 bolContinue = false; 709 delete_border(num_child, 'false'); 710 return; 711 }else{ 712 return; 713 } 714 } 715 } 716 } 717 }else{ 718 alert(get_lang('Reached maximum tab limit') + str_continue ); 719 return; 720 } 721 } 686 722 connector.loadScript("TreeS"); 687 723 connector.loadScript("search"); … … 691 727 } 692 728 EsearchE.showForms(value); 693 }729 } 694 730 695 731 function source_msg(id_msg,folder){ -
trunk/expressoMail1_2/js/local_messages.js
r5134 r5172 1636 1636 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 1637 1637 1638 if( msgs_number =='selected' || !msgs_number ) 1638 if( msgs_number =='selected' || !msgs_number ){ 1639 if (currentTab != 0 && currentTab.indexOf("search_") >= 0) 1640 msgs_number = get_selected_messages_search(); 1641 else 1639 1642 msgs_number = get_selected_messages(); 1640 1643 } 1641 1644 if( !msgs_number ) 1642 1645 return write_msg(get_lang('No selected message.')); -
trunk/expressoMail1_2/js/main.js
r5158 r5172 603 603 604 604 605 function move_search_msgs(border_id, new_folder, new_folder_name){606 605 607 if( preferences.use_local_messages == 1 && expresso_local_messages.isArchiving( msgs_number, folder ) ){ 606 function move_search_msgs(border_id, new_folder, new_folder_name, action){ 607 608 var msg_to_delete = ""; 609 var msg_to_move = ""; 610 var selected_messages = ''; 611 var temp_msg; 612 var remove_currente_folder = ""; 613 var id_border = currentTab.replace(/[a-zA-Z_]+/, ""); 614 615 var delete_msg = false; 616 617 if(new_folder_name == special_folders['Trash']){ 618 delete_msg = true; 619 } 620 selected_messages = get_selected_messages_search(); 621 622 if( preferences.use_local_messages == 1 && expresso_local_messages.isArchiving( selected_messages, folder ) ){ 608 623 alert( "Impossivel mover mensagens que estão ainda estão sendo arquivadas." ); 609 624 return; 610 625 } 611 612 var selected_messages = '';613 var temp_msg;614 var main_list = Element("tbody_box_"+getNumBoxFromTabId(currentTab)).childNodes;615 for (j = 0; j < main_list.length; j++) {616 var check_box = main_list[j].firstChild.firstChild;617 if(check_box && check_box.checked) {618 if (proxy_mensagens.is_local_folder(main_list[j].getAttribute('name'))) {619 alert(get_lang("You cant manipulate local messages on search"));620 return;621 }622 selected_messages += main_list[j].id + ',';623 }624 }625 selected_messages = selected_messages.substring(0,(selected_messages.length-1));626 626 var handler_move_search_msgs = function(data){ 627 627 if(!data || !data.msgs_number) 628 628 return; 629 629 else if(data.deleted) { 630 if (data.msgs_number.length == 1) 630 if(data.no_move && data.move) 631 alert(get_lang("Unable to remove the message (s) of shared folders which you do not have permission.")); 632 else if (data.msgs_number.length == 1) 631 633 write_msg(get_lang("The message was deleted.")); 632 634 else 633 635 write_msg(get_lang("The messages were deleted.")); 634 } 635 else{ 636 }else if(data.status == false && data.move ){ 637 alert(get_lang("Unable to remove the message (s) of shared folders which you do not have permission.")); 638 }else if(data.status == false){ 639 alert(get_lang("You don't have permission for this operation in this shared folder!")); 640 return false; 641 }else{ 636 642 if (data.msgs_number.length == 1) 637 643 write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); … … 640 646 } 641 647 648 if(data.no_move){ 649 var no_remove = data.no_move.split(','); 650 var continua = true; 651 642 652 selected_messages = selected_messages.split(","); 643 653 for (i = 0; i < selected_messages.length; i++){ 644 removeAll(selected_messages[i]); 645 } 654 for(j = 0; j < no_remove.length; j++) 655 if(selected_messages[i] == no_remove[j]) 656 continua = false; 657 if(continua) 658 removeAll(selected_messages[i]+'_s'+id_border); 659 continua = true; 660 } 661 }else{ 662 selected_messages = selected_messages.split(","); 663 for (i = 0; i < selected_messages.length; i++){ 664 removeAll(selected_messages[i]+'_s'+id_border); 665 666 } 667 } 668 646 669 // Update Box BgColor 647 670 var box = Element("tbody_box_"+getNumBoxFromTabId(currentTab)).childNodes; 648 if( main_list.length > 1){671 if(box.length > 1){ 649 672 updateBoxBgColor(box); 650 673 } 651 674 connector.purgeCache(); 652 675 676 677 if(remove_currente_folder != ""){ 678 var mail_msg = Element('tbody_box').childNodes; 679 remove_currente_folder = remove_currente_folder.substring(0,(remove_currente_folder.length-1)); 680 remove_currente_folder = remove_currente_folder.split(","); 681 for(i = 0; i < remove_currente_folder.length; i++) 682 removeAll(remove_currente_folder[i]); 683 684 // Update Box BgColor 685 var box = Element("tbody_box"); 686 if(box.childNodes.length > 0){ 687 updateBoxBgColor(box.childNodes); 688 } 689 if(folder == get_current_folder()){ 690 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - remove_currente_folder.length; 691 } 692 } 693 694 draw_tree_folders(); 653 695 EsearchE.refresh(); 654 696 } … … 660 702 selected_msg_array = selected_messages.split(","); 661 703 for (i = 0; i < selected_msg_array.length; i++){ 662 var tr = Element(selected_msg_array[i]); 663 if (tr.getAttribute('name') == new_folder) 704 var tr = Element(selected_msg_array[i]+'_s'+id_border); 705 if(tr.getAttribute('name') == current_folder) 706 remove_currente_folder += tr.id.replace(/_[a-zA-Z0-9]+/,"")+','; 707 if ((action == 'delete' && tr.getAttribute('name') == 'INBOX'+cyrus_delimiter+special_folders['Trash']) || !(parseInt(preferences.save_deleted_msg))) 664 708 { 709 msg_to_delete += ','+special_folders['Trash']+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); 710 } 711 else if (!(tr.getAttribute('name') == new_folder && action != 'delete')) 712 { 713 msg_to_move = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); 714 selected_param += ','+msg_to_move+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); 715 }else{ 665 716 write_msg(get_lang('At least one message have the same origin')); 666 717 return false; 667 718 } 668 trfolder = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name'));669 selected_param += ','+trfolder+';'+tr.id.replace(/_[a-zA-Z0-9]+/,"");670 719 } 671 720 } 672 721 else 673 722 { 674 var tr=Element(selected_messages); 675 if (tr.getAttribute('name') == new_folder) 676 { 723 var tr=Element(selected_messages+'_s'+id_border); 724 if(tr.getAttribute('name') == current_folder) 725 remove_currente_folder += tr.id.replace(/_[a-zA-Z0-9]+/,"")+','; 726 if((action == 'delete' && tr.getAttribute('name') == 'INBOX'+cyrus_delimiter+special_folders['Trash']) || !(parseInt(preferences.save_deleted_msg))){ 727 msg_to_delete = special_folders['Trash']+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); 728 }else if (!(tr.getAttribute('name') == new_folder && action != 'delete')){ 729 trfolder = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); 730 selected_param=trfolder+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); 731 }else{ 677 732 write_msg(get_lang('The origin folder and the destination folder are the same.')); 678 733 return false; 679 734 } 680 trfolder = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name'));681 selected_param=trfolder+';'+tr.id.replace(/_[a-zA-Z0-9]+/,"");682 735 } 683 736 var params = ""; 684 if (!new_folder && parseInt(preferences.save_deleted_msg)){ 737 if(msg_to_delete != "" && msg_to_move != ""){ 738 params += "&selected_messages_move="+url_encode(selected_param); 739 params += "&new_folder_move="+url_encode(new_folder); 740 params += "&new_folder_name_move="+url_encode(new_folder_name); 741 685 742 new_folder = 'INBOX'+cyrus_delimiter+trashfolder; 686 743 new_folder_name = trashfolder; 687 params = "&delete=true"; 688 } 689 690 params += "&selected_messages="+url_encode(selected_param); 691 if(new_folder && parseInt(preferences.save_deleted_msg)) { 744 params += "&selected_messages_delete="+url_encode(msg_to_delete); 745 params += "&new_folder_delete="+url_encode(new_folder); 746 cExecute ("$this.imap_functions.move_delete_search_messages", handler_move_search_msgs, params); 747 }else if(msg_to_delete != ""){ 748 new_folder = 'INBOX'+cyrus_delimiter+trashfolder; 749 new_folder_name = trashfolder; 750 params += "&delete=true"; 751 params += "&selected_messages="+url_encode(msg_to_delete); 752 params += "&new_folder="+url_encode(new_folder); 753 cExecute ("$this.imap_functions.move_search_messages", handler_move_search_msgs, params); 754 }else{ 755 params = "&selected_messages="+url_encode(selected_param); 756 params += "&delete=false"; 692 757 params += "&new_folder="+url_encode(new_folder); 693 758 params += "&new_folder_name="+url_encode(new_folder_name); 694 }695 759 cExecute ("$this.imap_functions.move_search_messages", handler_move_search_msgs, params); 760 } 696 761 } 697 762 else … … 902 967 } 903 968 969 function archive_search_msgs(folder_dest) { 970 971 var id_msgs = ""; 972 id_msgs = get_selected_messages_search(); 973 var msg_to_arquive = ""; 974 var messages = ""; 975 var id_border = currentTab.replace(/[a-zA-Z_]+/, ""); 976 977 if ( parseInt(id_msgs) <= 0 || id_msgs.length <= 0 ) 978 return write_msg(get_lang('No selected message.')); 979 980 if(folder_dest=='local_root' || folder_dest==null) //Caso seja o primeiro arquivamento... 981 folder_dest = 'local_Inbox'; 982 983 id_msgs = expresso_local_messages.checkArchived( id_msgs, folder_dest ); 984 985 if( !id_msgs ){ 986 write_msg( "Todas as mensagens já foram arquivadas anteriormente." ); 987 return; 988 } 989 990 document.getElementById("overlay").style.visibility = "visible"; 991 992 var handler_arquivar_mensagens = function(data) { 993 994 var msgs_info = []; 995 996 for( var i = 0; i < data.length; i++ ) 997 msgs_info[i] = connector.unserialize( data[i] ); 998 999 //vejo se já tinha mensagens locais 1000 var h = expresso_local_messages.has_local_mails(); 1001 1002 expresso_local_messages.insert_mails( msgs_info, folder_dest, function( s, f ){complete_archiving( s, f, h )} ); 1003 1004 document.getElementById("overlay").style.visibility = "hidden"; 1005 } 1006 1007 id_msgs = id_msgs.split(','); 1008 for (i = 0; i < id_msgs.length; i++){ 1009 var tr = Element(id_msgs[i]+'_s'+id_border); 1010 msg_to_arquive = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); 1011 messages += ','+msg_to_arquive+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); 1012 } 1013 1014 cExecute( "$this.imap_functions.get_info_msgs&messages=" + messages+"&folder="+folder_dest , handler_arquivar_mensagens ); 1015 } 1016 1017 904 1018 function archive_msgs(folder,folder_dest,id_msgs) { 905 1019 if(proxy_mensagens.is_local_folder(folder)) { … … 912 1026 } 913 1027 914 if(!id_msgs) 1028 if(!id_msgs){ 1029 if (currentTab != 0 && currentTab.indexOf("search_") >= 0){ 1030 archive_search_msgs(folder_dest); 1031 return; 1032 }else 915 1033 id_msgs = get_selected_messages(); 1034 } 916 1035 917 1036 if ( parseInt(id_msgs) <= 0 || id_msgs.length <= 0 ) … … 1002 1121 update_menu(); 1003 1122 } 1123 1124 function action_msg_selected_from_search(aba, evento){ 1125 if(evento == "delete") 1126 move_search_msgs(aba,'INBOX/Trash', 'Trash', 'delete'); 1127 } 1128 1129 function get_all_messages_search(){ 1130 var aba = document.getElementById('content_id_'+currentTab); 1131 var messages = ""; 1132 jQuery(function() { 1133 jQuery("#"+aba.id+" tr").each(function(i, main_list) { 1134 messages += main_list.id.replace(/_[a-zA-Z0-9]+/,"") + ',' ; 1135 }); 1136 1137 }); 1138 if(messages.indexOf(',') == 0) 1139 messages = messages.substring(1,(messages.length)); 1140 return messages.substring(0,(messages.length-1)); 1141 } 1142 1143 function get_selected_messages_search(){ 1144 var aba = document.getElementById('content_id_'+currentTab); 1145 var selected_messages = ""; 1146 jQuery(function() { 1147 jQuery("#"+aba.id+" tr").each(function(i, main_list) { 1148 var check_box = main_list.firstChild.firstChild; 1149 if(check_box && check_box.checked) { 1150 selected_messages += main_list.id.replace(/_[a-zA-Z0-9]+/,"") + ',' ; 1151 }; 1152 }); 1153 1154 }); 1155 if (selected_messages != ""){ 1156 if(selected_messages.indexOf(',') == 0) 1157 selected_messages = selected_messages.substring(1,(selected_messages.length)); 1158 selected_messages = selected_messages.substring(0,(selected_messages.length-1)); 1159 return selected_messages; 1160 }else{ 1161 return false; 1162 } 1163 } 1164 1004 1165 1005 1166 function get_selected_messages(){ … … 1517 1678 } 1518 1679 } 1519 RichTextEditor.setInitData(new_border_ID,'<div><br type="_moz"></div>' + data.body); 1680 RichTextEditor.setInitData(new_border_ID, data.body, 'edit'); 1681 1520 1682 break; 1521 1683 default: … … 2404 2566 } 2405 2567 2568 function print_search_msg(){ 2569 var folder = "<h2> Resultado da Pesquisa <font color=\"#505050\" face=\"Verdana\" size=\"1\"></h2>"; 2570 msgs_number = get_selected_messages_search(); 2571 var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML; 2572 var id_border = currentTab.replace(/[a-zA-Z_]+/, ""); 2573 2574 if(msgs_number){ 2575 msgs_number = msgs_number.split(","); 2576 var tbody = ""; 2577 for(var i = 0; i < msgs_number.length; i++){ 2578 tbody += "<tr id=\""+msgs_number[i]+"_s"+id_border+"\" class=\"tr_msg_unread tr_msg_read2\">"+ Element(msgs_number[i]+'_s'+id_border).innerHTML+"</tr>"; 2579 } 2580 }else{ 2581 msgs_number = get_all_messages_search(); 2582 msgs_number = msgs_number.split(","); 2583 var tbody = ""; 2584 for(var i = 0; i < msgs_number.length; i++){ 2585 tbody += "<tr id=\""+msgs_number[i]+"_s"+id_border+"\" class=\"tr_msg_unread tr_msg_read2\">"+ Element(msgs_number[i]+'_s'+id_border).innerHTML+"</tr>"; 2586 } 2587 } 2588 2589 2590 var print_width = screen.width - 200; 2591 var x = ((screen.width - print_width) / 2); 2592 var y = ((screen.height - 400) / 2) - 35; 2593 var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); 2594 seekDot = (is_ie ? /width=24/gi : /width="24"/gi); 2595 2596 var thead = "<tr class=\"message_header\"><td id=\"message_header_FOLDER_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">Pasta</td><td id=\"message_header_SORTFROM_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">De</td><td id=\"message_header_SORTSUBJECT_0\" class=\"th_resizable\" align=\"left\" width=\"*\">Assunto</td><td id=\"message_header_SORTARRIVAL_0\" class=\"th_resizable\" align=\"center\" width=\"11%\"><b>Data</b><img src=\"templates/default/images/arrow_descendant.gif\"></td><td id=\"message_header_SORTSIZE_0\" class=\"th_resizable\" align=\"left\" width=\"11%\">Tamanho</td></tr>"; 2597 tbody = tbody.replace(seekDot, "style='display:none'"); 2598 seekDot = (is_ie ? /width=16/gi : /width="16"/gi); 2599 2600 tbody = tbody.replace(seekDot, "style='display:none'"); 2601 seekDot = (is_ie ? /width=12/gi : /width="12"/gi); 2602 2603 tbody = tbody.replace(seekDot, "style='display:none'"); 2604 while (1){ 2605 try{ 2606 window_print.document.open(); 2607 var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>' 2608 + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>' 2609 + cabecalho + '</h4><hr>' 2610 + '<h2>'+folder+'</h2><hr/><blockquote><font size="2">' 2611 + '<table width="100%" cellpadding="0" cellspacing="0">' 2612 + '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>' 2613 + '</table></font></blockquote></body></html>'; 2614 window_print.document.write(html); 2615 window_print.document.close(); 2616 break; 2617 } 2618 catch(e){ 2619 //alert(e.message); 2620 } 2621 } 2622 window_print.document.close(); 2623 window_print.print(); 2624 } 2625 2406 2626 function print_all(){ 2407 2627 if (openTab.type[currentTab] == 2) 2408 2628 return print_msg(current_folder,currentTab.substr(0,currentTab.indexOf("_r")),currentTab); 2409 2629 2630 if (currentTab != 0 && currentTab.indexOf("search_") >= 0){ 2631 return print_search_msg(); 2632 } 2633 2410 2634 var folder= Element('border_id_0').innerHTML; 2411 2635 //var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML; … … 2631 2855 return; 2632 2856 } 2633 var msgs_to_export = this.get_selected_messages(); 2634 2857 var search = false; 2858 var id_border = currentTab.replace(/[a-zA-Z_]+/, ""); 2859 2860 if(currentTab != 0 && currentTab.indexOf("search_") >= 0){ 2861 var msgs_to_export = this.get_selected_messages_search(); 2862 if (!msgs_to_export){ 2863 write_msg(get_lang('No selected message.')); 2864 return; 2865 } 2866 var selected_param = ""; 2867 msgs_to_export = msgs_to_export.split(","); 2868 search = true; 2869 for (i = 0; i < msgs_to_export.length; i++){ 2870 var tr = Element(msgs_to_export[i]+'_s'+id_border); 2871 msg_to_move = (tr.getAttribute('name') == null?get_current_folder():tr.getAttribute('name')); 2872 selected_param += ','+msg_to_move+';'+tr.id.replace(/_[a-zA-Z0-9]+/,""); 2873 } 2874 }else{ 2875 var msgs_to_export = this.get_selected_messages(); 2876 } 2635 2877 var handler_export_all_selected_msgs = function(data){ 2636 2878 … … 2647 2889 } 2648 2890 2649 if (msgs_to_export) { 2891 if(search){ 2892 cExecute ("$this.exporteml.makeAll", handler_export_all_selected_msgs, "folder=false&msgs_to_export="+selected_param); 2893 }else if (msgs_to_export) { 2650 2894 cExecute ("$this.exporteml.makeAll", handler_export_all_selected_msgs, "folder="+get_current_folder()+"&msgs_to_export="+msgs_to_export); 2651 2895 write_msg(get_lang('You must wait while the messages will be exported...')); … … 2770 3014 if(currentTab.toString().indexOf("_r") != -1) 2771 3015 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 2772 else if(msgs_number == 'selected') 3016 else if(currentTab != 0 && currentTab.indexOf("search_") >= 0){ 3017 var content_search = document.getElementById('content_id_'+currentTab); 'INBOX/Trash', 'Trash', 3018 move_search_msgs('content_id_'+currentTab, 'INBOX'+cyrus_delimiter+special_folders['Spam'], special_folders['Spam']); 3019 refresh(); 3020 return; 3021 }else if(msgs_number == 'selected') 2773 3022 msgs_number = get_selected_messages(); 2774 3023 -
trunk/expressoMail1_2/js/messages_controller.js
r5158 r5172 47 47 if (msgs_number == 'selected') 48 48 msgs_number = get_selected_messages(); 49 if(currentTab != 0 && currentTab.indexOf("search_") >= 0){ 50 var content_search = document.getElementById('content_id_'+currentTab); 51 action_msg_selected_from_search(content_search.id, 'delete'); 52 refresh(); 53 //draw_tree_folders(); 54 //update_local_box(); 55 return; 56 } 57 49 58 if (!this.is_local_folder(folder)){ 50 59 delete_msgs(folder, msgs_number, border_ID); -
trunk/expressoMail1_2/js/search.js
r5134 r5172 108 108 Element("check_all_msg").checked = true; 109 109 EsearchE.all_mailboxes(); 110 EsearchE.func_search(value );110 EsearchE.func_search(value, null, 'SORTDATE_REVERSE'); 111 111 } 112 112 … … 662 662 } 663 663 else { 664 if(isNaN(numBox)){ 665 var aux = numBox.split("_"); 666 numBox = parseInt(aux[0]) + 1; 667 }else 664 668 numBox++; 665 669 -
trunk/expressoMail1_2/setup/phpgw_pt-br.lang
r5158 r5172 727 727 ERROR saving your message over quota. expressoMail1_2 pt-br Mensagem não salva pois excede a quota. 728 728 Display default fields on the quick search screen? preferences pt-br Mostrar campos padrão na tela de busca rápida de contatos? 729 No mail expressoMail1_2 pt-br Sem e-mail 730 It is not possible to add this contact as a recipient because it does not have email expressoMail1_2 pt-br Não é possível adicionar esse contato como destinatário, porque ele não tem e-mail 731 Unable to remove the message (s) of shared folders which you do not have permission. expressoMail1_2 pt-br Não foi possível remover as mensagens da(s) pastas compartilhadas as quais você não possui permissão. 729 732 -
trunk/expressoMail1_2/templates/default/index.tpl
r5134 r5172 153 153 </fieldset> 154 154 <input class="button" type="button" value="Buscar" onClick="buscaContato(busca.value);"/> 155 <input class="button" type="button" value="?" onClick="show_help()"/>155 <input class="button" type="button" onClick="show_help()" style="background-image: url('./templates/default/images/information.png'); background-repeat: no-repeat;"/> 156 156 </div> 157 157 </div> … … 164 164 <div id="slider" style="width: 448px;"></div> 165 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"/>166 <label for="amount" style="padding-left: 6px;">{lang_page}: </label> 167 <input type="text" id="amount-text" style="padding-left: 3px; border:0; font-weight:bold; width: 175px;" readonly="true"/> 168 168 </p> 169 169 </div> -
trunk/expressoMail1_2/templates/default/quick_search.css
r5134 r5172 58 58 .expressomail-qs-container .ui-widget button { border: 0 solid; } 59 59 60 .expressomail-qs-container .menu-control { float:right; margin-left: 380px; position: absolute; z-index: 100; padding-top:5px;}60 .expressomail-qs-container .menu-control { float:right; margin-left:400px; position: absolute; z-index: 100; padding-top:5px;} 61 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 62 .expressomail-qs-container .details-container { width:300px;height:246px; float:right; margin: 5px 0;} -
trunk/phpgwapi/templates/default/css/base.css
r5141 r5172 83 83 } 84 84 85 #ul85 ul 86 86 { 87 87 list-style-image: url( "../images/orange-ball.png" ); -
trunk/prototype/app/plugins/treeview/jquery.treeview.css
r5136 r5172 70 70 .filetree li { padding: 3px 0 2px 16px; } 71 71 .filetree span.folder, .filetree span.file { padding: 1px 0 1px 16px; display: block; } 72 .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; } 72 .filetree span.folder { background: url(images/folder.gif) 0 0 no-repeat; cursor: pointer;} 73 .filetree span.folder:hover {color: red; cursor: pointer;} 74 .filetree span.folder.selected {font-weight: bold; cursor: pointer; } 73 75 .filetree li.expandable span.folder { background: url(images/folder-closed.gif) 0 0 no-repeat; } 74 76 .filetree span.file { background: url(images/file.gif) 0 0 no-repeat; } -
trunk/prototype/modules/attach_message/attach_message.js
r5136 r5172 253 253 target = target.parent(); 254 254 255 if (target.attr('id') == "foldertree") return; 256 255 257 var targetId = target.attr('id'); 256 var child = target.find('span'); 258 var child = target.find('.folder'); 259 260 $('.filetree span.folder.selected').removeClass('selected'); 261 if(!target.is('#foldertree > .expandable, #foldertree > .collapsable')) 262 $(target).children('.folder').addClass('selected'); 257 263 258 264 selectedFolder = { -
trunk/services/class.db.php
r5130 r5172 110 110 $query .= ' where ' 111 111 . 'A.id_owner=' . $_SESSION['phpgw_info']['expressomail']['user']['account_id'] 112 . ' and lower(to_ascii(names_ordered)) LIKE lower(to_ascii(\'%' . $search_for . '%\'))'; 112 . ' and lower(translate(names_ordered, \'áàâãäéèêëíìïóòôõöúùûüÁÀÂÃÄÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜçÇñÑ\',\'aaaaaeeeeiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN\'))' 113 . ' LIKE lower(translate(\'%' . $search_for . '%\', \'áàâãäéèêëíìïóòôõöúùûüÁÀÂÃÄÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜçÇñÑ\',\'aaaaaeeeeiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN\'))'; 113 114 114 115 if (!$this->db->query($query)) … … 251 252 } 252 253 254 function search_groups($search_for) 255 { 256 $result = array(); 257 $query = 'select' 258 . ' G.oid,' 259 . ' G.title,' 260 . ' G.short_name'; 261 $query .= ' from' 262 . ' phpgw_cc_groups G'; 263 $query .= ' where ' 264 . ' G.owner=' . $_SESSION['phpgw_info']['expressomail']['user']['account_id'] 265 . ' and lower(translate(G.title, \'áàâãäéèêëíìïóòôõöúùûüÁÀÂÃÄÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜçÇñÑ\',\'aaaaaeeeeiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN\'))' 266 . ' LIKE lower(translate(\'%' . $search_for . '%\', \'áàâãäéèêëíìïóòôõöúùûüÁÀÂÃÄÉÈÊËÍÌÏÓÒÔÕÖÚÙÛÜçÇñÑ\',\'aaaaaeeeeiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN\'))'; 267 268 if (!$this->db->query($query)) 269 return null; 270 271 while($this->db->next_record()) 272 $result[] = $this->db->row(); 273 274 $all_contacts = array(); 275 foreach( $result as $i => $object ) 276 { 277 if ( ! array_key_exists( $object[ 'oid' ], $all_contacts ) ) 278 $all_contacts[ $object[ 'oid' ] ] = array( 279 'title' => '', 280 'short_name' => '', 281 ); 282 $all_contacts[ $object[ 'oid' ] ]['title'] = $object['title']; 283 $all_contacts[ $object[ 'oid' ] ]['short_name'] = $object['short_name']; 284 } 285 return array_values($all_contacts); 286 } 253 287 } 254 288
Note: See TracChangeset
for help on using the changeset viewer.