Changeset 1599 for trunk/contactcenter
- Timestamp:
- 11/06/09 09:58:04 (14 years ago)
- Location:
- trunk/contactcenter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contactcenter/inc/class.ui_data.inc.php
r1517 r1599 14 14 \***************************************************************************/ 15 15 16 16 17 17 class ui_data 18 18 { … … 20 20 'data_manager' => true, 21 21 ); 22 22 23 23 var $bo; 24 24 var $typeContact; 25 25 26 26 var $page_info = array( 27 27 'n_cards' => 20, … … 34 34 'actual_catalog' => false 35 35 ); 36 36 37 37 /*! 38 38 39 39 @function ui_data 40 40 @abstract The constructor. Sets the initial parameters and loads 41 41 the data saved in the session 42 42 @author Raphael Derosso Pereira 43 43 44 44 */ 45 45 function ui_data() … … 47 47 $temp = $GLOBALS['phpgw']->session->appsession('ui_data.page_info','contactcenter'); 48 48 $temp2 = $GLOBALS['phpgw']->session->appsession('ui_data.all_entries','contactcenter'); 49 49 50 50 $this->bo = CreateObject('contactcenter.bo_contactcenter'); 51 51 52 52 if ($temp) 53 53 { … … 59 59 $this->all_entries = $temp2; 60 60 } 61 61 62 62 if (!$this->page_info['actual_catalog']) 63 63 { … … 65 65 $this->page_info['actual_catalog'] = $catalogs[0]; 66 66 } 67 68 $this->page_info['actual_catalog'] =& $this->bo->set_catalog($this->page_info['actual_catalog']); 69 67 68 $this->page_info['actual_catalog'] =& $this->bo->set_catalog($this->page_info['actual_catalog']); 69 70 70 71 if($this->page_info['actual_catalog']['class'] == 'bo_group_manager') 71 72 $this -> typeContact = 'groups'; 73 /**rev 104**/ 72 74 else if($this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager') 73 75 $this -> typeContact = 'shared_groups'; 74 76 else if($this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager') 75 77 $this -> typeContact = 'shared_contacts'; 78 /******/ 76 79 else 77 80 $this -> typeContact = 'contacts'; … … 79 82 80 83 /*! 81 84 82 85 @function index 83 86 @abstract Builds the Main Page 84 87 @author Raphael Derosso Pereira 85 88 @author Jonas Goes 86 87 */ 89 90 */ 88 91 function index() 89 { 92 { 90 93 if(!@is_object($GLOBALS['phpgw']->js)) 91 94 { … … 96 99 $GLOBALS['phpgw']->js->validate_file('venus','jsStructUtil'); 97 100 $GLOBALS['phpgw']->js->validate_file('venus','cssUtil'); 98 101 99 102 // $GLOBALS['phpgw']->js->set_onload('setTimeout(\'updateCards()\',1000)'); 100 103 $GLOBALS['phpgw']->common->phpgw_header(); 101 104 102 105 $GLOBALS['phpgw']->template->set_file(array('index' => 'index.tpl')); 103 106 $GLOBALS['phpgw']->template->set_var('cc_root_dir', $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/'); 104 107 105 108 /* Quick Add */ 106 109 $GLOBALS['phpgw']->template->set_var('cc_qa_alias',lang('Alias').':'); … … 113 116 $GLOBALS['phpgw']->template->set_var('cc_qa_close',lang('Close')); 114 117 /* End Quick Add */ 115 118 116 119 $cc_css_file = $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/styles/cc.css'; 117 120 $cc_card_image_file = $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/templates/default/images/card.png'; … … 119 122 $GLOBALS['phpgw']->template->set_var('cc_dtree_css', $cc_dtree_file); 120 123 $GLOBALS['phpgw']->template->set_var('cc_card_image',$cc_card_image_file); 121 124 122 125 $GLOBALS['phpgw']->template->set_var('cc_personal',lang('Personal')); 123 126 127 /***rev 104***/ 128 //$GLOBALS['phpgw']->template->set_var('cc_full_add',lang('Full Add')); 124 129 $GLOBALS['phpgw']->template->set_var('cc_full_add_button',lang('Full Add')); 125 $GLOBALS['phpgw']->template->set_var('cc_full_add_button_sh',lang('Full Add Shared')); 130 /******/ 131 $GLOBALS['phpgw']->template->set_var('cc_full_add_button_sh',lang('Full Add Shared')); 126 132 $GLOBALS['phpgw']->template->set_var('cc_reset',lang('Reset')); 127 133 128 134 $GLOBALS['phpgw']->template->set_var('cc_personal_data',lang('Personal Data')); 129 135 $GLOBALS['phpgw']->template->set_var('cc_addresses',lang('Addresses')); … … 134 140 $GLOBALS['phpgw']->template->set_var('cc_catalogs',lang('Catalogues')); 135 141 $GLOBALS['phpgw']->template->set_var('cc_group_add',lang('Group Add')); 136 142 137 143 /* Panel */ 138 144 $GLOBALS['phpgw']->template->set_var('cc_panel_new',lang('New').'...'); … … 142 148 $GLOBALS['phpgw']->template->set_var('cc_btn_import_export', lang('Import/Export')); 143 149 $GLOBALS['phpgw']->template->set_var('cc_btn_new', lang("New...")); 144 150 145 151 $GLOBALS['phpgw']->template->set_var('cc_panel_search_found',lang('Showing found entries')); 146 152 $GLOBALS['phpgw']->template->set_var('cc_panel_first_page',lang('First Page')); … … 150 156 $GLOBALS['phpgw']->template->set_var('cc_all',lang('all')); 151 157 /* End Panel */ 152 158 153 159 /* Messages */ 160 /**rev 104**/ 154 161 $GLOBALS['phpgw']->template->set_var('cc_msg_not_allowed',lang('Not Allowed')); 155 $GLOBALS['phpgw']->template->set_var('cc_msg_unavailable',lang('Unavailable function')); 162 $GLOBALS['phpgw']->template->set_var('cc_msg_unavailable',lang('Unavailable function')); 163 /*****/ 156 164 $GLOBALS['phpgw']->template->set_var('cc_msg_no_cards',lang('No Cards')); 157 165 $GLOBALS['phpgw']->template->set_var('cc_msg_err_no_room',lang('No Room for Cards! Increase your browser area.')); … … 167 175 $GLOBALS['phpgw']->template->set_var('cc_empty',lang('Empty')); 168 176 /* End Messages */ 169 177 170 178 $GLOBALS['phpgw']->template->set_var('cc_results',lang('Results')); 171 179 $GLOBALS['phpgw']->template->set_var('cc_is_my',lang('Is My')); … … 173 181 $GLOBALS['phpgw']->template->set_var('cc_btn_search',lang('Search')); 174 182 $GLOBALS['phpgw']->template->set_var('cc_add_relation',lang('Add Relation')); 175 $GLOBALS['phpgw']->template->set_var('cc_del_relation',lang('Remove Selected Relations')); 183 $GLOBALS['phpgw']->template->set_var('cc_del_relation',lang('Remove Selected Relations')); 176 184 $GLOBALS['phpgw']->template->set_var('cc_msg_group',lang('Group')); 177 185 $GLOBALS['phpgw']->template->set_var('cc_msg_contact_full',lang('Contact [Full]')); … … 214 222 $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_cellphone', lang('Corporative Cellphone')); 215 223 $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_fax', lang('Corporative Fax')); 216 $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_pager', lang('Corporative Pager')); 224 $GLOBALS['phpgw']->template->set_var('cc_msg_corporative_pager', lang('Corporative Pager')); 217 225 $GLOBALS['phpgw']->template->set_var('cc_msg_work', lang('Work')); 218 226 $GLOBALS['phpgw']->template->set_var('cc_msg_fax', lang('Fax')); … … 234 242 $GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.')); 235 243 $GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name')); 236 244 237 245 if($GLOBALS['phpgw_info']['server']['personal_contact_type']=='True'){ 238 246 $GLOBALS['phpgw']->template->set_var('cc_contact_type', 'advanced'); … … 241 249 } 242 250 $GLOBALS['phpgw']->template->parse('out','index'); 243 251 244 252 $api = CreateObject('contactcenter.ui_api'); 245 253 $main = $api->get_full_add(); … … 252 260 } 253 261 254 262 255 263 /*! 256 264 257 265 @function data_manager 258 @abstract Calls the right method and passes to it the right 266 @abstract Calls the right method and passes to it the right 259 267 parameters 260 268 @author Raphael Derosso Pereira 261 269 262 270 */ 263 271 function data_manager() … … 268 276 case 'set_n_cards': 269 277 return $this->set_n_cards((int)$_GET['ncards']); 270 271 case 'get_cards_data': 278 279 case 'get_cards_data': 272 280 $ids = false; 273 281 // To support ldap catalogs using accentuation … … 276 284 $ids = utf8_decode($this->search($_POST['data'])); 277 285 } 278 286 279 287 if(isset($_SESSION['ids'])) 280 288 $ids = $_SESSION['ids']; 281 282 return $this->get_cards_data($_POST['letter'], $_POST['page'], $ids); 289 290 return $this->get_cards_data($_POST['letter'], $_POST['page'], $ids); 291 283 292 case 'get_cards_data_get': 284 293 return $this->get_cards_data($_GET['letter'], $_GET['page'], unserialize(str_replace('\\"','"',$_GET['ids']))); … … 291 300 echo $this->get_visible_all_ldap(); 292 301 return; 293 302 294 303 /* Catalog Methods */ 295 304 case 'set_catalog': 296 305 return $this->set_catalog($_GET['catalog']); 297 306 298 307 case 'get_catalog_tree': 299 308 echo serialize($this->get_catalog_tree($_GET['level'])); … … 307 316 echo serialize($this->get_catalog_participants_list($_POST['id'])); 308 317 return; 309 318 /**rev 104**/ 310 319 case 'get_catalog_participants_group': 311 320 echo serialize($this->get_catalog_participants_group($_POST['id'])); 312 321 return; 313 322 /***/ 314 323 case 'get_catalog_add_contact': 315 324 // To support ldap catalogs with accentuation 316 325 echo serialize($this->get_catalog_add_contact(utf8_decode($_POST['id']))); 317 326 return; 318 327 319 328 /* Full Add Methods */ 320 329 case 'get_full_data': 330 //return $this->get_full_data($_GET['id']); 331 /**rev 104**/ 321 332 return $this->get_full_data($_GET['id'],$_GET['catalog']); 322 333 /****/ 334 323 335 case 'get_group': 324 336 return $this->get_group_data($_GET['id'],isset($_GET['shared_from'])?$_GET['shared_from']:null); 325 337 326 338 case 'get_contact_full_add_const': 327 339 return $this->get_contact_full_add_const(); … … 338 350 case 'get_states': 339 351 return $this->get_states($_GET['country']); 340 352 341 353 case 'get_cities': 342 354 return $this->get_cities($_GET['country'], $_GET['state'] ? $_GET['state'] : null); 343 344 355 356 345 357 /* Other Methods */ 346 case 'quick_add': 358 case 'quick_add': 347 359 return $this->quick_add($_POST['add']); 348 349 case 'add_group': 360 361 case 'add_group': 350 362 return $this->add_group($_POST['add']); 351 363 352 364 case 'remove_entry': 353 365 return $this->remove_entry((int)$_GET['remove']); 354 366 355 367 case 'remove_all_entries': 356 368 return $this->remove_all_entries(); 357 369 358 370 case 'remove_group': 359 360 return $this->remove_group((int)$_GET['remove']); 371 372 return $this->remove_group((int)$_GET['remove']); 361 373 362 374 case 'search': … … 397 409 398 410 /*! 399 411 400 412 @function set_n_cards 401 413 @abstract Informs the class the number of cards the page can show 402 414 @author Raphael Derosso Pereira 403 415 404 416 @param integer $n_cards The number of cards 405 417 406 418 */ 407 419 function set_n_cards($n_cards) … … 412 424 echo 1; 413 425 } 414 426 415 427 $this->save_session(); 416 428 } 417 429 418 430 /*! 419 431 420 432 @function set_catalog 421 433 @abstract Sets the current catalog selected by the user 422 434 @author Raphael Derosso Pereira 423 435 424 436 @param string $id_catalog The sequence of IDs to reach the catalog 425 437 separated by commas 426 438 427 439 */ 428 440 function set_catalog($id_catalog) … … 430 442 $id_catalog = str_replace('\\"', '"', $id_catalog); 431 443 $temp =& $this->bo->set_catalog($id_catalog); 432 444 433 445 if ($temp) 434 446 { … … 437 449 $this->page_info['actual_catalog'] =& $temp; 438 450 $this->save_session(); 439 451 440 452 $catalog_info = $this->bo->get_branch_by_level($this->bo->catalog_level[0]); 441 453 442 454 if ($catalog_info['class'] === 'bo_global_ldap_catalog' || 443 455 $catalog_info['class'] === 'bo_catalog_group_catalog') … … 449 461 $perms = 15; 450 462 } 451 463 452 464 echo serialize(array( 453 465 'status' => 'ok', … … 457 469 return; 458 470 } 459 471 460 472 echo serialize(array( 461 473 'status' => 'ok', … … 463 475 )); 464 476 } 465 466 477 478 467 479 /*! 468 480 469 481 @function get_catalog_tree 470 482 @abstract Returns the JS serialized array to used as the tree 471 483 level 472 484 @author Raphael Derosso Pereira 473 @author M ário César Kolling (error messages and timeout)474 475 @param (string) $level The level to be taken 476 485 @author Mï¿œrio Cï¿œsar Kolling (error messages and timeout) 486 487 @param (string) $level The level to be taken 488 477 489 */ 478 490 function get_catalog_tree($level) … … 483 495 484 496 $parent = '0'; 485 497 486 498 if (!($tree = $this->bo->get_catalog_tree($level))) 487 499 { … … 515 527 } 516 528 } 517 529 518 530 $folderImageDir = $GLOBALS['phpgw']->common->image('contactcenter','globalcatalog-mini.png'); 519 531 $folderImageDir = substr($folderImageDir, 0, strpos($folderImageDir, 'globalcatalog-mini.png')); 520 532 521 533 // Deals with error messages from the server and returns them to the browser 522 534 if ($tree['msg']) … … 546 558 } 547 559 } 548 560 549 561 /*! 550 562 551 563 @function get_actual_catalog 552 564 @abstract Returns the actual selected Catalog … … 555 567 */ 556 568 function get_actual_catalog() 557 { 569 { 558 570 $level = $this->bo->get_level_by_branch($this->bo->get_actual_catalog(), $this->bo->tree['branches'], '0'); 559 571 560 572 if ($level) 561 573 { … … 571 583 ); 572 584 } 573 585 574 586 /*! 575 587 576 588 @function get_cards_data 577 589 @abstract Returns the information that is placed on the cards 578 590 @author Raphael Derosso Pereira 579 591 580 592 @param string $letter The first letter to be searched 581 @param (int) $page The page to be taken 593 @param (int) $page The page to be taken 582 594 @param (str) $ids The ids to be taken in case of search 583 595 … … 588 600 { 589 601 if( $ids ) 590 $_SESSION['ids'] = $ids; 602 $_SESSION['ids'] = $ids; 591 603 592 604 // It's an external catalog? … … 594 606 //echo $page."\n"; 595 607 if ($letter !== 'search' and ($letter != $this->page_info['actual_letter'] or 596 ($letter == $this->page_info['actual_letter'] and $page == $this->page_info['actual_page']) or 608 ($letter == $this->page_info['actual_letter'] and $page == $this->page_info['actual_page']) or 597 609 $this->page_info['changed'])) 598 610 { 599 611 unset($ids); 600 612 $this->page_info['changed'] = false; 613 601 614 switch ($this->page_info['actual_catalog']['class']) 602 615 { 616 /**rev 104**/ 603 617 case 'bo_shared_people_manager': 618 /****/ 604 619 case 'bo_people_catalog': 605 620 $field_name = 'id_contact'; 621 606 622 if ($letter !== 'number') 607 623 { … … 611 627 'type' => 'iLIKE', 612 628 'value' => $letter !== 'all' ? $letter.'%' : '%' 613 ) 629 /**rev 104**/ 630 /* ), 631 1 => array( 632 'field' => 'contact.id_owner', 633 'type' => '=', 634 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 635 */ 636 ) 614 637 ); 615 638 … … 617 640 $so_contact = CreateObject('contactcenter.so_contact', $GLOBALS['phpgw_info']['user']['account_id']); 618 641 $relacionados = $so_contact->get_relations(); 619 620 $perms_relacao = array(); 642 643 $perms_relacao = array(); 621 644 622 645 foreach($relacionados as $uid_relacionado => $tipo_relacionamento) { … … 650 673 $n=$this->bo->catalog->src_info['dn']; 651 674 $apenasThese = array("cn","uidnumber","uid"); 652 $r = ldap_search($s,$n, $filtro,$apenasThese); 675 $r = ldap_search($s,$n, $filtro,$apenasThese); 653 676 $infos = ldap_get_entries($s, $r); 654 ldap_close($s); 677 ldap_close($s); 655 678 for($z = 0; $z < $infos['count']; $z++) { 656 679 $prop_names[$infos[$z]['uidnumber'][0]] = array("cn" => $infos[$z]['cn'][0], "uid" => $infos[$z]['uid'][0]); … … 666 689 ); 667 690 } 691 /****/ 692 668 693 } 669 694 else … … 725 750 ), 726 751 ), 752 /**rev 104**/ 753 /* ), 754 1 => array( 755 'field' => 'contact.id_owner', 756 'type' => '=', 757 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 758 ), 759 */ 727 760 ) 728 761 ); … … 736 769 ); 737 770 } 738 739 771 /*****/ 772 740 773 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 741 774 742 775 $find_other[0] = array( 776 /**rev 104**/ 777 //'offset' => (($page-1)*$this->page_info['n_cards']), 778 //'limit' => $this->page_info['n_cards'], 779 /*****/ 743 780 'order' => 'contact.names_ordered' 744 781 ); 745 782 746 783 break; 747 784 748 785 case 'bo_global_ldap_catalog': 749 786 750 787 $field_name = 'id_contact'; 751 788 … … 760 797 /* 761 798 * Restrict the returned contacts in a "first letter" search 799 /**rev 104 762 800 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 763 801 * phpgwAccountVisible != -1 … … 767 805 'type' => '=', 768 806 'value' => 'phpgwAccount' 807 /**rev 104**/ 808 //),/* 769 809 ), 810 /****/ 770 811 2 => array( 771 812 'field' => 'contact.account_status', 772 813 'type' => 'iLIKE', 773 814 'value' => '%' 815 /**rev 104**/ 816 //),*/ 817 //2 => array( 774 818 ), 775 819 3 => array( 820 /*****/ 776 821 'field' => 'contact.account_visible', 777 822 'type' => '!=', 778 823 'value' => '-1' 824 /**rev 104**/ 825 /* ), 826 3 => array( 827 'field' => 'contact.object_class', 828 'type' => '=', 829 'value' => 'inetOrgPerson' 830 ), 831 */ 779 832 ) 833 /*****/ 834 780 835 ); 781 836 // If not external catalog get only phpgwAccountType = u ou l … … 795 850 'type' => '=', 796 851 'value' => 'i' 852 /**rev 104**/ 797 853 ), 798 854 2 => array( 799 855 'field' => 'contact.account_type', 800 856 'type' => '=', 857 /****/ 801 858 'value' => 'l' 859 /**rev 104**/ 802 860 ), 803 861 3 => array( … … 805 863 'type' => '=', 806 864 'value' => 'g' 865 /***/ 807 866 ) 808 867 ) … … 815 874 /* 816 875 * Restrict the returned contacts in a "first number" search 876 /**rev 104 817 877 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 818 878 * phpgwAccountVisible != -1 … … 822 882 'type' => '=', 823 883 'value' => 'phpgwAccount' 884 /**rev 104**/ 885 //),/* 824 886 ), 887 /****/ 825 888 1 => array( 826 889 'field' => 'contact.account_status', 827 890 'type' => 'iLIKE', 828 891 'value' => '%' 892 /**rev 104**/ 893 //),*/ 894 //1 => array( 829 895 ), 830 896 2 => array( 897 /*****/ 831 898 'field' => 'contact.account_visible', 832 899 'type' => '!=', 833 900 'value' => '-1' 834 901 ), 902 /**rev 104**/ 903 /* 2 => array( 904 'field' => 'contact.object_class', 905 'type' => '=', 906 'value' => 'inetOrgPerson' 907 ), 908 */ 909 /****/ 835 910 3 => array( 836 911 'type' => 'branch', … … 905 980 'field' => 'contact.account_type', 906 981 'type' => '=', 982 /**rev 104**/ 983 //'value' => 'g' 984 //); 985 //1 => array( 907 986 'value' => 'i' 908 987 ), 909 988 2 => array( 989 /****/ 910 990 'field' => 'contact.account_type', 911 991 'type' => '=', 912 992 'value' => 'l' 993 /**rev 104**/ 913 994 ), 914 995 3 => array( … … 917 998 'value' => 'g' 918 999 ) 919 1000 /****/ 920 1001 ) 921 1002 ); … … 928 1009 // for non-external catalogs, used to restrict the attributes used in filters 929 1010 $find_field[0] = array('contact.id_contact','contact.names_ordered','contact.account_type', 930 'contact.object_class', /*'contact.account_status',*/'contact.account_visible');1011 'contact.object_class','contact.account_visible'); 931 1012 } 932 1013 else … … 936 1017 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 937 1018 } 938 1019 939 1020 $find_other[0] = array( 940 1021 //'offset' => (($page-1)*$this->page_info['n_cards']), … … 942 1023 'order' => 'contact.names_ordered' 943 1024 ); 944 1025 945 1026 break; 946 1027 947 1028 case 'bo_company_manager': 948 1029 $field_name = 'id_company'; 949 1030 950 1031 $find_field[0] = array('company.id_company','company.company_name'); 951 1032 952 1033 $find_other[0] = array( 953 1034 //'offset' => (($page-1)*$this->page_info['n_cards']), … … 955 1036 'order' => 'company.company_name' 956 1037 ); 957 1038 958 1039 $find_restric[0] = array( 959 1040 0 => array( … … 963 1044 ) 964 1045 ); 965 1046 966 1047 break; 967 1048 968 1049 case 'bo_group_manager': 1050 /**rev 104**/ 969 1051 case 'bo_shared_group_manager': 970 1052 /****/ 1053 971 1054 $field_name = 'id_group'; 972 1055 973 1056 if ($letter !== 'number') { 974 1057 975 1058 $find_restric[0] = array( 976 1059 0 => array( … … 982 1065 } 983 1066 else { 984 1067 985 1068 $find_restric[0] = array( 986 1069 0 => array( 987 1070 'field' => 'group.title', 988 1071 'type' => 'LIKE', 989 'value' => '0%' 1072 'value' => '0%' 990 1073 ) 991 ); 1074 ); 992 1075 } 993 1076 /**rev 104**/ 994 1077 if($this->page_info['actual_catalog']['class'] == 'bo_group_manager'){ 1078 /****/ 995 1079 array_push($find_restric[0], array( 996 1080 'field' => 'group.owner', 997 1081 'type' => '=', 998 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 1082 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 999 1083 ) 1000 1084 ); 1001 1085 } 1002 1003 $find_field[0] = array('group.id_group','group.title','group.short_name'); 1086 1087 $find_field[0] = array('group.id_group','group.title','group.short_name'); 1004 1088 $find_other[0] = array( 1005 1089 'order' => 'group.title' 1006 ); 1090 ); 1007 1091 break; 1008 1092 1009 1093 case 'bo_catalog_group_catalog': 1010 1094 $this->page_info['actual_entries'] = false; 1011 1095 1012 1096 $this->page_info['actual_letter'] = $letter; 1013 1097 $this->page_info['actual_page'] = 0; 1014 1098 1015 1099 $this->save_session(); 1016 1100 $final[0] = 0; 1017 1101 $final[1] = $this->typeContact; 1018 echo serialize($final); 1102 echo serialize($final); 1019 1103 return; 1020 1104 … … 1023 1107 $result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]); 1024 1108 $n_entries = count($result); 1025 1109 1026 1110 if ($n_entries) 1027 1111 { … … 1036 1120 if (!$result) 1037 1121 { 1038 1039 1122 $this->page_info['actual_entries'] = false; 1040 1123 1041 1124 $this->page_info['actual_letter'] = $letter; 1042 1125 $this->page_info['actual_page'] = 0; 1043 1044 $this->save_session(); 1126 1127 $this->save_session(); 1045 1128 $final[0] = 0; 1046 1129 $final[1] = $this->typeContact; 1047 echo serialize($final); 1130 echo serialize($final); 1048 1131 return; 1049 1132 } … … 1053 1136 foreach ($result as $id => $value) 1054 1137 { 1138 /**rev 104**/ 1139 // $this->page_info['actual_entries'][] = $value[$field_name]; 1140 //} 1055 1141 if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 1056 1142 $this->page_info['actual_entries'][] = $value[$field_name]; 1057 1143 else 1058 1144 $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms'],2=>$value['owner']); 1059 } 1145 } 1146 /****/ 1060 1147 //print_r($this->page_info['actual_entries']); 1061 1148 } … … 1066 1153 if (!$ids) 1067 1154 { 1155 /**rev 104**/ 1068 1156 //error_log('!$ids e $this->page_info[\'actual_letter\'] != search'); 1157 /*****/ 1069 1158 $this->page_info['actual_entries'] = false; 1070 1159 1071 1160 $this->page_info['actual_letter'] = $letter; 1072 1161 $this->page_info['actual_page'] = 0; 1073 1162 1074 1163 $this->save_session(); 1075 1164 $final[0] = 0; 1076 1165 $final[1] = $this -> typeContact; 1077 echo serialize($final); 1166 echo serialize($final); 1078 1167 return; 1079 1168 } … … 1092 1181 } 1093 1182 else if ($ids) 1094 { 1183 { 1095 1184 $this->page_info['actual_letter'] = $letter; 1096 1185 $this->page_info['actual_entries'] = $ids; … … 1109 1198 $page = $this->page_info['n_pages']; 1110 1199 } 1111 1200 1112 1201 $final = array( 1113 1202 0 => (int)$this->page_info['n_pages'], … … 1121 1210 5 => 'cc_alias', 1122 1211 6 => 'cc_id', 1123 7 => 'cc_forwarding_address' 1212 7 => 'cc_forwarding_address', 1213 8 => 'cc_empNumber', 1214 9 => 'cc_department', 1215 10 => 'cc_mobile' 1124 1216 ) 1125 1217 ); 1126 1218 1127 1219 //echo 'Page: '.$page.'<br>'; 1128 1220 $id_i = (($page-1)*$this->page_info['n_cards']); 1129 1221 $id_f = $id_i + $this->page_info['n_cards']; 1130 1222 $n_entries = count($this->page_info['actual_entries']); 1131 1223 1132 1224 //echo 'ID_I: '.$id_i.'<br>'; 1133 1225 //echo 'ID_F: '.$id_f.'<br>'; 1134 1226 ///---------------- Correᅵᅵo Temporï¿œria PHP5 -----------------------/// 1227 1135 1228 $ids = array(); 1229 /**rev 104**/ 1136 1230 $perms = array(); 1137 1231 $owners = array(); 1138 $array_temp = array(); 1139 1232 /****/ 1233 $array_temp = array(); 1234 1140 1235 foreach($this->page_info['actual_entries'] as $key=>$tmp){ 1141 $array_temp[] = $tmp;1142 } 1143 1236 $array_temp[] = $tmp; 1237 } 1238 1144 1239 for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 1145 1240 { 1241 /**rev 104**/ 1146 1242 if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 1243 { 1244 /****/ 1147 1245 $ids[] = $array_temp[$i]; 1148 else { 1246 /**rev 104**/ 1247 }else { 1149 1248 $ids[] = $array_temp[$i][0]; 1150 1249 $perms[] = $array_temp[$i][1]; 1151 1250 $owners[] = $array_temp[$i][2]; 1251 /****/ 1152 1252 } 1153 //$perms[] = $array_temp[$i];1154 } 1155 1253 } 1254 1255 /**rev 104**/ 1156 1256 // Carrega o nome completo dos donos dos objetos (contatos e grupos); 1157 1257 $owner_names = array(); 1158 1258 1159 1259 if($owners) { 1160 1260 $filter = "(|"; … … 1168 1268 $this->bo->catalog->src_info = $ldap->srcs[1]; 1169 1269 } 1170 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false); 1270 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false); 1171 1271 $dn=$this->bo->catalog->src_info['dn']; 1172 1272 $justThese = array("cn","uidnumber","uid"); 1173 $sr = ldap_search($ds,$dn, $filter,$justThese); 1273 $sr = ldap_search($ds,$dn, $filter,$justThese); 1174 1274 $info = ldap_get_entries($ds, $sr); 1175 ldap_close($ds); 1275 ldap_close($ds); 1176 1276 for($z = 0; $z < $info['count']; $z++) { 1177 1277 $owner_names[$info[$z]['uidnumber'][0]] = array("cn" => $info[$z]['cn'][0], "uid" => $info[$z]['uid'][0]); 1178 } 1179 } 1278 } 1279 } 1280 1281 /*****/ 1282 1283 1180 1284 /// Original 1181 1285 //for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) … … 1184 1288 //} 1185 1289 /// 1290 1186 1291 $fields = $this->bo->catalog->get_fields(false); 1292 /**rev 104**/ 1293 //if( $this->typeContact == 'groups') { 1187 1294 if( $this->typeContact == 'groups' || $this->typeContact == 'shared_groups') { 1295 /****/ 1188 1296 $final = array( 1189 1297 0 => (int)$this->page_info['n_pages'], … … 1194 1302 2 => 'cc_id', 1195 1303 3 => 'cc_contacts' 1196 ) 1197 ); 1304 ) 1305 ); 1306 1198 1307 $groups =& $this->bo->catalog->get_multiple_entries($ids,$fields); 1199 1308 1200 1309 $i = 0; 1201 1310 // contatos do grupo 1202 $boGroups = CreateObject('contactcenter.bo_group'); 1311 $boGroups = CreateObject('contactcenter.bo_group'); 1203 1312 $contacts = array(); 1204 1205 foreach($groups as $group) { 1313 foreach($groups as $group) { 1314 1206 1315 $final[3][$i][0] = $group['title'] ? $group['title'] : 'none'; 1207 $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none'; 1316 $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none'; 1208 1317 $final[3][$i][2] = $group['id_group'] ? $group['id_group'] : 'none'; 1209 1318 $contacts = $boGroups -> get_contacts_by_group($group['id_group']); … … 1217 1326 $i++; 1218 1327 } 1219 1328 1220 1329 $this->page_info['actual_letter'] = $letter; 1221 $this->page_info['actual_page'] = $page; 1222 1223 1330 $this->page_info['actual_page'] = $page; 1331 1332 1224 1333 $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 1225 1226 $final[5] = '<span class="link" onclick="'.$lnk_compose; 1227 $final[10] = $this->typeContact; 1228 $this->save_session(); 1334 1335 $final[5] = '<span class="link" onclick="'.$lnk_compose; 1336 /**rev 104**/ 1337 //$final[10] = 'groups'; 1338 $final[10] = $this->typeContact; 1339 /******/ 1340 $this->save_session(); 1229 1341 echo serialize($final); 1230 return; 1231 } 1342 return; 1343 } 1344 /**rev 104**/ 1232 1345 $final[10] = $this -> typeContact; 1233 1346 /*****/ 1347 1234 1348 $fields['photo'] = true; 1235 1349 $fields['names_ordered'] = true; … … 1238 1352 $fields['companies'] = 'default'; 1239 1353 $fields['connections'] = 'default'; 1354 1355 /**rev 104**/ 1356 // ?aqui alterar a chamada desse mï¿œtodo para receber o base dn? 1357 //$contacts = &$this->bo->catalog->get_multiple_entries($ids,$fields); 1358 1240 1359 // ?aqui alterar a chamada desse método para receber o base dn? 1241 1360 if($external) 1361 { 1242 1362 $contacts = &$this->bo->catalog->get_multiple_entries($ids,$fields,false,true); 1243 else1363 } else{ 1244 1364 $contacts = &$this->bo->catalog->get_multiple_entries($ids,$fields); 1245 1246 1365 } 1366 1367 /*******/ 1368 1369 1247 1370 if (!is_array($contacts) or !count($contacts)) 1248 1371 { … … 1252 1375 return; 1253 1376 } 1254 1377 1255 1378 $i = 0; 1256 1379 foreach($contacts as $index => $contact) 1257 1380 { 1258 1381 /* 1259 * TODO: Os timeouts de conex ão foram retirados, ver se será necessário retornar essa funcionalidade, e,1260 * neste caso, terminar a implementa ção das mensagens de retorno.1382 * TODO: Os timeouts de conexï¿œo foram retirados, ver se serï¿œ necessï¿œrio retornar essa funcionalidade, e, 1383 * neste caso, terminar a implementaᅵᅵo das mensagens de retorno. 1261 1384 */ 1262 1385 if ($index !== 'error'){ 1263 1386 $final[3][$i][0] = $contact['companies']['company1']['company_name']?$contact['companies']['company1']['company_name']:'none'; 1387 1388 /**rev 104**/ 1389 //$final[3][$i][1] = $contact['names_ordered'] ? $contact['names_ordered'] : 'none'; 1390 1264 1391 if($this->page_info['actual_catalog']['class']!='bo_global_ldap_catalog'){ 1265 1392 $final[3][$i][1] = $contact['names_ordered'] ? urldecode($contact['names_ordered']) : 'none'; … … 1269 1396 $final[3][$i][1] = $contact['names_ordered'] ? $contact['names_ordered'] : 'none'; 1270 1397 } 1398 1399 /********/ 1400 1271 1401 $final[3][$i][2] = $contact['companies']['company1']['title']? urldecode( $contact['companies']['company1']['title'] ) :'none'; 1402 1403 //Para exibir a matricula do empregado 1404 $final[3][$i][8] = $contact['companies']['company1']['empNumber']?$contact['companies']['company1']['empNumber']:'none'; 1405 //Para exibir o setor/lotacao do empregado 1406 $final[3][$i][9] = $contact['companies']['company1']['department']?$contact['companies']['company1']['department']:'none'; 1407 //Para exibir o celular empresarial do empregado 1408 $final[3][$i][10] = $contact['companies']['company1']['celPhone']?$contact['companies']['company1']['celPhone']:'none'; 1409 1410 //Para exibir o celular empresarial do empregado 1411 if ($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && !$external && $final[3][$i][10] != 'none') 1412 $final[3][$i][10] = "<a title=\"".lang("Call Mobile")."\" href=\"#\" onclick=\"connectVoip('".$final[3][$i][10]."', 'mob')\">".$final[3][$i][10]."</a>"; 1272 1413 1273 1414 /* Select the correct Email and Telephone to be shown */ 1274 1415 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 1275 1416 1276 1417 if (!is_array($preferences)) 1277 1418 { … … 1299 1440 $default_phone_found = true; 1300 1441 } 1442 1443 /**rev 104**/ 1444 //if ($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && !$external){ 1445 // $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'ramal')\">".$conn_info['connection_value']."</a>"; 1446 1301 1447 if (!($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['telephone_number'] == $conn_info['connection_value']) && $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] && $conn_info['connection_value'] && preg_match('/^\([0-9]{2}\)[0-9]{4}\-[0-9]{4}$/',$conn_info['connection_value'])==1 && !$external){ 1302 1448 $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'com')\">".$conn_info['connection_value']."</a>"; 1449 1450 /*****/ 1303 1451 } 1304 1452 $final[3][$i][3] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; … … 1306 1454 } 1307 1455 } 1308 1456 1309 1457 if (!$final[3][$i][3]) 1310 1458 { … … 1320 1468 $final[3][$i][6] = $ids[$i]; 1321 1469 1322 // If contact is a public list or a group, then load the forwarding addresses. 1470 /**rev 104**/ 1471 /* // If contact is a public list, then load the forwarding addresses. 1472 if($contact['account_type'][0] == 'l') 1473 $final[3][$i][7] = array(); 1474 */ 1475 1476 //If contact is a public list or a group, then load the forwarding addresses. 1323 1477 if($contact['account_type'][0] == 'l' || $contact['account_type'][0] == 'g') 1324 1478 $final[3][$i][7] = ($contact['account_type'][0] == 'l' ? 'list' : 'group'); 1325 1479 1326 1480 if($this->page_info['actual_catalog']['class']=='bo_shared_people_manager') { 1327 $final[3][$i][ 8] = $perms[$i];1328 $final[3][$i][ 9] = lang('Shared').": ".$owner_names[$owners[$i]]['cn'];1481 $final[3][$i][11] = $perms[$i]; 1482 $final[3][$i][12] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 1329 1483 } 1484 /******/ 1330 1485 1331 1486 $final[4][$i] = $contact['photo'] ? 1 : 0; 1332 // print_r($final[3][$i]);1333 // exit;1334 1487 $i++; 1335 1488 } … … 1338 1491 // coloca mensagem de erro no vetor que retorna para o browser 1339 1492 } 1340 1341 1493 } 1342 1494 $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; … … 1347 1499 $final[9] = $count; 1348 1500 1501 1349 1502 $this->page_info['actual_letter'] = $letter; 1350 1503 $this->page_info['actual_page'] = $page; 1351 1352 $this->save_session(); 1504 1505 $this->save_session(); 1353 1506 echo serialize($final); 1354 1507 return; 1355 1508 } 1356 1509 1357 1510 $this->page_info['actual_letter'] = $letter; 1358 1511 $this->page_info['actual_page'] = $page; 1359 1512 1360 1513 $this->save_session(); 1361 1514 1362 1515 $final[0] = 0; 1363 1516 $final[1] = $this -> typeContact; 1364 1517 echo serialize($final); 1365 1518 } 1366 1519 1367 1520 function get_visible_all_ldap() 1368 1521 { 1369 1522 $bo = CreateObject('contactcenter.bo_ldap_manager'); 1370 1523 $ldap_query = $bo->srcs; 1371 return $ldap_query[1]['visible']; 1524 return $ldap_query[1]['visible']; 1372 1525 } 1373 1526 1374 1527 1375 1528 /*! 1376 1529 1377 1530 @function get_group_data 1378 1531 @abstract Returns all the information of a given Group 1379 1532 @author Nilton Emilio Buhrer Neto 1380 1533 1381 1534 @param (integer) $id The id to get information 1382 1383 */ 1535 1536 */ 1384 1537 function get_group_data($id,$shared_from=null) 1385 1538 { … … 1394 1547 1395 1548 $boGroup = CreateObject('contactcenter.bo_group'); 1396 1549 1397 1550 $all_contacts = $boGroup->get_all_contacts('only_email',$shared_from); 1398 1551 … … 1403 1556 } 1404 1557 } 1405 $data['contact_list'] = $contact_options; 1406 $data['result'] = 'ok'; 1407 1558 $data['contact_list'] = $contact_options; 1559 $data['result'] = 'ok'; 1408 1560 echo serialize($data); 1409 1561 } 1410 1562 1411 1563 /*! 1412 1564 1413 1565 @function get_full_data 1414 1566 @abstract Returns all the information of a given Entry 1415 1567 @author Raphael Derosso Pereira 1416 1568 1417 1569 @param (integer) $id The id to get information 1418 1570 1419 1571 */ 1572 /**rev 104**/ 1573 //function get_full_data($id) 1420 1574 function get_full_data($id,$catalog='bo_people_catalog') 1421 1575 { 1422 1576 $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 1423 $this->bo->catalog = CreateObject('contactcenter.'.$catalog); 1577 /**rev 104**/ 1578 //$this->bo->catalog = CreateObject('contactcenter.bo_people_catalog'); 1579 $this->bo->catalog = CreateObject('contactcenter.'.$catalog); 1580 /****/ 1424 1581 $fields = $this->bo->catalog->get_fields(true); 1425 1582 $fields['photo'] = false; … … 1454 1611 } 1455 1612 $datecount = 0; 1456 1613 1457 1614 $data['result'] = 'ok'; 1458 1615 $data['cc_full_add_contact_id'] = $id; … … 1493 1650 } 1494 1651 } 1495 1652 // print_r($data); 1653 //OBSERVAR cc_department 1496 1654 /*Corporative*/ 1497 1655 $data['personal']['cc_name_corporate'] = $entry['corporate_name']; … … 1500 1658 $data['personal']['cc_name_corporate'] = $entry['corporate_name']; 1501 1659 $data['personal']['cc_web_page'] = $entry['web_page']; 1502 1503 1660 1661 1504 1662 /* Relations */ 1505 1663 1506 1664 echo serialize($data); 1507 1665 } … … 1540 1698 return; 1541 1699 } 1542 1700 1543 1701 echo 0; 1544 1702 } 1545 1703 1546 1704 /*! 1547 1705 1548 1706 @function quick_add 1549 1707 @abstract Adds a new Contact using the Quick Add interface 1550 1708 @author Raphael Derosso Pereira 1551 1709 1552 1710 @param string $sdata Serialized data 1553 1711 */ 1554 1712 function quick_add($sdata) 1555 1713 { 1556 1714 1557 1715 $sdata = str_replace('\\"', '"', $sdata); 1558 1716 $new_array = unserialize($sdata); 1559 1717 $tdata = array(); 1560 1718 1561 1719 foreach($new_array as $tmp) 1562 1720 $tdata[] = $tmp; 1563 1721 1564 1722 if (!$tdata) 1565 1723 { … … 1568 1726 'status' => 'abort' 1569 1727 )); 1570 1728 1571 1729 return; 1572 1730 } 1573 1574 // verifica se email j áexiste!1731 1732 // verifica se email jï¿œ existe! 1575 1733 $boGroup = CreateObject('contactcenter.bo_group'); 1576 1734 $contact = $boGroup->verify_contact($tdata[4]); 1577 1735 1578 1736 if($contact) 1579 { 1737 { 1580 1738 $str_contact = "\r\n - ".implode("\r\n - ",$contact); 1581 1739 1582 1740 echo serialize(array( 1583 1741 'msg' => lang('Problems on adding your Contact. The email "%1" already exists in: %2',$tdata[4], $str_contact), 1584 1742 'status' => 'alreadyExists' 1585 1743 )); 1586 1587 return; 1744 1745 return; 1588 1746 } 1589 1747 … … 1600 1758 1601 1759 if ($boPeople ->quick_add($data)) 1602 { 1760 { 1603 1761 $this->page_info['changed'] = true; 1604 1762 1605 1763 echo serialize(array( 1606 1764 'msg' => lang('Entry added with success!'), … … 1616 1774 } 1617 1775 1618 $this->save_session(); 1619 1776 $this->save_session(); 1777 1620 1778 } 1621 1779 1622 1780 /*! 1623 1781 1624 1782 @function add_group 1625 1783 @abstract Adds a new Group using the Add Group interface 1626 1784 @author Nilton Emilio Buhrer Neto 1627 1785 1628 1786 @param string $sdata Serialized data 1629 1787 */ … … 1633 1791 $tdata = unserialize($sdata); 1634 1792 $new_tdata = array(); 1635 1793 1636 1794 if (!$tdata) 1637 1795 { … … 1640 1798 'status' => 'abort' 1641 1799 )); 1642 1800 1643 1801 return; 1644 1802 } 1645 1803 1646 1804 foreach($tdata as $tmp) 1647 1805 $new_tdata[] = $tmp; 1648 1649 $data['title'] = $new_tdata[0]; 1806 1807 $data['title'] = $new_tdata[0]; 1650 1808 $data['contact_in_list'] = $new_tdata[1]; 1651 1809 $data['id_group'] = $new_tdata[2]; 1652 1810 1653 1811 $boGroup = CreateObject('contactcenter.bo_group_manager'); 1654 1812 $id = $boGroup -> add_group($data); 1655 1813 1656 1814 if ($id) 1657 1815 { 1658 1816 $this->page_info['changed'] = true; 1659 1817 1660 1818 echo serialize(array( 1661 1819 'msg' => lang('Entry added with success!'), … … 1675 1833 1676 1834 /*! 1677 1835 1678 1836 @function remove_group 1679 1837 @abstract Removes a group if the user has the right to do it 1680 @author Nilton Emilio Buhrer Neto 1838 @author Nilton Emilio Buhrer Neto 1681 1839 @param (integer) $id The id to be removed 1682 1840 1683 1841 */ 1684 1842 function remove_group($id) 1685 { 1686 $soGroup = CreateObject('contactcenter.so_group'); 1843 { 1844 $soGroup = CreateObject('contactcenter.so_group'); 1687 1845 $data = array ('id_group' => $id); 1688 1846 if($soGroup -> delete($data)) { … … 1690 1848 'msg' => lang('Removed Entry ID '.$id.'!'), 1691 1849 'status' => 'ok' 1692 )); 1850 )); 1693 1851 } 1694 1852 else { … … 1699 1857 } 1700 1858 1701 $this->save_session(); 1859 $this->save_session(); 1702 1860 } 1703 1861 1704 1862 1705 1863 function remove_all_entries (){ 1706 1864 1707 1865 $error = false; 1708 1866 $this->all_entries = $this->bo->catalog->get_all_entries_ids(); … … 1712 1870 if(!$result) { 1713 1871 $error = true; 1714 break; 1872 break; 1715 1873 } 1716 1874 } … … 1721 1879 'status' => 'ok' 1722 1880 )); 1723 } 1881 } 1724 1882 else { 1725 1883 echo serialize(array( … … 1733 1891 1734 1892 /*! 1735 1893 1736 1894 @function remove_entry 1737 1895 @abstract Removes an entry if the user has the right to do it 1738 1896 @author Raphael Derosso Pereira 1739 1897 1740 1898 @param (integer) $id The id to be removed 1741 1899 1742 1900 */ 1743 1901 function remove_entry ($id) … … 1748 1906 return; 1749 1907 } 1750 1908 1751 1909 $this->page_info['changed'] = true; 1752 1910 $result = $this->bo->catalog->remove_single_entry($id); 1753 1911 1754 1912 if ($result) 1755 1913 { … … 1758 1916 unset($this->page_info['actual_entries'][$pos]); 1759 1917 } 1760 1918 1761 1919 $temp = false; 1762 1920 reset($this->page_info['actual_entries']); … … 1765 1923 $temp[] = $t; 1766 1924 } 1767 1925 1768 1926 $this->page_info['actual_entries'] = $temp; 1769 1927 … … 1780 1938 )); 1781 1939 } 1782 1940 1783 1941 $this->save_session(); 1784 1942 } 1785 1943 1786 1944 1787 1945 /*! 1788 1946 1789 1947 @function post_full_add 1790 1948 @abstract Saves all the information altered/entered in the Full Add … … 1796 1954 { 1797 1955 $data = $_POST['data']; 1798 // Exceptions!!! utf8 special chars. 1956 // Exceptions!!! utf8 special chars. 1799 1957 $data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data); 1800 1958 $data = unserialize(str_replace('\\"', '"', $data)); … … 1823 1981 'status' => 'fatal' 1824 1982 )); 1825 1983 1826 1984 return; 1827 1985 } … … 1837 1995 $id_photo = '_new_'; 1838 1996 } 1839 1840 /* 1841 * Process Photo, if available 1997 1998 /* 1999 * Process Photo, if available 1842 2000 */ 1843 2001 $sleep_count = 0; … … 1856 2014 } 1857 2015 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n')); 1858 2016 1859 2017 if (isset($this->page_info['photos'][$id_photo])) 1860 2018 { … … 1873 2031 $this->save_session(); 1874 2032 } 1875 2033 1876 2034 /* 1877 2035 * Arrange Date so it gets inserted correctly 1878 2036 */ 1879 2037 1880 2038 $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 1881 2039 1882 2040 $j = 0; 1883 2041 for ($i = 0; $i < 5; $i+=2) … … 1912 2070 continue; 1913 2071 } 1914 2072 1915 2073 switch($field) 1916 2074 { … … 1929 2087 /* Do Nothing. This is just to make sure no invalid field is passed */ 1930 2088 break; 1931 2089 1932 2090 case 'id_status': 1933 2091 case 'id_prefix': … … 1938 2096 } 1939 2097 break; 1940 2098 1941 2099 case 'birthdate_0': 1942 2100 case 'birthdate_1': 1943 2101 case 'birthdate_2': 1944 2102 1945 2103 switch($date[$datecount]['digit']) 1946 2104 { … … 1964 2122 break; 1965 2123 } 1966 2124 1967 2125 if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2])) 1968 2126 { … … 1973 2131 return; 1974 2132 } 1975 2133 1976 2134 $data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1]; 1977 2135 break; … … 1996 2154 { 1997 2155 $index = 'address'.$type; 1998 2156 1999 2157 $id_state = $this->bo->catalog->add_state($state_info); 2000 2158 $data['addresses'][$index]['id_state'] = $id_state; … … 2014 2172 { 2015 2173 $index = 'address'.$type; 2016 2174 2017 2175 $id_city = $this->bo->catalog->add_city($city_info); 2018 2176 $data['addresses'][$index]['id_city'] = $id_city; … … 2055 2213 ); 2056 2214 } 2057 2215 2058 2216 eval($code); 2059 2217 … … 2074 2232 { 2075 2233 $data = $_POST['data']; 2076 // Exceptions!!! utf8 special chars. 2234 // Exceptions!!! utf8 special chars. 2077 2235 $data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data); 2078 2236 $data = unserialize(str_replace('\\"', '"', $data)); … … 2101 2259 'status' => 'fatal' 2102 2260 )); 2103 2261 2104 2262 return; 2105 2263 } … … 2121 2279 unset($data['owner']); 2122 2280 } 2123 /* 2124 * Process Photo, if available 2281 /* 2282 * Process Photo, if available 2125 2283 */ 2126 2284 $sleep_count = 0; … … 2139 2297 } 2140 2298 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n')); 2141 2299 2142 2300 if (isset($this->page_info['photos'][$id_photo])) 2143 2301 { … … 2156 2314 $this->save_session(); 2157 2315 } 2158 2316 2159 2317 /* 2160 2318 * Arrange Date so it gets inserted correctly 2161 2319 */ 2162 2320 2163 2321 $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 2164 2322 2165 2323 $j = 0; 2166 2324 for ($i = 0; $i < 5; $i+=2) … … 2195 2353 continue; 2196 2354 } 2197 2355 2198 2356 switch($field) 2199 2357 { … … 2208 2366 /* Do Nothing. This is just to make sure no invalid field is passed */ 2209 2367 break; 2210 2368 2211 2369 case 'id_status': 2212 2370 case 'id_prefix': … … 2217 2375 } 2218 2376 break; 2219 2377 2220 2378 case 'birthdate_0': 2221 2379 case 'birthdate_1': 2222 2380 case 'birthdate_2': 2223 2381 2224 2382 switch($date[$datecount]['digit']) 2225 2383 { … … 2243 2401 break; 2244 2402 } 2245 2403 2246 2404 if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2])) 2247 2405 { … … 2252 2410 return; 2253 2411 } 2254 2412 2255 2413 $data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1]; 2256 2414 break; … … 2275 2433 { 2276 2434 $index = 'address'.$type; 2277 2435 2278 2436 $id_state = $this->bo->catalog->add_state($state_info); 2279 2437 $data['addresses'][$index]['id_state'] = $id_state; … … 2293 2451 { 2294 2452 $index = 'address'.$type; 2295 2453 2296 2454 $id_city = $this->bo->catalog->add_city($city_info); 2297 2455 $data['addresses'][$index]['id_city'] = $id_city; … … 2334 2492 ); 2335 2493 } 2336 2494 2337 2495 eval($code); 2338 2496 … … 2349 2507 } 2350 2508 /*! 2351 2509 2352 2510 @function post_photo 2353 2511 @abstract Wrapper to post a photo without reload a page. … … 2359 2517 //print_r($_FILES); 2360 2518 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'y')); 2361 2519 2362 2520 if (!is_array($_FILES) and is_array(!$_FILES['cc_pd_photo'])) 2363 2521 { 2364 2522 $this->page_info['photos'][$id]['status'] = 'no_upload'; 2365 2523 $this->page_info['photos'][$id]['msg'] = lang('No Photos uploaded to Server.'); 2366 2524 2367 2525 $this->save_session(); 2368 2526 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); … … 2374 2532 $this->page_info['photos'][$id]['status'] = 'no_GD_lib'; 2375 2533 $this->page_info['photos'][$id]['msg'] = lang('Cannot manipulate Image. No Image added. Please, if you want to use images, ask the Administrator to install GD library.'); 2376 2534 2377 2535 $this->save_session(); 2378 2536 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); … … 2400 2558 return; 2401 2559 } 2402 2560 2403 2561 switch($_FILES['cc_pd_photo']['type']) 2404 2562 { … … 2430 2588 2431 2589 default: 2432 2590 2433 2591 $this->page_info['photos'][$id]['status'] = 'invalid_image'; 2434 2592 $this->page_info['photos'][$id]['msg'] = lang('The file must be an JPEG, PNG or GIF Image.'); … … 2443 2601 $this->page_info['photos'][$id]['status'] = 'invalid_file'; 2444 2602 $this->page_info['photos'][$id]['msg'] = lang('Couldn\'t open Image. It may be corrupted or internal library doesn\'t support this format.'); 2445 2603 2446 2604 $this->save_session(); 2447 2605 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 2448 2606 return; 2449 2607 } 2450 2608 2451 2609 $img_size = getimagesize($_FILES['cc_pd_photo']['tmp_name']); 2452 2610 $dst_img = imagecreatetruecolor(60, 80); 2453 2611 2454 2612 if (!imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, 60, 80, $img_size[0], $img_size[1])) 2455 2613 { 2456 2614 $this->page_info['photos'][$id]['status'] = 'invalid_file'; 2457 2615 $this->page_info['photos'][$id]['msg'] = lang('Couldn\'t open Image. It may be corrupted or internal library doesn\'t support this format.'); 2458 2616 2459 2617 $this->save_session(); 2460 2618 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 2461 2619 return; 2462 2620 } 2463 2621 2464 2622 ob_start(); 2465 2623 imagepng($dst_img); … … 2471 2629 2472 2630 $this->save_session(); 2473 2631 2474 2632 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 2475 2633 … … 2492 2650 $fields = $this->bo->catalog->get_fields(false); 2493 2651 $fields['photo'] = true; 2494 2652 2495 2653 $contact = $this->bo->catalog->get_single_entry($id, $fields); 2496 2654 … … 2501 2659 return; 2502 2660 } 2503 2661 2504 2662 header('Content-type: image/jpeg'); 2505 2663 $photo = imagecreatefromstring ($contact['photo']); … … 2513 2671 return; 2514 2672 } 2515 2673 2516 2674 /*! 2517 2675 2518 2676 @function get_states 2519 2677 @abstract Echos a serialized array containing all the states for the given country … … 2537 2695 return; 2538 2696 } 2539 2697 2540 2698 $result = array( 2541 2699 'msg' => lang('States Successfully retrieved!'), 2542 2700 'status' => 'ok' 2543 2701 ); 2544 2702 2545 2703 foreach ($states as $state_info) 2546 2704 { … … 2581 2739 return; 2582 2740 } 2583 2741 2584 2742 $result = array( 2585 2743 'msg' => lang('Cities Successfully retrieved!'), 2586 2744 'status' => 'ok' 2587 2745 ); 2588 2746 2589 2747 foreach ($cities as $city_info) 2590 2748 { 2591 2749 $result['data'][$city_info['id_city']] = $city_info['name']; 2592 2750 } 2593 2751 2594 2752 echo serialize($result); 2595 2753 } … … 2597 2755 2598 2756 /*! 2599 2757 2600 2758 @function search 2601 2759 @abstract Echos a serialized array containing the IDs 2602 2760 of the entries that matches the search argument 2603 2761 @author Raphael Derosso Pereira 2604 @author M ário César Kolling (external catalogs)2762 @author Mï¿œrio Cï¿œsar Kolling (external catalogs) 2605 2763 2606 2764 @param string $str_data A serialized array with two informations: … … 2617 2775 // It's an external catalog? 2618 2776 $external = $this->bo->is_external($this->page_info['actual_catalog']); 2619 2620 2621 2622 echo serialize(array( 2623 'msg' => lang('Invalid parameters'), 2624 2625 2626 2627 return array('error' => lang('Invalid parameters')); 2628 } 2629 2630 2777 2778 if (!is_array($data) || !$data['search_for'] || !is_array($data['fields'])) 2779 { 2780 echo serialize(array( 2781 'msg' => lang('Invalid parameters'), 2782 'status' => 'abort' 2783 )); 2784 2785 return array('error' => lang('Invalid parameters')); 2786 } 2787 2788 2631 2789 /* 2632 2790 * TODO: look into the database to discover the database's encoding and convert the search_for field accordingly … … 2634 2792 // Support search parameters with accentuation 2635 2793 if ($this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 2794 /**rev 104**/ 2795 //$this->page_info['actual_catalog']['class'] != 'bo_group_manager') 2636 2796 $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 2637 2797 $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 2638 2798 $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 2799 /****/ 2639 2800 { 2640 2801 2641 2802 $data['search_for'] = utf8_encode($data['search_for']); 2642 2803 } 2643 2644 $rules = array(); 2645 2646 2647 if ($data['search_for'] === '*') 2648 { 2649 $rules = array( 2650 0 => array( 2651 'field' => $data['fields']['search'], 2652 'type' => 'LIKE', 2653 'value' => '%' 2654 ) 2655 ); 2656 } 2657 else 2658 { 2659 $names = explode(' ', $data['search_for']); 2660 2661 if (!is_array($names)) 2662 { 2663 echo serialize(array( 2664 'msg' => lang('Invalid Search Parameter'), 2665 'status' => 'abort' 2666 )); 2667 2668 } 2804 2805 $rules = array(); 2806 2807 if ($data['search_for'] === '*') 2808 { 2809 $rules = array( 2810 0 => array( 2811 'field' => $data['fields']['search'], 2812 'type' => 'LIKE', 2813 'value' => '%' 2814 ) 2815 ); 2816 } 2817 else 2818 { 2819 $names = explode(' ', $data['search_for']); 2820 2821 if (!is_array($names)) 2822 { 2823 echo serialize(array( 2824 'msg' => lang('Invalid Search Parameter'), 2825 'status' => 'abort' 2826 )); 2827 2828 } 2669 2829 2670 2830 if (!$external && $this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 2831 /**rev 104**/ 2832 //$this->page_info['actual_catalog']['class'] != 'bo_group_manager') 2671 2833 $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 2672 $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 2834 $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 2673 2835 $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager' ) 2836 /*****/ 2674 2837 { 2675 2838 /* … … 2688 2851 'value' => '%' 2689 2852 ), 2853 /**rev 104**/ 2854 /// 2855 //1 => array( 2690 2856 2 => array( 2857 /*****/ 2691 2858 'field' => 'contact.account_visible', 2692 2859 'type' => '!=', 2693 2860 'value' => '-1' 2861 /**rev 104**/ 2862 /* ), 2863 2 => array( 2864 'field' => 'contact.object_class', 2865 'type' => '=', 2866 'value' => 'inetOrgPerson' 2867 /****/ 2694 2868 ), 2695 2869 ); 2696 2870 } 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2871 2872 foreach ($names as $name) 2873 { 2874 if ($name != '') 2875 { 2876 array_push($rules, array( 2877 'field' => $data['fields']['search'], 2878 'type' => 'iLIKE', 2879 'value' => '%'.$name.'%' 2880 )); 2881 } 2882 } 2883 } 2710 2884 2711 2885 if ($external || $this->page_info['actual_catalog']['class'] == 'bo_people_catalog' || 2886 /**rev 104**/ 2887 //$this->page_info['actual_catalog']['class'] == 'bo_group_manager') 2712 2888 $this->page_info['actual_catalog']['class'] == 'bo_group_manager' || 2713 2889 $this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager' || 2714 $this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager' ) 2890 $this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager') 2891 2892 2893 /***/ 2715 2894 { 2716 2895 // Get only this attributes: dn, cn for external catalogs, … … 2728 2907 //'contact.account_status', 2729 2908 'contact.account_visible' 2730 ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC') );2731 } 2732 2733 2734 2909 ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC'), $data['search_for_area'] ); 2910 } 2911 2912 if (!is_array($ids) || !count($ids)) 2913 { 2735 2914 $this->last_search_ids = null; 2736 2915 $this->save_session(); 2737 2916 return null; 2738 } 2739 2740 $id_field = substr($data['fields']['id'], strrpos($data['fields']['id'], '.')+1); 2741 2742 $ids_f = array(); 2743 2744 foreach ($ids as $e_info) 2745 { 2917 } 2918 2919 $id_field = substr($data['fields']['id'], strrpos($data['fields']['id'], '.')+1); 2920 2921 $ids_f = array(); 2922 2923 foreach ($ids as $e_info) 2924 { 2925 /**rev 104**/ 2926 //$ids_f[] = $e_info[$id_field]; 2746 2927 if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 2747 $ids_f[] = $e_info[$id_field]; 2748 else 2749 $ids_f[] = array(0=>$e_info[$id_field],1=>$e_info['perms']); 2750 } 2928 { 2929 $ids_f[] = $e_info[$id_field]; 2930 } else{ 2931 $ids_f[] = array(0=>$e_info[$id_field],1=>$e_info['perms']); 2932 } 2933 /****/ 2934 } 2751 2935 2752 2936 return $ids_f; 2753 2937 } 2754 2938 2755 2939 // CELEPAR 2756 2940 /* … … 2791 2975 'status' => 'abort' 2792 2976 )); 2793 2977 2794 2978 return; 2795 2979 } 2796 2980 2797 2981 foreach ($names as $name) 2798 2982 { … … 2808 2992 } 2809 2993 2810 2811 2994 2995 2812 2996 //$catalog = $this->bo->get_branch_by_level($this->bo->catalog_level[0]); 2813 2997 2814 2998 //if ($catalog['class'] === 'bo_people_catalog') 2815 2999 //{ … … 2820 3004 // )); 2821 3005 //} 2822 2823 3006 3007 2824 3008 $ids = $this->bo->find(array($data['fields']['id'], $data['fields']['search']), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC')); 2825 3009 … … 2846 3030 'status' => 'ok' 2847 3031 )); 2848 3032 2849 3033 return; 2850 3034 }*/ … … 2856 3040 @author Raphael Derosso Pereira 2857 3041 2858 @param array str_data A serialized array containing the ID's of the entries 3042 @param array str_data A serialized array containing the ID's of the entries 2859 3043 to be taken, the fields to be taken and the rules to be used on the 2860 3044 retrieval: … … 2869 3053 { 2870 3054 $data = unserialize($str_data); 2871 3055 2872 3056 if (!is_array($data) or !count($data) or !count($data['fields']) or !count($data['ids'])) 2873 3057 { … … 2879 3063 2880 3064 $entries = $this->bo->catalog->get_multiple_entries($data['ids'], $data['fields']); 2881 3065 2882 3066 if (!is_array($entries) or !count($entries)) 2883 3067 { … … 2898 3082 2899 3083 @function get_all_entries 2900 @abstract Returns the specified fields for all catalog's entries 3084 @abstract Returns the specified fields for all catalog's entries 2901 3085 in the default CC UI format 2902 3086 @author Raphael Derosso Pereira 2903 3087 2904 @params array str_data A serialized array containing the fields to 3088 @params array str_data A serialized array containing the fields to 2905 3089 be grabbed, the maximum number of entries to be returned and a 2906 3090 boolean specifying if the calls refers to a new grab or to an … … 2911 3095 { 2912 3096 $data = unserialize($str_data); 2913 2914 if (!is_array($data) or 2915 !count($data) or 2916 !count($data['fields']) or 3097 3098 if (!is_array($data) or 3099 !count($data) or 3100 !count($data['fields']) or 2917 3101 !$data['maxlength'] or 2918 3102 (!$data['new'] and !$data['offset'])) … … 2940 3124 $data['offset'] = 0; 2941 3125 } 2942 3126 2943 3127 if ($data['maxlength'] != -1) 2944 3128 { … … 2951 3135 2952 3136 $prefs = ExecMethod('contactcenter.ui_preferences.get_preferences'); 2953 3137 2954 3138 $jsCode = array(); 2955 3139 $count = 0; … … 2961 3145 } 2962 3146 2963 if($this-> typeContact == 'groups') { 2964 3147 if($this-> typeContact == 'groups') { 3148 2965 3149 foreach ($each as $field => $value) { 2966 3150 2967 3151 if ($field === 'title') { 2968 3152 $optionName = '\\"'.$value.'\\"'; 2969 3153 2970 3154 } 2971 3155 else if ($field === 'short_name') { 2972 3156 2973 3157 $jsCode[] = '_this.entries.options[_this.entries.options.length] = new Option("'.$optionName.' ('.$value.')", "'.$count.'");'; 2974 $count++; 2975 } 3158 $count++; 3159 } 2976 3160 } 2977 3161 } 2978 2979 else { 3162 3163 else { 2980 3164 foreach ($each as $field => $value) { 2981 3165 if ($field === 'names_ordered') { … … 2985 3169 } 2986 3170 else if ($field === 'connections') { 2987 3171 2988 3172 foreach ($value as $connection) { 2989 3173 if ($connection['id_type'] == $prefs['personCardEmail']) { … … 2998 3182 2999 3183 $jsCodeFinal = implode("\n", $jsCode); 3000 3184 3001 3185 $nEntries = count($result); 3002 3186 3003 3187 if (!$nEntries) 3004 3188 { … … 3018 3202 ); 3019 3203 } 3020 3204 3021 3205 /*********************************************************************\ 3022 3206 * Auxiliar Methods * … … 3024 3208 3025 3209 /*! 3026 3210 3027 3211 @function save_session 3028 3212 @abstract Saves the data on the session 3029 3213 @author Raphael Derosso Pereira 3030 3214 3031 3215 */ 3032 3216 function save_session() … … 3037 3221 3038 3222 /*! 3039 3223 3040 3224 @function convert_tree 3041 3225 @abstract Converts the tree array in the BO format to a JS tree array compatible 3042 3226 with the one available in eGW 3043 3227 @author Raphael Derosso Pereira 3044 3228 3045 3229 @param (array) $tree The tree in the BO format 3046 3230 @param (string) $name The tree name … … 3076 3260 'caption' => $value['name'] 3077 3261 ); 3078 3262 3079 3263 switch($value['type']) 3080 3264 { … … 3099 3283 $this->bo->catalog->src_info = $ldap->srcs[1]; 3100 3284 } 3101 3102 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 3285 3286 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 3103 3287 $dn=$this->bo->catalog->src_info['dn']; 3104 3288 $justThese = array("givenname","givenname","sn","telephonenumber","mail"); 3105 $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 3106 $info = ldap_get_entries($ds, $sr); 3289 $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 3290 $info = ldap_get_entries($ds, $sr); 3107 3291 for($z = 0; $z < 5; $z++) { 3108 $participant = $info[0][$justThese[$z]]; 3292 $participant = $info[0][$justThese[$z]]; 3109 3293 array_push($array_participants, $participant); 3110 3294 } … … 3112 3296 ldap_close($ds); 3113 3297 echo serialize($array_participants); 3114 } 3115 3116 function get_catalog_participants_group($id) 3298 } 3299 3300 function get_catalog_participants_group($id) 3117 3301 { 3118 3302 if(!$this->bo->catalog->src_info) { 3119 3303 $ldap = CreateObject('contactcenter.bo_ldap_manager'); 3120 3304 $this->bo->catalog->src_info = $ldap->srcs[1]; 3121 } 3122 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 3123 $justThese = array("description","memberuid"); 3124 $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 3305 } 3306 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 3307 $justThese = array("description","memberuid"); 3308 $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 3125 3309 $info = ldap_get_entries($ds, $sr); 3126 3310 $member_uids = $info[0]['memberuid']; 3127 3311 $contact['names_ordered'] = $info[0]['description']; 3128 $filter = ""; 3312 $filter = ""; 3129 3313 for($z = 0; $z < count($member_uids); $z++) { 3130 3314 if($member_uids[$z]) 3131 $filter.="(uid=".$member_uids[$z].")"; 3315 $filter.="(uid=".$member_uids[$z].")"; 3132 3316 } 3133 3317 $array_participants = array(); … … 3138 3322 $dn = implode(',',$valarray); 3139 3323 $justThese = array("cn","mail"); 3140 $sr = ldap_search($ds,$dn, $filter,$justThese); 3141 $info = ldap_get_entries($ds, $sr); 3324 $sr = ldap_search($ds,$dn, $filter,$justThese); 3325 $info = ldap_get_entries($ds, $sr); 3142 3326 for($z = 0; $z < $info['count']; $z++) { 3143 3327 $participant = '<font color=\'DARKBLUE\'> "'.$info[$z]['cn'][0].'" <'.$info[$z]['mail'][0].'></font><br>'; 3144 $array_emails[$info[$z]['mail'][0]] = null;3145 array_push($array_participants, $participant); 3328 $array_emails[$info[$z]['mail'][0]] = null; 3329 array_push($array_participants, $participant); 3146 3330 } 3147 3331 ldap_close($ds); 3148 } 3332 } 3149 3333 sort($array_participants); 3150 $innerHTML = ''; 3334 $innerHTML = ''; 3151 3335 foreach($array_participants as $index => $participant){ 3152 3336 $innerHTML .= $participant; 3153 3337 } 3154 $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 3338 $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 3155 3339 echo serialize($return); 3156 3340 } 3157 3341 3158 function get_catalog_participants_list($id) 3342 function get_catalog_participants_list($id) 3159 3343 { 3160 3161 $fields = $this->bo->catalog->get_fields(false); 3344 3345 $fields = $this->bo->catalog->get_fields(false); 3162 3346 $fields['names_ordered'] = true; 3163 $fields['mail_forwarding_address'] = true; 3164 $contact = $this->bo->catalog->get_single_entry($id,$fields); 3165 3347 $fields['mail_forwarding_address'] = true; 3348 $contact = $this->bo->catalog->get_single_entry($id,$fields); 3349 3166 3350 $array_participants = array(); 3167 3351 $array_emails = array(); 3168 3352 3169 3353 $filter = null; 3170 for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) { 3354 for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) { 3171 3355 if(strstr($contact['mail_forwarding_address'][$z],'@')) { 3172 3356 $filter.="(mail=".$contact['mail_forwarding_address'][$z].")"; 3173 3357 $array_emails[$contact['mail_forwarding_address'][$z]] = "<font color=black>".$contact['mail_forwarding_address'][$z]."</font>"; 3174 } 3175 else 3358 } 3359 else 3176 3360 $array_participants[$z] = "<font color=red>".$contact['mail_forwarding_address'][$z]."</font>"; 3177 } 3178 3361 } 3362 3179 3363 if($filter) { 3180 $filter = "(|".$filter.")"; 3364 $filter = "(|".$filter.")"; 3181 3365 if(!$this->bo->catalog->src_info) { 3182 3366 $ldap = CreateObject('contactcenter.bo_ldap_manager'); … … 3184 3368 } 3185 3369 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 3186 3187 3370 $dn=$this->bo->catalog->src_info['dn']; 3188 3371 $justThese = array("cn","mail"); 3189 $sr = ldap_search($ds,$dn, $filter,$justThese); 3190 $info = ldap_get_entries($ds, $sr); 3372 $sr = ldap_search($ds,$dn, $filter,$justThese); 3373 $info = ldap_get_entries($ds, $sr); 3191 3374 for($z = 0; $z < $info['count']; $z++) { 3192 3375 $participant = '<font color=\'DARKBLUE\'> "'.$info[$z]['cn'][0].'" <'.$info[$z]['mail'][0].'></font><br>'; 3193 $array_emails[$info[$z]['mail'][0]] = null; 3194 array_push($array_participants, $participant); 3195 } 3196 3376 $array_emails[$info[$z]['mail'][0]] = null; 3377 array_push($array_participants, $participant); 3378 } 3379 3197 3380 foreach($array_emails as $index => $email) 3198 if($email) 3199 array_push($array_participants, " ".$email."<br>"); 3200 3381 if($email) 3382 array_push($array_participants, " ".$email."<br>"); 3383 3201 3384 ldap_close($ds); 3202 3385 } 3203 3386 sort($array_participants); 3204 $innerHTML = ''; 3387 $innerHTML = ''; 3205 3388 foreach($array_participants as $index => $participant){ 3206 3389 $innerHTML .= $participant; 3207 3390 } 3208 $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 3391 $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 3209 3392 echo serialize($return); 3210 } 3211 3393 } 3394 3212 3395 function export_contacts($typeExport){ 3213 3396 … … 3218 3401 if(!count($contacts)) 3219 3402 echo null; 3220 3403 3404 /**rev 104**/ 3405 // Essa iteraᅵᅵo transforma uma esturuta com contatos redundantes e separados por email ou tel. 3406 // em outra com apenas 1 elemento pra cada contato 3407 /* $i=0; 3408 foreach($contacts as $object){ 3409 $i=($object['id_contact'] - 1); 3410 $all_contacts[$i]['name']=$object['names_ordered']; 3411 if ($object['id_typeof_contact_connection'] == 1) 3412 $all_contacts[$i]['email']=$object['connection_value']; 3413 else 3414 $all_contacts[$i]['phone']=$object['connection_value']; 3415 } 3416 */ 3417 /*****/ 3418 3221 3419 switch($typeExport) { 3222 3420 3223 3421 case 'outlook_en': 3224 3422 $streamBuffer = "Name;E-mail Address;Notes;Mobile Phone;Pager;Company;". 3423 /**rev 104**/ 3424 /* "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 3425 foreach($all_contacts as $index => $object){ 3426 $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;\r\n"; 3427 } 3428 */ 3225 3429 "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 3226 3430 foreach($contacts as $index => $object){ 3227 3431 $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;\r\n"; 3228 3432 } 3433 /*****/ 3229 3434 break; 3230 3435 3231 3436 case 'outlook_pt-BR': 3232 $streamBuffer = "Nome;End. de email;Endereço residencial;". 3233 "Cidade do endereço residencial;CEP do endereço residencial;". 3234 "Estado;País/região do endereço residencial;Telefone residencial;". 3235 "Rua do endereço comercial;Cidade do endereço comercial;". 3236 "CEP do endereço comercial;Estado do endereço comercial;". 3237 "País/região do endereço comercial;Telefone comercial;Empresa;Cargo\r\n"; 3437 $streamBuffer = "Nome;End. de email;Endereï¿œo residencial;". 3438 "Cidade do endereï¿œo residencial;CEP do endereï¿œo residencial;". 3439 "Estado;Paï¿œs/regiï¿œo do endereï¿œo residencial;Telefone residencial;". 3440 "Rua do endereï¿œo comercial;Cidade do endereï¿œo comercial;". 3441 "CEP do endereï¿œo comercial;Estado do endereï¿œo comercial;". 3442 "Paï¿œs/regiï¿œo do endereï¿œo comercial;Telefone comercial;Empresa;Cargo\r\n"; 3443 /**rev 104**/ 3444 // foreach($all_contacts as $index => $object){ 3445 // $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 3238 3446 foreach($contacts as $index => $object){ 3239 3447 $streamBuffer.= $object['names_ordered'].";".$object['connection_value'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 3448 /******/ 3240 3449 } 3241 3450 break; 3242 3451 3243 3452 case 'outlook2000_pt-BR': 3244 3453 $streamBuffer = "\"Tratamento\",\"Nome\",\"Segundo Nome\",\"Sobrenome\",\"Sufixo\",". 3245 "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endere ço comercial\",\"Rua do endereço comercial 2\",".3246 "\"Rua do endere ço comercial 3\",\"Cidade do endereço comercial\",\"Estado do endereço comercial\",".3247 "\"CEP do endere ço comercial\",\"País do endereço comercial\",\"Endereço residencial\",\"Rua residencial 2\",".3248 "\"Rua residencial 3\",\"Cidade do endere ço residencial\",\"Estado\",\"CEP do endereço residencial\",\"País do endereço residencial\",".3249 "\"Outro endere ço\",\"Outro endereço 2\",\"Outro endereço 3\",\"Cidade\",\"Estado\",\"CEP\",\"País\",".3454 "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endereï¿œo comercial\",\"Rua do endereï¿œo comercial 2\",". 3455 "\"Rua do endereï¿œo comercial 3\",\"Cidade do endereï¿œo comercial\",\"Estado do endereï¿œo comercial\",". 3456 "\"CEP do endereï¿œo comercial\",\"Paï¿œs do endereï¿œo comercial\",\"Endereï¿œo residencial\",\"Rua residencial 2\",". 3457 "\"Rua residencial 3\",\"Cidade do endereï¿œo residencial\",\"Estado\",\"CEP do endereï¿œo residencial\",\"Paï¿œs do endereï¿œo residencial\",". 3458 "\"Outro endereï¿œo\",\"Outro endereï¿œo 2\",\"Outro endereï¿œo 3\",\"Cidade\",\"Estado\",\"CEP\",\"Paï¿œs\",". 3250 3459 "\"Telefone do assistente\",\"Fax comercial\",\"Telefone comercial\",\"Telefone comercial 2\",\"Retorno de chamada\",". 3251 3460 "\"Telefone do carro\",\"Telefone principal da empresa\",\"Fax residencial\",\"Telefone residencial\",". 3252 3461 "\"Telefone residencial 2\",\"ISDN\",\"Telefone celular\",\"Outro fax\",\"Outro telefone\",\"Pager\",\"Telefone principal\",". 3253 "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Anivers ário\",\"Anotações\",\"Caixa postal\",\"Categorias\",".3254 "\"C ódigo da empresa\",\"Código do governo\",\"Cônjuge\",\"Conta\",\"Endereço de correio eletrônico\",".3255 "\"Nome de exibi ção do correio eletr.\",\"Endereço de correio eletrônico 2\",".3256 "\"Nome de exibi ção do correio eletr.2\",\"Endereço de correio eletrônico 3\",".3257 "\"Nome de exibi ção do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",".3258 "\"Filhos\",\"Hobby\",\"Idioma\",\"Indica ção\",\"Informações para cobrança\",\"Iniciais\",\"Local\",".3259 "\"Nome do assistente\",\"Nome do gerenciador\",\"P ágina da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",".3260 "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profiss ão\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretório\",".3462 "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Aniversï¿œrio\",\"Anotaᅵᅵes\",\"Caixa postal\",\"Categorias\",". 3463 "\"Cï¿œdigo da empresa\",\"Cï¿œdigo do governo\",\"Cï¿œnjuge\",\"Conta\",\"Endereï¿œo de correio eletrï¿œnico\",". 3464 "\"Nome de exibiᅵᅵo do correio eletr.\",\"Endereï¿œo de correio eletrï¿œnico 2\",". 3465 "\"Nome de exibiᅵᅵo do correio eletr.2\",\"Endereï¿œo de correio eletrï¿œnico 3\",". 3466 "\"Nome de exibiᅵᅵo do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",". 3467 "\"Filhos\",\"Hobby\",\"Idioma\",\"Indicaᅵᅵo\",\"Informaᅵᅵes para cobranï¿œa\",\"Iniciais\",\"Local\",". 3468 "\"Nome do assistente\",\"Nome do gerenciador\",\"Pï¿œgina da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",". 3469 "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissï¿œo\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretï¿œrio\",". 3261 3470 "\"Sexo\"\r\n"; 3471 3472 /**rev 104**/ 3473 //foreach($all_contacts as $index => $object){ 3474 // $streamBuffer.= ",\"".$object['name']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['email']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3262 3475 foreach($contacts as $index => $object){ 3263 3476 $streamBuffer.= ",\"".$object['names_ordered']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,\"".$object['connection_value']."\",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3477 /******/ 3264 3478 } 3265 3479 break; 3266 3480 3267 3481 case 'outlook2000_en': 3268 3482 $streamBuffer = "Title,First Name,Middle Name,Last Name,Suffix,Company,Department,Job Title,". … … 3276 3490 "Gender,Government ID Number,Hobby,Initials,Internet Free Busy,Keywords,Language,Location,Manager's Name,Mileage,Notes,". 3277 3491 "Office Location,Organizational ID Number,PO Box,Priority,Private,Profession,Referred By,Sensitivity,Spouse,User 1,User 2,User 3,User 4,Web Page\r\n"; 3492 3493 /**rev 104**/ 3494 //foreach($all_contacts as $index => $object){ 3495 // $streamBuffer.= ",".$object['name'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['email'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3278 3496 foreach($contacts as $index => $object){ 3279 3497 $streamBuffer.= ",".$object['names_ordered'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,".$object['phone'].",,,,,,,,,,,,".$object['connection_value'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3498 /*******/ 3280 3499 } 3281 3500 break; 3282 3501 3283 3502 case 'thunderbird': 3284 $streamBuffer = "\n"; 3503 $streamBuffer = "\n"; 3504 3505 /**rev 104**/ 3506 //foreach($all_contacts as $index => $object){ 3507 // $streamBuffer.= ",,".$object['name'].",,".$object['email'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3285 3508 foreach($contacts as $index => $object){ 3286 3509 $streamBuffer.= ",,".$object['names_ordered'].",,".$object['connection_value'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 3510 3511 /******/ 3287 3512 } 3288 3513 break; 3289 3514 3290 3515 case 'expresso': 3291 3516 $streamBuffer = "Nome,Email,Telefone\r\n"; 3517 3518 /**rev 104**/ 3519 //foreach($all_contacts as $index => $object){ 3520 // $streamBuffer.= $object['name'].",".$object['email'].",".$object['phone']."\r\n"; 3292 3521 foreach($contacts as $index => $object){ 3293 3522 $streamBuffer.= $object['names_ordered'].",".$object['connection_value'].",".$object['phone']."\r\n"; 3523 3524 /******/ 3294 3525 } 3295 3526 break; 3296 3527 3297 3528 } 3298 3529 … … 3302 3533 if(!$f) 3303 3534 echo null; 3304 3535 3305 3536 fputs($f,$streamBuffer); 3306 3537 fclose($f); … … 3315 3546 $re_d = '\x' . dechex(ord($delimiter)); //format for regexp 3316 3547 $re_tq = '\x' . dechex(ord($text_qualifier)); //format for regexp 3317 3548 3318 3549 $fields = array(); 3319 3550 $field_num = 0; … … 3321 3552 if($text{0} == $text_qualifier) { 3322 3553 preg_match('/^' . $re_tq . '((?:[^' . $re_tq . ']|(?<=\x5c)' . $re_tq . ')*)' . $re_tq . $re_d . '?(.*)$/', $text, $matches); 3323 3554 3324 3555 $value = str_replace('\\' . $text_qualifier, $text_qualifier, $matches[1]); 3325 3556 $text = trim($matches[2]); 3326 3557 3327 3558 $fields[$field_num++] = $value; 3328 3559 } else { 3329 3560 preg_match('/^([^' . $re_d . ']*)' . $re_d . '?(.*)$/', $text, $matches); 3330 3561 3331 3562 $value = $matches[1]; 3332 3563 $text = trim($matches[2]); 3333 3564 3334 3565 $fields[$field_num++] = $value; 3335 3566 } … … 3340 3571 } 3341 3572 3573 //funcao alterada para importar outros campos alem de nome, telefone e email, de arquivo csv (Outlook 2000) 3574 //em 08/04/2009 - Rommel Cysne (rommel.cysne@serpro.gov.br); 3575 //Foi adicionada uma funcao (escapesheelcmd()) nas variaveis para que caracteres especiais sejam ignorados 3576 //durante a importacao dos contatos; o processo estava travando por causa de caracteres em campos como nome, 3577 //sobrenome, notas e e-mail; 3578 //em 19/06/2009 - Rommel Cysne (rommel.cysne@serpro.gov.br); 3342 3579 function import_contacts($typeImport){ 3343 3580 3344 if($file = $_SESSION['contactcenter']['importCSV']) { 3345 unset($_SESSION['contactcenter']['importCSV']); 3581 if($file = $_SESSION['contactcenter']['importCSV']) { 3582 unset($_SESSION['contactcenter']['importCSV']); 3346 3583 $len = filesize($file); 3347 3584 $count = 0; 3348 3585 $return = array('error' => false, '_new' => 0, '_existing' => 0, '_failure' => 0); 3349 3586 $handle = @fopen($file, "r") or die(serialize($return['error'] = true)); 3350 3587 3351 3588 $input_header = fgets($handle); 3352 3589 if ($typeImport == 'outlook') … … 3354 3591 else if ($typeImport == 'auto') 3355 3592 $delim = strstr($input_header,',') ? ',' : ';'; 3356 else 3593 else 3357 3594 $delim = ','; 3358 3595 $csv_header = $this->parse_line($input_header,$delim); 3359 3596 $firstContact = fgets($handle); 3360 3597 preg_match("/\"(.+)\"[,;]/sU",$firstContact,$matches); // yahoo csv 3361 rewind($handle); 3598 rewind($handle); 3362 3599 3363 3600 $header = @fgetcsv($handle, $len, $delim) or die(serialize($return['error'] = true)); … … 3368 3605 return; 3369 3606 } 3370 3607 3371 3608 if ($matches[0][strlen($matches[0])-1] == ';') 3372 3609 $delim = ';'; 3373 3610 3374 3611 $boGroup = CreateObject('contactcenter.bo_group'); 3375 3612 $boPeople = CreateObject('contactcenter.bo_people_catalog'); … … 3377 3614 case 'outlook2000': 3378 3615 $name_pos=1; 3616 $name2_pos=2; 3617 $name3_pos=3; 3618 $addr1_pos=8; 3619 $cep_pos=13; 3620 $addr2_pos=22; 3621 $fax_pos=30; 3622 $phone_pos=31; 3623 $resPhone_pos=37; 3624 $cellPhone_pos=40; 3625 $pager_pos=43; 3626 $birth_pos=48; 3627 $notes_pos=49; 3379 3628 $email_pos=56; 3380 $phone_pos=44; 3629 $altEmail_pos=59; 3630 3381 3631 break; 3382 3632 case 'outlook': 3383 $name_pos= 0;3384 $email_pos= 1;3633 $name_pos=3; 3634 $email_pos=4; 3385 3635 $phone_pos=7; 3636 $resPhone_pos=10; 3637 $cellPhone_pos=12; 3638 $addr1_pos=13; 3639 $cep_pos=15; 3640 $phone_pos=18; 3641 $fax_pos=19; 3642 $pager_pos=20; 3643 $notes_pos=25; 3386 3644 break; 3387 3645 case 'thunderbird': … … 3398 3656 foreach($csv_header as $index => $fieldName) 3399 3657 { 3400 switch( strtoupper($fieldName)){3401 case 'N AME':3402 case 'N OME':3403 case 'F IRST NAME':3658 switch($fieldName){ 3659 case 'Name': 3660 case 'Nome': 3661 case 'First Name': 3404 3662 $name_pos = $index; 3405 3663 break; 3406 case 'E-MAIL': 3407 case 'EMAIL': 3408 case 'E-MAIL ADDRESS': 3409 case 'ENDEREÇO DE CORREIO ELETRÔNICO': 3410 case 'END. DE EMAIL': 3664 case 'Second name': 3665 case 'Segundo nome': 3666 $name2_pos = $index; 3667 break; 3668 case 'Sobrenome': 3669 case 'Surname': 3670 $name3_pos = $index; 3671 break; 3672 case 'Business Street': 3673 case 'Rua do endereço comercial': 3674 $addr1_pos = $index; 3675 break; 3676 case 'Rua do endereço comercial 2': 3677 case 'Outro endereço': 3678 $addr2_pos = $index; 3679 break; 3680 case 'Business Postal Code': 3681 case 'CEP do endereço comercial': 3682 $cep_pos = $index; 3683 break; 3684 case 'Business Fax': 3685 case 'Fax comercial': 3686 case 'Fax': 3687 $fax_pos = $index; 3688 break; 3689 case 'Home Phone': 3690 case 'Telefone residencial': 3691 $resPhone_pos = $index; 3692 break; 3693 case 'Mobile phone': 3694 case 'Telefone celular': 3695 $cellPhone_pos = $index; 3696 break; 3697 case 'Pager': 3698 $pager_pos = $index; 3699 break; 3700 case 'Phone': 3701 case 'Business Phone': 3702 case 'Telefone': 3703 case 'Telefone principal': 3704 case 'Telefone comercial': 3705 $phone_pos = $index; 3706 break; 3707 case 'Aniversário': 3708 case 'Birthdate': 3709 $birth_pos = $index; 3710 case 'Anotações': 3711 case 'Notes': 3712 $notes_pos = $index; 3713 case 'E-mail': 3714 case 'Email': 3715 case 'E-mail Address': 3716 case 'Endereï¿œo de correio eletrï¿œnico': 3717 case 'End. de email': 3411 3718 $email_pos = $index; 3412 3719 break; 3413 case 'HOME PHONE': 3414 case 'PHONE': 3415 case 'TELEFONE': 3416 case 'TELEFONE PRINCIPAL': 3417 case 'TELEFONE COMERCIAL': 3418 $phone_pos = $index; 3720 case 'Endereï¿œo de correio eletrï¿œnico 2': 3721 $altEmail_pos = $index; 3419 3722 break; 3420 3723 } … … 3422 3725 break; 3423 3726 } 3424 3425 3727 3426 3728 while (($data = fgetcsv($handle, $len, $delim))) { 3427 3729 foreach ($header as $key=>$heading) 3428 3730 $row[$heading]=(isset($data[$key])) ? $data[$key] : ''; 3429 3731 3430 3732 $sdata = array(); 3431 $full_name 3733 $full_name = trim($row[$header[$name_pos]]); 3432 3734 $email = trim($row[$header[$email_pos]]); 3433 3735 $phone = trim($row[$header[$phone_pos]]); 3736 $name2 = trim($row[$header[$name2_pos]]); 3737 $name3 = trim($row[$header[$name3_pos]]); 3738 3739 $addr1 = trim($row[$header[$addr1_pos]]); 3740 $addr2 = trim($row[$header[$addr2_pos]]); 3741 $cep = trim($row[$header[$cep_pos]]); 3742 $fax = trim($row[$header[$fax_pos]]); 3743 $resPhone = trim($row[$header[$resPhone_pos]]); 3744 $cellPhone = trim($row[$header[$cellPhone_pos]]); 3745 $pager = trim($row[$header[$pager_pos]]); 3746 $birth = trim($row[$header[$birth_pos]]); 3747 $notes = trim($row[$header[$notes_pos]]); 3748 $altEmail = trim($row[$header[$altEmail_pos]]); 3749 3750 $full_name = escapeshellcmd($full_name); 3434 3751 $array_name = explode(' ', str_replace('"','',(str_replace('\'','',$full_name)))); 3435 $sdata['given_names'] = $array_name[0];3752 $sdata['given_names'] = escapeshellcmd($array_name[0]); 3436 3753 $array_name[0] = null; 3437 3754 $sdata['family_names'] = trim(implode(' ',$array_name)); 3755 if($sdata['family_names'] == '') 3756 { 3757 $sdata['family_names'] = escapeshellcmd($name2) . " " . escapeshellcmd($name3); 3758 } 3759 3438 3760 $sdata['connections']['default_email']['connection_name'] = lang('Main'); 3439 $sdata['connections']['default_email']['connection_value'] = $email;3761 $sdata['connections']['default_email']['connection_value'] = escapeshellcmd($email); 3440 3762 3441 3763 $sdata['connections']['default_phone']['connection_name'] = lang('Main'); 3764 $sdata['connections']['default_phone']['connection_value'] = escapeshellcmd($phone); 3765 3766 $sdata['connections']['fax']['connection_name'] = lang('Fax'); 3767 $sdata['connections']['fax']['connection_value'] = escapeshellcmd($fax); 3768 3769 $sdata['connections']['residencial_phone']['connection_name'] = lang('Residencial'); 3770 $sdata['connections']['residencial_phone']['connection_value'] = escapeshellcmd($resPhone); 3771 3772 $sdata['connections']['cellular_phone']['connection_name'] = lang('Cellphone'); 3773 $sdata['connections']['cellular_phone']['connection_value'] = escapeshellcmd($cellPhone); 3774 3775 $sdata['connections']['pager']['connection_name'] = lang('Pager'); 3776 $sdata['connections']['pager']['connection_value'] = escapeshellcmd($pager); 3777 3778 $sdata['connections']['alternative_email']['connection_name'] = lang('Alternative'); 3779 $sdata['connections']['alternative_email']['connection_value'] = escapeshellcmd($altEmail); 3780 3781 $sdata['addresses']['addr1']['address_value'] = escapeshellcmd($addr1); 3782 $sdata['addresses']['addr2']['address_value'] = escapeshellcmd($addr2); 3783 $sdata['addresses']['cep']['address_value'] = escapeshellcmd($cep); 3784 3785 $array_birth = explode("/",$birth); 3786 3787 $sdata['birthdate'] = escapeshellcmd(date('Y-m-d', mktime(0,0,0,$array_birth[1],$array_birth[0],$array_birth[2]))); 3788 3789 $sdata['notes'] = escapeshellcmd($notes); 3790 $sdata['is_quick_add'] = true; 3442 3791 $sdata['connections']['default_phone']['connection_value'] = $phone; 3443 $sdata['is_quick_add'] = true; 3444 3792 3445 3793 // verifica se email já existe! 3794 $email = escapeshellcmd($email); 3446 3795 $contact = $boGroup->verify_contact($email); 3447 3796 3448 3797 if(!$sdata['given_names'] && $email){ 3449 3798 $a_email = explode("@",$email); 3450 $sdata['given_names'] = $a_email[0];3799 $sdata['given_names'] = escapeshellcmd($a_email[0]); 3451 3800 } 3452 3801 3453 $line_iteration = $return['_failure'] + $return['_existing'] + $return['_new']; 3802 $line_iteration = $return['_failure'] + $return['_existing'] + $return['_new']; 3803 3454 3804 if($contact){ 3455 3805 $return['_existing']++; 3456 } 3457 else if(!eregi("^[ _a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {3806 } 3807 else if(!eregi("^[/_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 3458 3808 $return['_failure']++; 3459 3809 $return['_failure_status'] .= "Line: " . ($line_iteration + 2) . ", Invalid E-Mail address: " . $email ."<br>"; 3460 3810 } 3461 3811 else if (!$sdata['given_names'] || !$email || !$boPeople ->quick_add($sdata)){ 3462 $return['_failure']++; 3812 $return['_failure']++; 3463 3813 $return['_failure_status'] .= "Line: " . ($line_iteration + 2) . ", Invalid Name: " . $sdata['given_names'] ."<br>"; 3464 3814 } 3465 3815 else 3466 3816 $return['_new']++; 3467 } 3817 } 3468 3818 fclose($handle); 3469 3819 unlink($file); … … 3474 3824 echo serialize($return); 3475 3825 } 3476 /*3477 function convert_tree($tree, $name, &$iconDir, $parent='0')3478 {3479 $new = null;3480 $code = null;3481 3482 if ($parent === '0')3483 {3484 3485 $code .= $name.".add(new dNode({id:'0', caption: '".lang('Catalogues')."'}),'none');\n";3486 }3487 3488 foreach ($tree as $id => $value)3489 {3490 $title = $value['name'];3491 3492 switch ($value['type'])3493 {3494 case 'unknown':3495 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption:'{$value['name']}', onFirstOpen: 'getCatalogTree(\\'{$parent}.{$id}\\');', onClick: 'getCatalogTree(\\'{$parent}.{$id}\\'); waitForTree(\\'{$parent}.{$id}\\', 0)'}),'$parent');\n";3496 break;3497 3498 case 'catalog_group':3499 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}'}),'$parent');\n";3500 $code .= $this->convert_tree($value['sub_branch'],$name,$iconDir,$parent.'.'.$id);3501 break;3502 3503 case 'mixed_catalog_group':3504 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}', onClick: 'setCatalog(\\'{$parent}.{$id}\\')'}),'$parent');\n";3505 3506 $code .= $this->convert_tree($value['sub_branch'],$name,$iconDir,$parent.'.'.$id);3507 break;3508 3509 case 'catalog':3510 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}', onClick: 'setCatalog(\\'{$parent}.{$id}\\')'}),'$parent');\n";3511 3512 }3513 }3514 3515 return $code;3516 }3517 */3518 3826 } 3519 3827 -
trunk/contactcenter/js/cc.js
r1517 r1599 61 61 var CC_full_add_const = false; 62 62 var CC_full_add_photo = false; 63 63 64 64 var CC_last_height = window.innerHeight; 65 65 var CC_last_width = window.innerWidth; … … 94 94 photo_input = photo_frame.contentDocument.createElement('input'); 95 95 } 96 96 97 97 photo_frame.id = 'cc_photo_frame'; 98 98 photo_frame.style.position = 'absolute'; … … 100 100 photo_frame.style.top = '600px'; 101 101 photo_frame.style.left = '0px'; 102 102 103 103 photo_form.id = 'cc_photo_form'; 104 104 photo_form.method = 'POST'; 105 105 photo_form.enctype = 'multipart/form-data'; 106 106 107 107 photo_input.id = 'cc_photo_input'; 108 108 photo_input.type = 'file'; 109 109 110 110 if (is_ie) 111 111 { … … 117 117 } 118 118 photo_form.appendChild(photo_input); 119 119 120 120 } 121 121 … … 125 125 var obj = Element(id); 126 126 var max = obj.options.length; 127 127 128 128 if (option == undefined) 129 129 { … … 165 165 function openFullAdd(){ 166 166 // Build the FullAdd Window. 167 if(!fullAddWin && !is_ie) 167 if(!fullAddWin && !is_ie) 168 168 __f(); 169 169 … … 172 172 fullAddWin.open(); 173 173 tabs._showTab('cc_contact_tab_0'); 174 Element("cc_conn_type_1").checked = false; 174 Element("cc_conn_type_1").checked = false; 175 175 Element("cc_conn_type_2").checked = false; 176 176 Element("cc_conn_type_sel").disabled = true; … … 243 243 /************ Edit Group *************/ 244 244 function editGroup(id){ 245 populateEditGroup(id); 245 populateEditGroup(id); 246 ccAddGroup.window.open(); 246 247 } 247 248 … … 253 254 Updates all the constant fields in the 254 255 full add window, like Prefixes, Suffixes, 255 Countries , Types and Shared catalogs256 Countries and Types 256 257 */ 257 258 … … 268 269 return; 269 270 } 270 271 271 272 if (typeof(data[3]) == 'object') 272 273 { … … 298 299 { 299 300 CC_full_add_const = false; 300 301 301 302 setTimeout('populateFullAddConstAsync()', 10); 302 303 } … … 306 307 var handler = function(responseText) 307 308 { 308 //Element('cc_debug').innerHTML = responseText; 309 //Element('cc_debug').innerHTML = responseText; 309 310 var data = unserialize(responseText); 310 311 var i = 1; 311 312 var j; 312 313 313 314 if (typeof(data) != 'object') 314 315 { … … 316 317 return; 317 318 } 318 319 319 320 /* Populate Prefixes */ 320 321 for (j in data[0]) … … 323 324 i++; 324 325 } 325 326 326 327 /* Populate Suffixes */ 327 328 i = 1; … … 345 346 { 346 347 Element('cc_addr_countries').options[i] = new Option(data[3][j], j); 347 348 348 349 if (j == 'BR' || j == 'br') 349 350 { 350 351 CC_br_index = i; 351 352 } 352 353 353 354 i++; 354 355 } 355 356 356 357 /* Populate Connection Types */ 357 358 i = 1; … … 361 362 i++; 362 363 } 363 364 364 365 /* Populate Relations Types */ 365 366 i = 0; … … 369 370 i++; 370 371 } 371 372 372 373 CC_full_add_const = true; 373 374 … … 397 398 //populateRelations(data['relations']); 398 399 }; 399 400 400 Connector.newRequest('populateFullEdit', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_full_data&id=' + id + "&catalog="+catalog, 'GET', handler); 401 401 } … … 416 416 select_contact_list += data['contact_list'] + "</select>"; 417 417 options_contact_list.innerHTML = select_contact_list; 418 419 if(data['id_group']) { 420 Element('title').value = data['title']; 418 419 if(data['id_group']) { 420 Element('title').value = data['title']; 421 421 if(data['contact_in_list']) { 422 422 for(i = 0; i < data['contact_in_list'].length; i++) { … … 425 425 option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')'; 426 426 Element('contact_in_list').options[Element('contact_in_list').options.length] = option; 427 } 428 } 427 } 428 } 429 430 Element('title').value = data['title']; 429 431 } 430 432 … … 439 441 id = typeof(id) == 'undefined' ? id = 0 : id; 440 442 441 ccAddGroup.clear(true); 443 ccAddGroup.clear(true); 442 444 if(!shared) 443 445 Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); … … 445 447 Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id+'&shared_from='+shared, 'GET', handler); 446 448 } 449 447 450 448 451 … … 478 481 return false; 479 482 } 480 483 481 484 /* First thing: Send Photo */ 482 485 if (Element('cc_pd_select_photo').value != '' && !is_ie) … … 496 499 frame = old_frame; 497 500 } 498 501 499 502 frame.id = 'cc_photo_frame'; 500 503 frame.style.visibility = 'hidden'; … … 505 508 506 509 form = frame.contentDocument.createElement('form'); 507 510 508 511 var id_contact = Element('cc_full_add_contact_id').value; 509 512 form.id = 'cc_form_photo'; … … 511 514 form.enctype = 'multipart/form-data'; 512 515 form.action = 'http://'+ document.domain + Element('cc_root_dir').value+'../index.php?menuaction=contactcenter.ui_data.data_manager&method=post_photo&id='+(id_contact != '' && id_contact != 'null' ? id_contact : ''); 513 516 514 517 var input_clone = Element('cc_pd_select_photo').cloneNode(false); 515 518 form.appendChild(input_clone); 516 519 517 520 frame.contentDocument.body.appendChild(form); 518 521 form.submit(); … … 535 538 } 536 539 if (Element('cc_contact_sharing').style.display == 'none') 537 540 setTimeout('postFullAddInfo()', 100); 538 541 else 539 542 setTimeout('postFullAddInfoShared()', 100); … … 561 564 updateCards(); 562 565 }; 566 563 567 Connector.newRequest('postFullAddInfo', CC_url+'post_full_add', 'POST', handler, getFullAddData()); 564 568 } … … 594 598 595 599 data['commercialAnd'] = replacer; 596 600 597 601 if (Element('cc_full_add_contact_id').value != '' && Element('cc_full_add_contact_id').value != 'null') 598 602 { … … 600 604 data.length++; 601 605 } 602 606 603 607 /* Owner do contato (Para o caso de adicao de contato compartilhado) */ 604 608 if (Element('cc_contact_sharing').style.display == 'block') 605 609 { 606 610 var index = Element('cc_contact_shared_types').selectedIndex; 607 data['owner'] = replaceComAnd(owners[index], replacer); 611 data['owner'] = replaceComAnd(owners[index], replacer); 608 612 data.length++; 609 613 } 610 614 611 615 /* Status: Full Added */ 612 616 data['id_status'] = CC_STATUS_FULL_ADD; 613 617 614 618 /* Personal Data */ 615 619 data['alias'] = replaceComAnd(Element('cc_pd_alias').value, replacer); … … 631 635 data['corporate_name'] = replaceComAnd(Element('cc_name_corporate').value, replacer); 632 636 data['job_title'] = replaceComAnd(Element('cc_job_title').value, replacer); 633 data['department'] = replaceComAnd(Element('cc_dep artment').value, replacer);637 data['department'] = replaceComAnd(Element('cc_dept').value, replacer); 634 638 data['web_page'] = replaceComAnd(Element('cc_web_page').value, replacer); 635 639 data.length += 18; 636 640 } 637 638 639 640 641 641 642 /* Addresses */ … … 660 661 data['connections'] = new Array(); 661 662 } 662 663 663 664 for (var i in CC_contact_full_info['connections'][type]) 664 665 { … … 672 673 data['connections']['connection'+connNumber] = new Array(5); 673 674 } 674 675 675 676 data['connections']['connection'+connNumber]['id_connection'] = CC_contact_full_info['connections'][type][i]['id']; 676 677 data['connections']['connection'+connNumber]['id_typeof_connection'] = type; … … 681 682 data['connections']['connection'+connNumber]['connection_is_default'] = 'TRUE'; 682 683 } 683 else 684 else 684 685 data['connections']['connection'+connNumber]['connection_is_default'] = 'FALSE'; 685 686 } 686 687 687 688 // data['connections']['connection'+connNumber].length = 5; 688 689 689 690 empty = false; 690 691 connNumber++; … … 693 694 694 695 } 695 696 696 697 if (!empty) 697 698 { … … 700 701 } 701 702 } 702 703 703 704 if (CC_contact_full_info['removed_conns']) 704 705 { 705 706 empty = false; 706 707 707 708 if (typeof(data['connections']) != 'object') 708 709 { … … 727 728 { 728 729 if (Element('cc_contact_shared_types').disabled == true) 729 { 730 { 730 731 showMessage('Nenhum catálogo compartilhado existente'); 731 732 return false; … … 737 738 } 738 739 } 739 740 740 741 /* Check Personal Data */ 742 741 743 if (Element('cc_pd_given_names').value == '') 742 744 { … … 756 758 for (var i in CC_contact_full_info['connections'][type]){ 757 759 if((CC_contact_full_info['connections'][type][i]['value'].length < 4) || 758 (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 760 (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 759 761 showMessage('Endereço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido'); 760 762 return false; … … 767 769 } 768 770 } 769 771 770 772 } 771 773 … … 776 778 777 779 /********* Personal Data Functions *********/ 778 /* 780 /* 779 781 * data[0] => cc_pd_select_photo 780 782 * data[1] => cc_pd_alias … … 788 790 * data[9] => cc_pd_gpg_finger_print 789 791 * data[10] => cc_pd_notes 790 * data[11] => cc_name_corporate791 * data[12] => cc_job_title792 * data[13] => cc_department793 * data[14] => cc_we_page794 792 */ 795 793 … … 828 826 { 829 827 Element('cc_addr_types').selectedIndex = 0; 830 828 831 829 Element('cc_addr_countries').selectedIndex = 0; 832 830 Element('cc_addr_countries').disabled = true; 833 831 834 832 Element('cc_addr_states').selectedIndex = 0; 835 833 Element('cc_addr_states').disabled = true; … … 882 880 var type = Element('cc_addr_types'); 883 881 var oldSelected = type.value; 884 882 885 883 saveAddressFields(); 886 884 887 885 if (oldSelected == '_NONE_') 888 886 { … … 890 888 return true; 891 889 } 892 890 893 891 CC_addr_last_selected = type.selectedIndex; 894 892 895 893 Element('cc_addr_countries').disabled = false; 896 894 897 895 var data = CC_contact_full_info['addresses']; 898 896 var addrIndex = 'address'+Element('cc_addr_types').value; 899 900 if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') 897 898 if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') 901 899 { 902 900 resetAddressFields(); … … 907 905 return true; 908 906 } 909 907 910 908 var addrTypeID = Element('cc_addr_types').value; 911 909 912 910 data = CC_contact_full_info['addresses'][addrIndex]; 913 911 914 912 Element('cc_addr_id').value = data['id_address'] ? data['id_address'] : ''; 915 913 Element('cc_addr_1').value = data['address1'] ? data['address1'] : ''; … … 933 931 states.selectedIndex = 0; 934 932 clearSelectBox(states, 4); 935 updateAddrCities(); 933 updateAddrCities(); 936 934 return; 937 935 } … … 948 946 { 949 947 var data = unserialize(responseText); 950 948 951 949 clearSelectBox(states, 1); 952 950 953 951 if (typeof(data) != 'object') 954 952 { 955 953 showMessage(Element('cc_msg_err_contacting_server').value); 956 954 957 955 return; 958 956 } … … 961 959 { 962 960 states.disabled = true; 963 cities.disabled = true; 961 cities.disabled = true; 964 962 states.selectedIndex = 0; 965 963 cities.selectedIndex = 0; … … 1001 999 } 1002 1000 }; 1003 1001 1004 1002 Connector.newRequest('populateStates', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_states&country='+Element('cc_addr_countries').value, 'GET', handler); 1005 1003 } … … 1029 1027 newState.disabled = false; 1030 1028 updateAddrNewStateOnMouseOut(); 1031 1029 1032 1030 cities.disabled = false; 1033 1031 clearSelectBox(cities, 3); … … 1040 1038 case '_NOSTATE_': 1041 1039 clearSelectBox(cities, 3); 1042 1040 1043 1041 cities.disabled = false; 1044 1042 cities.selectedIndex = 0; 1045 1043 1046 1044 requestStr = 'country='+Element('cc_addr_countries').value; 1047 1045 break; 1048 1046 1049 1047 default: 1050 1048 requestStr = 'country='+Element('cc_addr_countries').value+'&state='+states.value; … … 1061 1059 { 1062 1060 var cities = Element('cc_addr_cities'); 1063 1061 1064 1062 var handler = function (responseText) 1065 1063 { 1066 1064 var data = unserialize(responseText); 1067 1065 1068 1066 clearSelectBox(cities, 1); 1069 1067 1070 1068 if (typeof(data) != 'object') 1071 1069 { 1072 1070 showMessage(Element('cc_msg_err_contacting_server').value); 1073 1071 1074 1072 return; 1075 1073 } … … 1116 1114 } 1117 1115 }; 1118 1116 1119 1117 Connector.newRequest('populateCities', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cities&'+requestStr, 'GET', handler); 1120 1118 } … … 1122 1120 function updateAddrNewStateOnMouseOver () 1123 1121 { 1124 if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) 1122 if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) 1125 1123 { 1126 1124 Element('cc_addr_states_new').value = ''; … … 1130 1128 function updateAddrNewStateOnMouseOut () 1131 1129 { 1132 if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) 1130 if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) 1133 1131 { 1134 1132 Element('cc_addr_states_new').value = Element('cc_msg_type_state').value; … … 1150 1148 return; 1151 1149 } 1152 1150 1153 1151 Element('cc_addr_1').readonly = false; 1154 1152 Element('cc_addr_1').disabled = false; … … 1180 1178 1181 1179 //resetAddrFillingFields(); 1182 1180 1183 1181 return; 1184 1182 … … 1188 1186 newCity.disabled = false; 1189 1187 updateAddrNewCityOnMouseOut(); 1190 1188 1191 1189 break; 1192 1190 … … 1202 1200 function updateAddrNewCityOnMouseOver () 1203 1201 { 1204 if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) 1202 if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) 1205 1203 { 1206 1204 Element('cc_addr_cities_new').value = ''; … … 1210 1208 function updateAddrNewCityOnMouseOut () 1211 1209 { 1212 if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) 1210 if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) 1213 1211 { 1214 1212 Element('cc_addr_cities_new').value = Element('cc_msg_type_city').value; … … 1224 1222 return true; 1225 1223 } 1226 1227 var addrFields = new Array('cc_addr_1', 1228 'cc_addr_2', 1229 'cc_addr_complement', 1224 1225 var addrFields = new Array('cc_addr_1', 1226 'cc_addr_2', 1227 'cc_addr_complement', 1230 1228 'cc_addr_other', 1231 'cc_addr_postal_code', 1229 'cc_addr_postal_code', 1232 1230 'cc_addr_po_box', 1233 1231 'cc_addr_countries', … … 1236 1234 1237 1235 var empty = true; 1238 1236 1239 1237 for (var i = 0; i < 8; i++) 1240 1238 { … … 1245 1243 } 1246 1244 } 1247 1245 1248 1246 if (empty) 1249 1247 { … … 1274 1272 default: 1275 1273 addrInfo['id_country'] = Element('cc_addr_countries').value; 1276 1274 1277 1275 } 1278 1276 … … 1288 1286 default: 1289 1287 addrInfo['id_state'] = Element('cc_addr_states').value; 1290 1288 1291 1289 } 1292 1290 … … 1301 1299 default: 1302 1300 addrInfo['id_city'] = Element('cc_addr_cities').value; 1303 1304 } 1301 1302 } 1305 1303 1306 1304 addrInfo['id_typeof_address'] = Element('cc_addr_types').options[lastIndex].value; … … 1315 1313 CC_contact_full_info['addresses']['address'+Element('cc_addr_types').options[lastIndex].value] = addrInfo; 1316 1314 1317 if (Element('cc_addr_cities').value == '_NEW_' && 1315 if (Element('cc_addr_cities').value == '_NEW_' && 1318 1316 Element('cc_msg_type_city').value != Element('cc_addr_cities_new').value && 1319 1317 Element('cc_addr_cities_new').value != '') 1320 1318 { 1321 1319 var addrRootInfo = CC_contact_full_info['addresses']['new_cities']; 1322 1320 1323 1321 if (!addrRootInfo) 1324 1322 { 1325 1323 addrRootInfo = new Array(); 1326 1324 } 1327 1325 1328 1326 var i = addrRootInfo.length; 1329 1327 addrRootInfo[addrInfo['id_typeof_address']] = new Array(); … … 1334 1332 } 1335 1333 1336 if (Element('cc_addr_states').value == '_NEW_' && 1337 Element('cc_msg_type_state').value != Element('cc_addr_states_new').value && 1334 if (Element('cc_addr_states').value == '_NEW_' && 1335 Element('cc_msg_type_state').value != Element('cc_addr_states_new').value && 1338 1336 Element('cc_addr_states_new').value != '') 1339 1337 { 1340 1338 var addrRootInfo = CC_contact_full_info['addresses']['new_states']; 1341 1339 1342 1340 if (!addrRootInfo) 1343 1341 { 1344 1342 addrRootInfo = new Array(); 1345 1343 } 1346 1344 1347 1345 var i = addrRootInfo.length; 1348 1346 addrRootInfo[addrInfo['id_typeof_address']] = new Array(); … … 1374 1372 for(idx_conn; idx_conn < cc_conn_default.options.length; idx_conn++) 1375 1373 if(cc_conn_default.options[idx_conn].value == _label) 1376 break; 1377 1374 break; 1375 1378 1376 if(idx_conn == cc_conn_default.options.length) 1379 1377 cc_conn_default.options[idx_conn] = new Option (_label,_label, false,false); 1380 1378 1381 1379 if (!document.all) 1382 1380 { 1383 return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+ 1384 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 1385 '<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' + 1386 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" type="text"> ' + 1387 '<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>'; 1381 if (Element("cc_conn_type_1").checked) 1382 { 1383 return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+ 1384 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 1385 '<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' + 1386 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="100" type="text"> ' + 1387 '<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>'; 1388 } 1389 else if (Element("cc_conn_type_2").checked) 1390 { 1391 return '<td style="position: absolute; left: 0; top: 0; z-index: -1; visibility: hidden"><input id="cc_conn_id_' + CC_conn_count + '" type="hidden" value="_NEW_"><input id="cc_conn_is_default_' + CC_conn_count + '" type="hidden" value="false"></td>'+ 1392 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 1393 '<td style="width: 10px;" align="right"><input id="cc_conn_name_'+CC_conn_count+'" type="hidden"><td style="width: 100px;" align="right"><span style="width: 150px;" id="cc_conn_label_'+CC_conn_count+'">'+_label+'</span></td>' + 1394 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="50" type="text"> ' + 1395 '<img align="top" alt="X" src="templates/default/images/x.png" style="width:18px; height:18px" onclick="javascript:removeConnField(\'cc_conn_tr_' + CC_conn_count + '\')"></td>'; 1396 } 1388 1397 } 1389 1398 else … … 1409 1418 img.align = 'top'; 1410 1419 img.onclick = function(e){ removeConnField(remove_id);}; 1411 1420 1412 1421 for (var i = 0; i < 3; i++) 1413 1422 { … … 1420 1429 1421 1430 inputs[1].id = 'cc_conn_name_'+CC_conn_count; 1422 inputs[1].type = 'hidden'; 1431 inputs[1].type = 'hidden'; 1423 1432 1424 1433 inputs[2].id = 'cc_conn_value_'+CC_conn_count; … … 1449 1458 || typeof(CC_contact_full_info['connections'][CC_conn_last_selected]) == 'undefined' 1450 1459 || typeof(CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]) == 'undefined'); 1451 1452 if(_emptyLine) { 1453 1460 1461 if(_emptyLine) { 1462 1454 1463 if(Element("cc_conn_type_sel").value == '-1'){ 1455 return false; 1456 } 1457 1464 return false; 1465 } 1466 1458 1467 for(k = 0; k < CC_conn_count; k++) { 1459 1468 if(Element("cc_conn_name_"+k) && Element("cc_conn_name_"+k).value != "" && Element("cc_conn_name_"+k).value == Element("cc_conn_type_sel").value) { 1460 1469 alert('Você já possui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!'); 1461 Element("cc_conn_type_sel").options.selectedIndex = 0; 1470 Element("cc_conn_type_sel").options.selectedIndex = 0; 1462 1471 return false; 1463 1472 } 1464 1473 } 1465 } 1474 } 1466 1475 if (!document.all) 1467 1476 { … … 1490 1499 1491 1500 function connRemoveLine(id) 1492 { 1501 { 1493 1502 var p = Element(id).parentNode; 1494 1503 var cc_conn_default = Element("cc_phone_default").style.display == '' ? Element("cc_phone_default") : Element("cc_email_default"); … … 1529 1538 } 1530 1539 } 1531 1540 1532 1541 CC_conn_count = 0; 1533 1542 } … … 1551 1560 function updateConnFields() 1552 1561 { 1553 1562 1554 1563 var connID; 1555 1564 var i; … … 1560 1569 var cc_conn_is_default = ''; 1561 1570 var selected_index = ''; 1562 1571 1563 1572 cc_conn_type_sel.disabled = false; 1564 1573 div_cc_conn_is_default.style.display = ""; 1565 1574 1566 1575 for(var i = 0;i < cc_conn_type_sel.options.length; i++) 1567 cc_conn_type_sel.options[i--] = null; 1568 1576 cc_conn_type_sel.options[i--] = null; 1577 1569 1578 if(Element('cc_conn_type_1').checked) { 1570 1579 var lang_new_email = Element('cc_msg_new_email').value; 1571 1580 var lang_main = Element('cc_msg_main').value; 1572 var lang_alternative = Element('cc_msg_alternative').value; 1573 cc_conn_type_sel[0] = new Option(lang_new_email,'-1'); 1581 var lang_alternative = Element('cc_msg_alternative').value; 1582 cc_conn_type_sel[0] = new Option(lang_new_email,'-1'); 1574 1583 cc_conn_type_sel[1] = new Option(lang_main,lang_main); 1575 cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative); 1584 cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative); 1576 1585 connID = 1; 1577 1586 selected_index = cc_email_default.options.selectedIndex; … … 1581 1590 1582 1591 var lang_select_email = Element('cc_msg_select_email').value; 1583 cc_email_default.options[0] = new Option(lang_select_email,'-1'); 1592 cc_email_default.options[0] = new Option(lang_select_email,'-1'); 1584 1593 cc_phone_default.style.display = 'none'; 1585 cc_email_default.style.display = ''; 1594 cc_email_default.style.display = ''; 1586 1595 cc_conn_is_default = cc_email_default; 1587 1596 } … … 1596 1605 var lang_corporative_fax = Element('cc_msg_corporative_fax').value; 1597 1606 var lang_corporative_pager = Element('cc_msg_corporative_pager').value; 1598 1599 cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1'); 1607 1608 cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1'); 1600 1609 cc_conn_type_sel[1] = new Option(lang_home,lang_home); 1601 cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone); 1610 cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone); 1602 1611 cc_conn_type_sel[3] = new Option(lang_work,lang_work); 1603 1612 cc_conn_type_sel[4] = new Option(lang_fax,lang_fax); … … 1608 1617 cc_conn_type_sel[8] = new Option(lang_corporative_pager, lang_corporative_pager); 1609 1618 } 1610 1619 1611 1620 connID = 2; 1612 1621 selected_index = cc_phone_default.options.selectedIndex; … … 1615 1624 } 1616 1625 1617 var lang_choose_phone = Element('cc_msg_choose_phone').value; 1626 var lang_choose_phone = Element('cc_msg_choose_phone').value; 1618 1627 cc_phone_default.options[0] = new Option(lang_choose_phone,'-1'); 1619 1628 cc_email_default.style.display = 'none'; … … 1621 1630 cc_conn_is_default = cc_phone_default; 1622 1631 } 1623 1632 1624 1633 Element("cc_conn_type_sel").options.selectedIndex = 0; 1625 1634 /* First save the data */ … … 1627 1636 1628 1637 CC_conn_last_selected = connID; 1629 1638 1630 1639 clearConn(); 1631 1640 1632 1641 if (connID == '_NONE_') 1633 1642 { cc_conn_is_default.disabled = true; 1634 1643 return; 1635 1644 } 1636 1645 1637 1646 /* If no data already available, return */ 1638 1647 if (!CC_contact_full_info['connections']) … … 1658 1667 } 1659 1668 } 1660 } 1669 } 1661 1670 if(cc_conn_is_default.options.length > selected_index) 1662 1671 cc_conn_is_default.options.selectedIndex = (selected_index == "-1" ? 0 : selected_index); … … 1679 1688 CC_contact_full_info['connections'][CC_conn_last_selected] = new Array(); 1680 1689 } 1681 else 1690 else 1682 1691 { 1683 1692 delete CC_contact_full_info['connections'][CC_conn_last_selected]; … … 1691 1700 var subNodes = nodes[i].childNodes; 1692 1701 var found = false; 1693 1702 1694 1703 for (var j = 0; j < subNodes.length; j++) 1695 1704 { 1696 if (subNodes[j].childNodes.length > 0 && 1705 if (subNodes[j].childNodes.length > 0 && 1697 1706 subNodes[j].childNodes[0].id) 1698 1707 { … … 1702 1711 CC_contact_full_info['connections'][CC_conn_last_selected][k] = new Array(); 1703 1712 } 1704 1713 1705 1714 if (subNodes[j].childNodes[0].id.indexOf('cc_conn_name') != -1) 1706 1715 { … … 1722 1731 else 1723 1732 { 1724 CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; 1733 CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; 1725 1734 } 1726 1735 } … … 1733 1742 } 1734 1743 } 1735 1744 1736 1745 if (found) 1737 1746 { … … 1750 1759 delete CC_contact_full_info['connections'][CC_conn_last_selected]; 1751 1760 } 1752 1761 1753 1762 } 1754 1763 … … 1776 1785 var number = randomString().toLowerCase(); 1777 1786 var result = ''; 1778 1787 1779 1788 if(!is_ie) 1780 1789 result = prompt("Essa operação removerá TODOS os seus \ncontatos pessoais, e NÃO PODERÁ ser \ndesfeita. Digite o código abaixo:\n\tCódigo de confirmação: "+number); … … 1787 1796 else 1788 1797 alert('Código Incorreto'); 1789 } 1798 } 1790 1799 } 1791 1800 … … 1808 1817 return; 1809 1818 } 1810 1819 1811 1820 if (data['status'] != 'ok') 1812 1821 { … … 1814 1823 return; 1815 1824 } 1816 1825 1817 1826 setTimeout('updateCards()',80);; 1818 1827 }; 1819 1828 1820 1829 typeArg = (type == 'groups' ? 'group' : 'entry'); 1821 1830 1822 1831 Connector.newRequest('removeEntry', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_'+typeArg+'&remove=' + id, 'GET', handler); 1823 1832 } … … 1842 1851 var w_height = 0; 1843 1852 var w_extra = 200; 1844 1853 1845 1854 if (document.body.clientHeight) 1846 1855 { … … 1881 1890 } 1882 1891 } 1892 1883 1893 function getActualPage () 1884 1894 { … … 1945 1955 final_page = 1; 1946 1956 } 1947 1957 1948 1958 html_pages += '<a href="javascript:setPages('+npages+', '+ actual_page +', '+ final_page +')">...</a> '; 1949 1959 1950 1960 page = showing_page ? showing_page : actual_page; 1951 1961 } 1952 1962 1953 1963 for (; page <= npages; page++) 1954 1964 { … … 2010 2020 Element('cc_panel_arrow_last').style.cursor = 'hand'; 2011 2021 } 2012 2022 2013 2023 Element('cc_panel_pages').innerHTML = html_pages; 2014 2024 } … … 2022 2032 for (j = 0; j < 3; j++) 2023 2033 document.getElementById("cc_card:"+j+":"+i).innerHTML = ''; 2024 return false;2025 } 2026 2027 if(type == 'groups' || type == 2034 return false; 2035 } 2036 2037 if(type == 'groups' || type =='shared_groups') 2028 2038 return populateGroupsInCards(data,type); 2029 2039 2030 2040 var pos = 0; 2031 2041 var ncards = data[3].length; 2032 2042 2033 2043 if (typeof(data[3]) == 'object' && ncards > 0) 2034 2044 { … … 2038 2048 { 2039 2049 id = 'cc_card:'+j+':'+i; 2040 2050 2041 2051 for (var k = 0; k < data[2].length; k++) 2042 2052 { … … 2056 2066 break; 2057 2067 } 2058 2068 2059 2069 } 2060 2061 2070 2071 2062 2072 /*if(data[2][k] == 'cc_mail' && data[3][pos][k] == 'none' && !(ccTree.catalog_perms & 2) ) { 2063 2073 Element(id).style.display = 'none'; 2064 2074 continue; 2065 2075 }*/ 2066 2076 2067 2077 if(data[3][pos][k] != 'none') 2068 2078 { … … 2079 2089 Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 2080 2090 } 2081 if(data[3][pos][ 9]){2082 Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][ 9]+"</i></font></span>"; }2091 if(data[3][pos][12]) 2092 Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][12]+"</i></font></span>"; 2083 2093 break; 2084 2094 2085 2095 case 'cc_mail': 2086 2087 2096 if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) 2088 2097 { … … 2092 2101 else 2093 2102 { 2094 Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>'; 2103 Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>'; 2095 2104 } 2096 2105 break; 2097 2106 2098 2107 case 'cc_phone': 2099 2108 if (data[3][pos][k].length > 20) … … 2131 2140 case 'cc_forwarding_address': 2132 2141 var account_type = data[3][pos][k]; 2133 2142 2134 2143 if( !account_type) 2135 2144 break; 2136 2145 2137 2146 Element(id+':cc_icon_group').innerHTML = '<span title="'+Element('cc_participants').value+'" onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value + '\',null,null,null,\''+account_type+'\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/people-mini.png" align="center"> </span>'; 2147 break; 2148 2149 //Para tratar tamanho do campo "celular" do empregado 2150 case 'cc_mobile': 2151 if (data[3][pos][k].length > 20) 2152 { 2153 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 2154 Element(id+':'+data[2][k]).title = data[3][pos][k]; 2155 } 2156 else 2157 { 2158 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 2159 } 2160 Element(id+':cc_mobile').innerHTML = data[3][pos][k]; 2161 break; 2162 2163 //Para tratar tamanho do campo "matricula" do empregado 2164 case 'cc_empNumber': 2165 if (data[3][pos][k].length > 20) 2166 { 2167 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 2168 Element(id+':'+data[2][k]).title = data[3][pos][k]; 2169 } 2170 else 2171 { 2172 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 2173 } 2174 Element(id+':cc_empNumber').innerHTML = data[3][pos][k]; 2175 break; 2176 2177 //Para tratar tamanho do campo "departamento" do empregado 2178 case 'cc_department': 2179 if (data[3][pos][k].length > 15) 2180 { 2181 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); 2182 Element(id+':'+data[2][k]).title = data[3][pos][k]; 2183 } 2184 else 2185 { 2186 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); 2187 } 2188 Element(id+':cc_department').innerHTML = data[3][pos][k]; 2138 2189 break; 2139 2190 … … 2146 2197 else 2147 2198 { 2199 if (Element(id+':'+data[2][k]) == null) alert('É nulo'); 2148 2200 Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 2149 2201 } 2150 2202 } 2151 2203 } 2152 } 2204 } 2205 2153 2206 if (type == "shared_contacts") { 2154 if (data[3][pos][ 8] & 4)2207 if (data[3][pos][11] & 4) 2155 2208 eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedContact(Element('"+id+"' + ':cc_id').value);};"); 2156 2209 else … … 2158 2211 alert(Element('cc_msg_not_allowed').value); 2159 2212 }; 2160 if (data[3][pos][ 8] & 8)2213 if (data[3][pos][11] & 8) 2161 2214 eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value);};"); 2162 2215 else … … 2165 2218 }; 2166 2219 } 2167 2168 2169 2220 2170 2221 if (--ncards == 0) 2171 2222 { … … 2173 2224 i = CC_max_cards[1]; 2174 2225 } 2175 2226 2176 2227 pos++; 2177 2228 } … … 2181 2232 2182 2233 function populateGroupsInCards(data,type) 2183 { 2234 { 2184 2235 var pos = 0; 2185 var contacts = data[5]; 2236 var contacts = data[5]; 2186 2237 var ncards = data[3].length; 2187 2238 2188 2239 if (typeof(data[3]) == 'object' && ncards > 0) 2189 2240 { … … 2193 2244 { 2194 2245 id = 'cc_card:'+j+':'+i; 2195 2246 2196 2247 for (var k = 0; k < data[2].length; k++) 2197 2248 { 2198 2249 2199 2250 if(data[3][pos][k] != 'none') 2200 { 2201 2251 { 2252 2202 2253 switch (data[2][k]) 2203 { 2254 { 2204 2255 case 'cc_title': 2205 2256 if (data[3][pos][k].length > 50) … … 2215 2266 Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][5]+"</i></font></span>"; 2216 2267 break; 2217 2268 2218 2269 case 'cc_short_name': 2219 2270 if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) … … 2227 2278 } 2228 2279 break; 2229 2280 2230 2281 case 'cc_contacts': 2231 2282 … … 2236 2287 var email = ""; 2237 2288 2238 for (var d = 0; d < contacts.length; d++) { 2289 for (var d = 0; d < contacts.length; d++) { 2239 2290 contact += contacts[d]['names_ordered']+ ","; 2240 2291 email += contacts[d]['connection_value']+","; 2241 2292 } 2242 2293 2243 2294 Element(id+':cc_participantes').innerHTML = '<span title="Ver Participantes" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value+'value\', \''+contact+'\', \''+email+'\', \''+title+'\', \''+id_group+'\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img title="Ver participantes" align="center" src="templates/default/images/people-mini.png">  </span>'; 2244 2295 2245 2296 break; 2246 2297 2247 2298 case 'cc_id': 2248 2299 var id_contact = data[3][pos][k]; 2249 2300 Element(id+':'+data[2][k]).value = data[3][pos][k]; 2250 2301 2251 2302 break; 2252 2303 2253 2304 } 2254 2305 } 2255 2306 } 2256 2307 2257 2308 if (type == "shared_groups") { 2258 2309 … … 2269 2320 }; 2270 2321 } 2271 2272 2322 2273 2323 if (--ncards == 0) 2274 2324 { … … 2276 2326 i = CC_max_cards[1]; 2277 2327 } 2278 2328 2279 2329 pos++; 2280 2330 } … … 2305 2355 }; 2306 2356 2307 Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); 2357 Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); 2308 2358 } 2309 2359 … … 2311 2361 { 2312 2362 var coord = new Array(); 2313 2363 2314 2364 //Element('cc_card_space').innerHTML = ''; 2315 2365 //return; … … 2318 2368 //card_space_width = parseInt(is_ie ? document.body.offsetWidth : window.innerWidth) - parseInt(Element('cc_left').offsetWidth) - parseInt(CC_card_extra) - 40; 2319 2369 card_space_height = parseInt(Element('cc_card_space').offsetHeight) - parseInt(CC_card_extra); 2320 2370 2321 2371 card_width = CC_card_image_width + CC_card_extra; 2322 2372 card_height = CC_card_image_height + CC_card_extra; … … 2324 2374 ncols = parseInt(card_space_width / card_width); 2325 2375 nlines = parseInt(card_space_height / card_height); 2326 2376 2327 2377 coord[0] = ncols; 2328 2378 //coord[1] = nlines; … … 2339 2389 if(type == 'groups' || type == 'shared_groups') { 2340 2390 html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 2341 '<div style="border: 0px solid #999; position: relative;">' + 2391 '<div style="border: 0px solid #999; position: relative;">' + 2342 2392 '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2343 2393 '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' + 2344 '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' + 2394 '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' + 2345 2395 '<span id="' + id + ':cc_title" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 2346 2396 '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + … … 2348 2398 '<input id="' + id + ':cc_id" type="hidden">' + 2349 2399 '</div>' + '</td>'; 2350 2400 2351 2401 } 2352 2402 else { 2353 2403 html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 2354 2404 '<div style="border: 0px solid #999; position: relative;">' + 2355 '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2405 '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2356 2406 ( ccTree.catalog_perms == 1 ? 2357 2407 '<span id="' + id + ':cc_icon_data" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1"></span>':'') + … … 2359 2409 '<img title="'+Element('cc_msg_card_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editContact(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' + 2360 2410 '<img title="'+Element('cc_msg_card_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' : '') + 2361 '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2411 '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2362 2412 '<span id="' + id + ':cc_company" style="position: absolute; top: 5px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 14px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_company_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_company_full\').style.visibility=\'hidden\'"></span>' + 2363 '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px" valign="bottom" id="' + id + ':cc_icon_group"> </span>'+ 2364 '<span id="' + id + ':cc_name" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 2365 '<span id="' + id + ':cc_title" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' + 2366 '<span id="' + id + ':cc_phone" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2367 '<span id="' + id + ':cc_mail" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2368 '<span id="' + id + ':cc_alias" style="position: absolute; top: 95px; left: 10px; width: 60px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' + 2413 '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px" valign="bottom" id="' + id + ':cc_icon_group"> </span>'+ 2414 //Para exibir a matricula do empregado nos cartoes 2415 '<span id="' + id + ':cc_empNumber" style="position: absolute; top: 15px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' + 2416 '<span id="' + id + ':cc_name" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 2417 '<span id="' + id + ':cc_title" style="position: absolute; top: 50px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' + 2418 //Para exibir o setor/lotacao do empregado nos cartoes 2419 '<span id="' + id + ':cc_department" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2420 '<span id="' + id + ':cc_phone" style="position: absolute; top: 75px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2421 //Para exibir o celular empresarial do empregado na tabela 2422 '<span id="' + id + ':cc_mobile" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2423 '<span id="' + id + ':cc_mail" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2424 '<span id="' + id + ':cc_alias" style="position: absolute; top: 95px; left: 10px; width: 60px; border: 0px solid #999; font-weight: normal; font-size: 9px; text-align: center; height: 10px;"></span>' + 2369 2425 '<input id="' + id + ':cc_id" type="hidden">' + 2370 2426 '</div>' + '</td>'; 2371 } 2372 2427 2428 /*} else { 2429 html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 2430 '<div style="border: 0px solid #999; position: relative;">' + 2431 '<img src="templates/default/images/card.png" border="0" width="' + CC_card_image_width +'" height="' + CC_card_image_height + '"i ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2432 '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style="position: absolute; top: 35px; left: 222px; width: 18px; height: 18px; cursor: pointer; cursor: hand; z-index: 1" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" onmouseover="resizeIcon(\''+id+':cc_card_edit\',0)" onmouseout="resizeIcon(\''+id+':cc_card_edit\',1)" src="templates/default/images/cc_card_edit.png">' + 2433 '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="position: absolute; top: 78px; left: 223px; width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" onmouseover="resizeIcon(\''+id+':cc_card_remove\',0)" onmouseout="resizeIcon(\''+id+':cc_card_remove\',1)" src="templates/default/images/cc_x.png">' + 2434 '<span id="' + id + ':cc_title" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 2435 '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + 2436 '<span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_short_name" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2437 '<input id="' + id + ':cc_id" type="hidden">' + 2438 '</div>' + '</td>';*/ 2439 } 2373 2440 2374 2441 return html_card; … … 2391 2458 ' | '+ 2392 2459 '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" src="templates/default/images/cc_x.png">' + 2393 '<input id="' + id + ':cc_id" type="hidden">'+ 2460 '<input id="' + id + ':cc_id" type="hidden">'+ 2394 2461 '</td></tr>'; 2395 2396 2397 } 2398 else { 2399 html_card = '<tr style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' + 2400 '<span valign="bottom" id="' + id + ':cc_icon_group"> </span><span id="' + id + ':cc_name"></span></td>' + 2401 '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_mail"></span></td>' + 2402 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + 2462 2463 // if(type != 'groups'||type=='shared_groups') { 2464 } 2465 else { 2466 html_card = '<tr style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE">' + 2467 //Para exibir a matricula do empregado na tabela 2468 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_empNumber"></span></td>' + 2469 '<td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;"><span valign="bottom" id="' + id + ':cc_icon_group"> </span><span id="' + id + ':cc_name"></span></td>' + 2470 '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_name\').innerHTML" id="' + id + ':cc_mail"></span></td>' + 2471 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + 2472 //Para exibir o celular empresarial do empregado na tabela 2473 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' + 2474 //Para exibir o setor/lotacao do empregado na tabela 2475 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_department"></span></td>' + 2476 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' + 2477 '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_name\').innerHTML" id="' + id + ':cc_mail"></span></td>' + 2403 2478 ( ccTree.catalog_perms == 1 ? 2404 2479 '<td align="left"><span valign="bottom" id="' + id + ':cc_icon_data"></span></td>':'') + … … 2416 2491 '</td></tr>'; 2417 2492 } 2493 /*else { 2494 html_card = '<tr width="40%" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' + 2495 '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1"></span>' + 2496 '<span id="' + id + ':cc_title"></span></td>' + 2497 '<td width="40%" style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_title\').innerHTML" id="' + id + ':cc_short_name"></span></td>' + 2498 '<td align="left" width="55px">'+ 2499 '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style=" cursor: pointer; cursor: hand; z-index: 1;width: 18px; height: 18px;" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" src="templates/default/images/cc_card_edit.png">' + 2500 ' | '+ 2501 '<img title="'+Element('cc_msg_group_remove').value+'" id="' + id + ':cc_card_remove" style="width: 15px; height: 14px; cursor: pointer; cursor: hand; z-index: 1" onclick="removeEntry(Element(\'' + id + ':cc_id\').value,\'groups\');" src="templates/default/images/cc_x.png">' + 2502 '<input id="' + id + ':cc_id" type="hidden">'+ 2503 '</td></tr>'; 2504 }*/ 2418 2505 2419 2506 return html_card; … … 2423 2510 { 2424 2511 var pos; 2425 2512 2426 2513 html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1"><table width="100%" border="0" cellpadding="0" cellspacing="3">'; 2427 2514 2428 2515 if (ncards > 0) 2429 2516 { … … 2445 2532 if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 2446 2533 html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 2447 } 2534 } 2448 2535 else if (CC_max_cards != 0) 2449 2536 { … … 2465 2552 html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1">'; 2466 2553 html_cards += '<table border="0" cellpadding="0" cellspacing="' + CC_card_extra + '">'; 2467 2554 2468 2555 if (ncards > 0) 2469 2556 { … … 2484 2571 if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 2485 2572 html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 2486 } 2573 } 2487 2574 else if (CC_max_cards != 0) 2488 2575 { … … 2521 2608 else if(CC_visual == 'table') 2522 2609 drawTable(0); 2523 2610 2524 2611 setPages(0,0); 2525 2612 return; 2526 2613 } 2527 2528 2614 2529 2615 var handler = function (responseText) … … 2532 2618 data = unserialize(responseText); 2533 2619 if (data[0] == '0') 2534 { 2535 Element('cc_type_contact').value = data[1]; 2620 { 2621 Element('cc_type_contact').value = data[1]; 2536 2622 CC_npages = 0; 2537 2623 CC_actual_page = 1; … … 2545 2631 else 2546 2632 Element('cc_type_contact').value = data[10]; 2547 2548 // Element('cc_debug').innerHTML = responseText; 2549 2633 2634 // Element('cc_debug').innerHTML = responseText; 2635 2550 2636 if (typeof(data) != 'object') 2551 2637 { … … 2553 2639 return; 2554 2640 } 2555 2641 2556 2642 if (typeof(data[3]) == 'object') 2557 2643 { … … 2566 2652 qtd_compartilhado = data[9]; 2567 2653 CC_npages = parseInt(data[0]); 2568 CC_actual_page = parseInt(data[1]); 2654 CC_actual_page = parseInt(data[1]); 2569 2655 if(CC_visual == 'cards') 2570 2656 drawCards(data[3].length, data[10]); … … 2574 2660 populateCards(data, data[10]); 2575 2661 setPages(data[0], data[1]); 2576 2662 2663 } 2664 else if (data['error']) 2665 { 2666 showMessage(data['error']); 2577 2667 } 2578 2668 else … … 2586 2676 Connector.newRequest('showCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler, info); 2587 2677 } 2678 2588 2679 2589 2680 function clearCards() … … 2610 2701 var table_h = Element('cc_panel_table'); 2611 2702 var cards_h = Element('cc_panel_cards'); 2612 2703 2613 2704 switch (type) 2614 2705 { … … 2623 2714 break; 2624 2715 } 2625 2716 2626 2717 CC_visual = type; 2627 2718 showCards(getActualLetter(), getActualPage()); 2628 2719 } 2629 2720 2630 function ccSearchUpdate(ids)2721 /*function ccSearchUpdate(ids) 2631 2722 { 2632 2723 Element('cc_panel_letters').style.display = 'none'; 2633 2724 Element('cc_panel_search').style.display = 'inline'; 2634 2725 2635 2726 if(CC_visual == 'cards') 2636 2727 drawCards(0); … … 2640 2731 if (!ids) 2641 2732 { 2642 ccSearchHide();2733 //ccSearchHide(); 2643 2734 return; 2644 2735 } 2645 2736 2646 2737 var sIds = serialize(ids); 2647 2738 … … 2651 2742 } 2652 2743 showCards('search', '1', sIds); 2744 } 2745 */ 2746 2747 function ccSearchUpdate() 2748 { 2749 Element('cc_panel_letters').style.display = 'none'; 2750 Element('cc_panel_search').style.display = 'inline'; 2751 2752 if(CC_visual == 'cards') 2753 drawCards(0); 2754 else if(CC_visual == 'table') 2755 drawTable(0); 2756 2757 if (CC_actual_letter != 'search') 2758 { 2759 CC_last_letter = CC_actual_letter; 2760 } 2761 //showCards('search', '1', sIds); 2653 2762 } 2654 2763 … … 2693 2802 data[3] = Element('cc_qa_phone').value; 2694 2803 data[4] = Element('cc_qa_email').value; 2804 2805 return data; 2806 } 2807 2808 function sendQuickAdd () 2809 { 2810 var data = getQuickAdd(); 2811 2812 var str = serialize(data); 2813 2814 if (!str) 2815 { 2816 return false; 2817 } 2818 2819 var handler = function (responseText) 2820 { 2821 setTimeout('updateCards()',100);; 2822 } 2823 2824 resetQuickAdd(); 2825 2826 Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str)); 2827 } 2828 2695 2829 2696 return data;2697 }2698 2699 function sendQuickAdd ()2700 {2701 var data = getQuickAdd();2702 2703 var str = serialize(data);2704 2705 if (!str)2706 {2707 return false;2708 }2709 2710 var handler = function (responseText)2711 {2712 setTimeout('updateCards()',100);;2713 }2714 2715 resetQuickAdd();2716 2717 Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str));2718 }2719 2720 2830 function connectVoip (phoneUser, typePhone){ 2721 2831 var handler_voip = function (responseText){ … … 2724 2834 } 2725 2835 else{ 2726 2836 data = unserialize(responseText); 2727 2837 alert("Requisitando chamada para o ramal: "+data); 2728 2838 } 2729 2839 } 2730 2840 Connector.newRequest('voip', "../../expressoMail1_2/controller.php?action=expressoMail1_2.functions.callVoipconnect&to="+phoneUser+"&typePhone="+typePhone, 'POST', handler_voip);
Note: See TracChangeset
for help on using the changeset viewer.