Changeset 284 for trunk/contactcenter
- Timestamp:
- 05/21/08 16:56:17 (16 years ago)
- Location:
- trunk/contactcenter
- Files:
-
- 7 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contactcenter/doc/change_log.txt
r56 r284 3 3 Nilton Emilio Buhrer Neto. 4 4 5 --------------------------- NOTA IMPORTANTE --------------------------6 5 7 A partir de Agosto de 2007, todos os registros de bugs aqui relatados foram8 transferidos para o site do ExpressoLivre, no Wiki-Trac do módulo.9 Vide: http://www.expressolivre.org/dev/wiki/contactcenter/changelog10 11 ----------------------------------------------------------------------12 6 27/02/2007 - [1.0.005] 13 7 - Excluído o diretorio contactcenter/templates/celepar e seus arquivos foram movidos para -
trunk/contactcenter/inc/class.bo_catalog_group_catalog.inc.php
r2 r284 20 20 21 21 include_once('class.abo_catalog.inc.php'); 22 22 23 23 class bo_catalog_group_catalog extends abo_catalog 24 24 { 25 25 26 var $external; 27 26 28 var $fields = array( 27 29 'id_contact' => true, … … 38 40 'pgp_key' => true, 39 41 'notes' => true, 40 42 41 43 /* Array fields */ 42 44 'companies' => true, … … 45 47 'connections' => true 46 48 ); 47 48 /*! 49 49 50 /*! 51 50 52 @function bo_people_catalog 51 53 @abstract Constructor 52 54 @author Raphael Derosso Pereira 53 55 54 56 */ 55 function bo_catalog_group_catalog(& $bo_contactcenter, & $catalog )57 function bo_catalog_group_catalog(& $bo_contactcenter, & $catalog, $external = 0) 56 58 { 57 59 $this->bo_contactcenter = & $bo_contactcenter; 58 60 $this->catalog = & $catalog; 59 } 60 61 $this->external = $external; 62 } 63 61 64 62 65 /*! … … 68 71 69 72 @param SEE class bo_contactcenter for usage 70 73 71 74 */ 72 75 function find($what, $rules, $other) … … 74 77 if ($ldap_info = $this->catalog['ldap']) 75 78 { 76 $meta_catalog =& CreateObject('contactcenter.bo_global_ldap_catalog',$ldap_info['id_source'], $ldap_info['context']); 79 80 $meta_catalog =& CreateObject('contactcenter.bo_global_ldap_catalog',$ldap_info['id_source'], $ldap_info['context'], $this->external); 77 81 return $meta_catalog->find($what, $rules, $other); 78 82 } 79 83 80 84 $results = array(); 81 85 82 86 reset($this->catalog); 83 87 while(list(, $new_catalog) = each($this->catalog['sub_branch'])) … … 86 90 //echo 'Setting catalog: <b>'.$new_catalog['name'].'</b><br>'; 87 91 $new_catalog = $this->bo_contactcenter->set_catalog($new_catalog); 88 92 89 93 //if($new_catalog) echo 'Setado corretamente!<br><br>'; else echo 'Erro ao setar<br><br>'; 90 94 91 95 if ($new_catalog['type'] === 'empty') 92 96 { 93 97 continue; 94 98 } 95 99 96 100 $temp_res = $this->bo_contactcenter->catalog->find($what, $rules, $other); 97 101 if (is_array($temp_res) and count($temp_res)) … … 107 111 return $result; 108 112 } 109 110 /*! 111 113 114 /*! 115 112 116 @function get_single_entry 113 117 @abstract Returns all information requested about one contact 114 118 @author Raphael Derosso Pereira 115 119 116 120 @param integer $id_contact The contact ID 117 121 @param array $fields The array returned by get_fields whith true 118 122 on the fields to be taken. 119 123 120 124 */ 121 125 function get_single_entry ( $id_contact, $fields ) 122 { 123 if (!is_array($fields)) 124 { 125 if (is_object($GLOBALS['phpgw']->log)) 126 { 127 if (!is_array($fields)) 128 { 129 if (is_object($GLOBALS['phpgw']->log)) 126 130 { 127 131 $GLOBALS['phpgw']->log->message(array( … … 129 133 'line' => __LINE__, 130 134 'file' => __FILE__)); 131 135 132 136 $GLOBALS['phpgw']->log->commit(); 133 137 } 134 else 138 else 135 139 { 136 140 exit('Argument Error on: <br>File:'.__FILE__.'<br>Line:'.__LINE__.'<br>'); 137 141 } 138 142 } 139 143 140 144 $contact_array = $this->get_multiple_entries(array($id_contact), $fields); 141 145 142 146 if (!count($contact_array)) 143 147 { … … 149 153 else 150 154 $contact_data = $contact_array[$id_contact]; 151 155 152 156 if (!is_array($contact_data)) 153 157 { 154 158 return false; 155 159 } 156 160 157 161 return $contact_data; 158 162 } 159 160 /*! 161 163 164 /*! 165 162 166 @function get_multiple_entries 163 167 @abstract Returns multiple Contacts data into one array … … 172 176 'sort' => <sort>, 173 177 'order_by' => <order by> 174 ); 175 178 ); 179 176 180 */ 177 181 function get_multiple_entries ( $id_contacts, $fields, $other_data = false ) … … 179 183 if (!is_array($id_contacts) or !is_array($fields) or ($other_data != false and !is_array($other_data))) 180 184 { 181 if (is_object($GLOBALS['phpgw']->log)) 185 if (is_object($GLOBALS['phpgw']->log)) 182 186 { 183 187 $GLOBALS['phpgw']->log->message(array( … … 185 189 'line' => __LINE__, 186 190 'file' => __FILE__)); 187 191 188 192 $GLOBALS['phpgw']->log->commit(); 189 193 } … … 192 196 } 193 197 } 194 198 195 199 $contacts = array(); 196 200 197 201 if ($other_data) 198 202 { 199 203 //TODO 200 204 } 201 205 206 //error_log("bo_ldap_catalog_group_catalog->get_multiple_entries \n", 3, '/var/www/teste.log'); 207 202 208 /* First check if this is a LDAP Catalog Group. In this case, just leave the 203 209 * subtree search for the LDAP server … … 205 211 if ($ldap_info = $this->catalog['ldap']) 206 212 { 207 $meta_catalog = CreateObject('contactcenter.bo_global_ldap_catalog', $ldap_info['id_source'], $ldap_info['context'] );213 $meta_catalog = CreateObject('contactcenter.bo_global_ldap_catalog', $ldap_info['id_source'], $ldap_info['context'], $this->external); 208 214 return $meta_catalog->get_multiple_entries($id_contacts, $fields, $other_data); 209 215 } 210 216 211 217 /* Search for the catalog of the first entry and try to get all ids from that 212 218 * catalog. Repeat to the ones not found until there's none missing or no more … … 220 226 $this->bo_contactcenter->set_catalog($branch); 221 227 $contacts += $this->bo_contactcenter->catalog->get_multiple_entries($id_contacts, $fields, $other_data); 222 228 223 229 reset($contacts); 224 230 while (list($id) = each($contacts)) … … 237 243 238 244 $this->bo_contactcenter->set_catalog($this->catalog); 239 245 240 246 return $contacts; 241 247 } 242 248 243 249 function get_all_entries_ids () 244 250 { … … 246 252 return null; 247 253 } 248 254 249 255 /*********************************************************************\ 250 256 * Methods to get general fields * 251 257 \*********************************************************************/ 252 258 253 259 /*********************************************************************\ 254 260 * Methods to Include Data * -
trunk/contactcenter/inc/class.bo_contactcenter.inc.php
r2 r284 5 5 * Written by: * 6 6 * - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> * 7 * sponsored by Thyamad - http://www.thyamad.com 7 * sponsored by Thyamad - http://www.thyamad.com * 8 8 * ------------------------------------------------------------------------- * 9 9 * This program is free software; you can redistribute it and/or modify it * … … 25 25 */ 26 26 var $catalog; 27 27 28 28 /*! 29 29 The Security Manager 30 30 */ 31 31 var $security; 32 32 33 33 34 34 function bo_contactcenter($catalog=false) … … 37 37 $this->catalog_level = $GLOBALS['phpgw']->session->appsession('bo_contactcenter.catalog_level','contactcenter'); 38 38 $this->security = CreateObject('contactcenter.bo_security_manager'); 39 39 40 40 if ($catalog) 41 41 { … … 56 56 } 57 57 } 58 59 /*! 60 58 59 /* 60 * 61 * @function is_external 62 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 63 * @abstract Verify if a catalog is external 64 * @param (mixed) an catalog array or a catalog tree level, a string in the form 0.sublevel.subsublevel 65 * @return (boolean) true if it is an external catalog false otherwise 66 * 67 */ 68 69 function is_external($catalog) 70 { 71 if (is_array($catalog)) 72 { 73 $level = $this->get_level_by_branch($catalog, $this->tree['branches']); 74 } 75 else 76 { 77 $level = $catalog; 78 } 79 80 $lvl_vector = explode('.', $level); 81 $id = $lvl_vector[1]; 82 83 if ($this->tree['branches'][$id]['external']) 84 { 85 return true; 86 } 87 88 return false; 89 90 } 91 92 /* 93 function get_letters_filter($catalog) 94 { 95 96 } 97 98 function get_numbers_filter($catalog) 99 { 100 101 } 102 103 function get_search_filter($catalog) 104 { 105 106 } 107 */ 108 109 /*! 110 61 111 @function find 62 112 @abstract Performs a search in the DB based on the parameters 63 113 @author Raphael Derosso Pereira (algorithm and code) 64 114 @author Vinicius Cubas Brand (algorithm) 65 115 66 116 @param array $what The list of fields to be returned. The format is: 67 117 $what = array( … … 69 119 'contact.names_ordered' 70 120 ); 71 121 72 122 @param array $rules The restrictions. 73 123 74 124 The restrictions format is quite complicated, but is very complete. 75 125 As defined here, there is the possibility to do almost any type of 76 126 search (tell me if you can't do any). For example, imagine the 77 127 following search: 78 128 79 129 and(a,or(d,e,and(f,g))) 80 130 81 131 That is represented by the folloowing tree: 82 132 83 133 and 84 134 | … … 98 148 The rules that should be passed to the find function for this tree 99 149 is: 100 150 101 151 $rules = array( 102 152 0 => array( … … 139 189 ); 140 190 141 142 The restriction type can be: =, !=, <=, <, >, >=, NULL, IN, LIKE, 191 192 The restriction type can be: =, !=, <=, <, >, >=, NULL, IN, LIKE, 143 193 NOT NULL, NOT IN, NOT LIKE 144 194 Value of branch can be AND, OR, NOT 145 146 @param array $other Other parameter to the search 195 196 @param array $other Other parameter to the search 147 197 $other = array( 148 198 'offset' => (int), … … 154 204 155 205 @return array $array[<field_name>][<row_number>] 156 206 157 207 */ 158 208 function find($what, $rules=false, $other=false) … … 160 210 return $this->catalog->find($what, $rules, $other); 161 211 } 162 163 /*! 164 212 213 /*! 214 165 215 @function get_catalog_tree 166 216 @abstract Returns an array describing the available … … 168 218 values and types 169 219 @author Raphael Derosso Pereira 220 @author Mário César Kolling (external catalogs and optimizations) 170 221 171 222 @param (string) $level The level to be taken 172 223 @param (boolean) $recursive Retrive the whole tree from 173 224 the level specified until the leaves 174 225 175 226 @return The format of the return is: 176 227 $return = array( … … 195 246 1 => array(...),... 196 247 ); 197 248 198 249 <branch_type> can be 'catalog_group', 'catalog' or 'view'; 199 <branch_class> is the name of the class that is capable of 250 <branch_class> is the name of the class that is capable of 200 251 handling the information for this catalog/view 201 252 <branch_class_args> is an array that holds the arguments to … … 203 254 <brach_find_args> is the string that should precede the search 204 255 string 205 206 If the branch is actually a leaf, than 'sub_branch' is false; 207 208 256 257 If the branch is actually a leaf, than 'sub_branch' is false; 258 259 209 260 TODO: This method is hard-coded, but it should grab the tree 210 261 from the DB using the View Manager... … … 218 269 return $this->tree['branches']; 219 270 } 220 271 272 $lvl_vector = explode('.', $level); 273 $id = $lvl_vector[1]; 274 221 275 $branch =& $this->get_branch_by_level($level); 222 276 $info = $this->get_info_by_level($level); 223 277 224 278 if ($branch['type'] === 'unknown') 225 279 { … … 227 281 { 228 282 $ldap = CreateObject('contactcenter.bo_ldap_manager'); 229 $new_branch = $ldap->get_ldap_tree($info['src'], $branch['value'], $recursive); 230 283 284 if ($this->tree['branches'][$id]['external']) 285 { 286 // if it's an external catalog 287 $new_branch = $ldap->get_external_ldap_tree($info['src'], $branch['value'], $recursive); 288 } 289 else 290 { 291 // if it's not an external catalog 292 $new_branch = $ldap->get_ldap_tree($info['src'], $branch['value'], $recursive); 293 } 294 231 295 if ($new_branch) 232 296 { 297 if (!empty($new_branch['timeout']) && !empty($new_branch['msg'])) 298 { 299 return $new_branch; 300 } 301 302 // Necessary for the new way the catalog tree is built at initialization 303 $new_branch['name'] = $branch['name']; 304 $new_branch['external'] = $branch['external']; 233 305 $branch = $new_branch; 306 234 307 } 235 308 else … … 239 312 } 240 313 $GLOBALS['phpgw']->session->appsession('bo_contactcenter.tree','contactcenter',$this->tree); 241 242 314 return $branch; 243 315 } … … 246 318 return $branch; 247 319 } 248 320 249 321 return false; 250 322 } 251 323 252 324 if ($level !== '0') 253 325 { 254 326 return false; 255 327 } 256 328 257 329 $this->tree = array( 258 330 0 => array( … … 275 347 'sub_branch' => false 276 348 ),*/ 277 349 278 350 1 => array( 279 351 'name' => lang('Groups'), … … 281 353 'class' => 'bo_group_manager', 282 354 'icon' => 'people-mini.png', 283 'sub_branch' => False 355 'sub_branch' => False 284 356 ) 285 357 ) 286 358 ); 287 359 288 360 $ldap = CreateObject('contactcenter.bo_ldap_manager'); 289 361 $ldap_srcs = $ldap->get_all_ldap_sources(); 290 362 291 363 if ($ldap_srcs) 292 364 { … … 297 369 if (($tree = $ldap->get_ldap_tree($id, $ldap_srcs[$id]['dn'], $recursive))) 298 370 { 371 // It isn't used anymore, but does no harm! 372 // It may be usefull later for use with search timeouts, or another ldap error 373 if (array_key_exists('error_msg', $tree)) 374 { 375 if (isset($this->tree['branches']['msg'])) 376 { 377 $this->tree['branches']['msg'] .= "\n" . lang('Catalog %1 not showed due to error: ' . 378 $tree['error_msg'], $ldap_srcs[$id]['name']); 379 } 380 else 381 { 382 $this->tree['branches']['msg'] = lang('Catalog %1 not showed due to error: ' . 383 $tree['error_msg'], $ldap_srcs[$id]['name']); 384 } 385 } 386 else 387 { 388 $tree['name'] = $ldap_srcs[$id]['name']; 389 $tree['external'] = false; 390 array_push($this->tree['branches'], $tree); 391 $this->tree[$i]['type'] = 'ldap'; 392 $this->tree[$i]['src'] = $id; 393 } 394 395 } 396 $i++; 397 } 398 } 399 400 // external LDAP sources 401 $ldap_srcs = $ldap->get_external_ldap_sources(); 402 403 if ($ldap_srcs) 404 { 405 $i = count($this->tree); 406 407 reset($ldap_srcs); 408 409 while (list($id,) = each($ldap_srcs)) 410 { 411 // External catalogs are now identified as type unknown during initialization. An optimization change. 412 413 /* 414 if (($tree = $ldap->get_external_ldap_tree($id, $ldap_srcs[$id]['dn'], $recursive))) 415 { 416 if (array_key_exists('error_msg', $tree)) 417 { 418 if (isset($this->tree['branches']['msg'])) 419 { 420 $this->tree['branches']['msg'] .= "\n" . lang('Catalog %1 not showed due to error: ' . 421 $tree['error_msg'], $ldap_srcs[$id]['name']); 422 } 423 else 424 { 425 $this->tree['branches']['msg'] = lang('Catalog %1 not showed due to error: ' . 426 $tree['error_msg'], $ldap_srcs[$id]['name']); 427 } 428 } 429 430 else 431 { 432 */ 299 433 $tree['name'] = $ldap_srcs[$id]['name']; 434 $tree['type'] = 'unknown'; 435 $tree['value'] = $ldap_srcs[$id]['dn']; 436 $tree['external'] = true; 437 //$tree['sub_branch'] = false; 300 438 array_push($this->tree['branches'], $tree); 301 439 $this->tree[$i]['type'] = 'ldap'; 302 440 $this->tree[$i]['src'] = $id; 303 } 441 // } 442 //} 304 443 $i++; 305 444 } 306 445 } 307 446 308 447 $GLOBALS['phpgw']->session->appsession('bo_contactcenter.tree','contactcenter',$this->tree); 309 448 return $this->tree['branches']; 310 } 311 312 /*! 313 449 //return null; 450 } 451 452 /*! 453 314 454 @function get_branch_by_level 315 455 @abstract Returns the branch and it's informations given the level 316 456 @author Raphael Derosso Pereira 317 457 318 458 @param (string) $level The level to be used 319 459 320 460 */ 321 461 function & get_branch_by_level($level) … … 323 463 $path = @explode('.',$level); 324 464 $n_ways = count($path); 325 465 326 466 if ($n_ways <= 1) 327 467 { 328 468 return false; 329 469 } 330 470 331 471 $code = '$branch =& $this->tree[\'branches\']'; 332 472 for ($i = 1; $i < $n_ways-1; $i++) … … 338 478 //echo 'Codigo: '.$code.'<br>'; 339 479 eval($code); 340 480 341 481 return $branch; 342 482 } 343 483 344 484 /*! 345 485 346 486 @function get_info_by_level 347 487 @abstract Returns the information about the catalog, given the level … … 355 495 $path = @explode('.',$level); 356 496 $n_ways = count($path); 357 497 358 498 if ($n_ways <= 1) 359 499 { 360 500 return false; 361 501 } 362 502 363 503 $info = $this->tree[$path[1]]; 364 504 365 505 return $info; 366 506 } … … 413 553 414 554 $search = $this->get_level_by_branch($catalog, $bcatalog['sub_branch'], (string) $level); 415 555 416 556 if ($search !== false) 417 557 { … … 427 567 return false; 428 568 } 429 430 /*! 431 569 570 /*! 571 432 572 @function get_actual_catalog 433 @abstract Returns the information about the Catalog that is 573 @abstract Returns the information about the Catalog that is 434 574 instantiated 435 575 436 576 @author Raphael Derosso Pereira 437 577 438 578 */ 439 579 function get_actual_catalog() … … 442 582 return $catalog; 443 583 } 444 445 /*! 446 584 585 /*! 586 447 587 @function set_catalog 448 588 @abstract Sets the actual catalog 449 589 @author Raphael Derosso Pereira 450 590 451 591 @param array $to_catalog The catalog in the format returned by 452 592 get_available_tree or the level 453 593 454 594 */ 455 595 function set_catalog(& $to_catalog ) … … 477 617 $level = $this->get_level_by_branch($to_catalog, $this->tree['branches']); 478 618 } 479 619 620 $lvl_vector = explode('.', $level); 621 $id = $lvl_vector[1]; 622 480 623 switch($catalog['type']) 481 624 { … … 499 642 $call .= ','.implode(',',$args); 500 643 } 501 644 502 645 $call .= ');'; 503 646 504 647 // print_r($catalog); 505 648 // echo '<br><br><b>Setando Catalogo '.$catalog['name'].': </b>'.$call.'<br>'; 506 649 507 650 eval($call); 508 651 509 652 return $catalog; 510 653 511 654 default: return false; 512 655 } 513 656 } 514 657 515 658 516 659 … … 518 661 * Methods to set general fields * 519 662 \*********************************************************************/ 520 521 /*! 522 663 664 /*! 665 523 666 @function add_vcard 524 667 @abstract Insert a VCard to the squema … … 526 669 @param string $uploaded_file The path to the file that were 527 670 uploaded. 528 671 529 672 */ 530 673 function add_vcard ( $uploaded_file ) … … 533 676 534 677 535 678 536 679 /*********************************************************************\ 537 680 * Methods to get general data * 538 681 \*********************************************************************/ 539 682 540 683 } 541 684 ?> -
trunk/contactcenter/inc/class.bo_global_ldap_catalog.inc.php
r167 r284 16 16 */ 17 17 include_once('class.abo_catalog.inc.php'); 18 18 19 19 class bo_global_ldap_catalog extends abo_catalog 20 20 { 21 21 var $ldap; 22 22 23 23 var $src_info; 24 24 25 25 var $trans_table; 26 26 27 // used to determine if a catalog is external 28 var $external; 29 27 30 var $fields = array( 28 31 'id_contact' => true, … … 40 43 'pgp_key' => true, 41 44 'notes' => true, 42 45 'department' => true, 46 47 'empNumber' => true, 48 43 49 /* Array fields */ 44 50 'companies' => true, … … 47 53 'connections' => true 48 54 ); 49 55 50 56 /* 51 57 52 58 @function global_ldap_catalog 53 59 @abstract Constructor 54 60 @author Raphael Derosso Pereira 55 61 @author Mário César Kolling (external catalogs) 62 56 63 @param integer $id_source The ID of the LDAP source 57 64 @param string $context Ldap bind DN 65 @param integer $external 0 = internal catalog, 1 = external catalog 66 58 67 */ 59 function bo_global_ldap_catalog ( $id_source, $context ) 60 { 68 function bo_global_ldap_catalog ( $id_source, $context, $external = 0 ) 69 { 70 71 $this->external = $external; 72 61 73 if (!function_exists('ldap_search')) 62 74 { 63 75 exit('PHP LDAP support Unavailable!'); 64 76 } 65 77 66 78 $this->ldap = CreateObject('contactcenter.bo_ldap_manager'); 67 68 $all_src = $this->ldap->get_all_ldap_sources(); 79 80 if ($this->external) 81 { 82 $all_src = $this->ldap->get_external_ldap_sources(); 83 } 84 else 85 { 86 $all_src = $this->ldap->get_all_ldap_sources(); 87 } 69 88 70 89 if (!$all_src[$id_source] or !$context) … … 75 94 $this->src_info = $all_src[$id_source]; 76 95 $this->src_info['context'] = $context; 77 $this->trans_table = $this->ldap->get_ldap_fields_association($id_source); 78 } 79 96 97 if ($this->external) 98 { 99 $this->trans_table = $this->ldap->get_external_ldap_fields_association($id_source); 100 } 101 else 102 { 103 $this->trans_table = $this->ldap->get_ldap_fields_association($id_source); 104 } 105 } 106 80 107 /* 81 108 82 109 @function find 83 110 @abstract Searches the LDAP directory for the specified fields with … … 85 112 that matches the rules. 86 113 @author Raphael Derosso Pereira 87 114 88 115 @param array $what The fields to be taken 89 116 @param array $rules The rules to be match. See class.abo_catalog.inc.php … … 94 121 'offset' => (integer) [NOT IMPLEMENTED] 95 122 ) 96 123 97 124 */ 98 125 function find($what, $rules=false, $other=false) 99 126 { 100 127 $restric_fields = $this->get_restrictions_without_branch($rules); 101 128 102 129 $trans_f = $this->translate_fields($what, $restric_fields); 103 130 104 131 foreach($trans_f as $orig => $field_a) 105 132 { … … 109 136 } 110 137 } 111 138 112 139 $fields = array_unique($fields); 113 140 114 141 $filter = $this->process_restrictions($rules, $trans_f); 115 142 116 143 if(strstr($this->src_info['context'], "ldap://")) { 117 144 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $this->src_info['context'])); 118 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $this->src_info['context']); 145 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $this->src_info['context']); 119 146 $this->src_info['host'] = $host; 120 //$this->src_info['acc'] = '';121 //$this->src_info['pw'] = '';122 } 147 $this->src_info['acc'] = ''; 148 $this->src_info['pw'] = ''; 149 } 123 150 124 151 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); 125 152 126 153 if (!$ldap) 127 154 { 128 155 return false; 129 156 } 130 131 $fields[] ='phpgwAccountVisible'; 132 $result_r = @ldap_search($ldap ,($refer_context ? $refer_context : $this->src_info['context']), $filter, $fields); 157 158 if (!$this->external) 159 { 160 $fields[] ='phpgwAccountVisible'; 161 } 162 163 $result_r = @ldap_search($ldap ,($refer_context ? $refer_context : $this->src_info['context']), $filter, $fields, 0); 133 164 134 165 if (!$result_r) … … 136 167 return false; 137 168 } 138 169 139 170 if ($other['order']) 140 171 { … … 150 181 } 151 182 } 152 183 153 184 $result_u = ldap_get_entries($ldap, $result_r); 154 185 155 186 $i = 0; 156 187 foreach ($result_u as $index => $result_p) 157 188 { 158 if ($index === 'count' or $index === 'dn' or $result_p['phpgwaccountvisible'][0] == '-1')189 if ($index === 'count' or $index === 'dn' or (!$this->external and $result_p['phpgwaccountvisible'][0] == '-1')) 159 190 { 160 191 continue; 161 192 } 162 193 163 194 foreach ($trans_f as $orig => $trans) 164 195 { … … 178 209 $i++; 179 210 } 180 211 181 212 return $return; 182 213 } 183 214 184 215 /* 185 216 186 217 @function translate_fields 187 218 @abstract Return the LDAP objectClass fields that corresponds to the 188 219 specified parameter fields 189 220 @author Raphael Derosso Pereira 190 221 191 222 @param array $fields The fields in the standard ContactCenter format 192 223 @param array $rules The rules 193 224 194 225 */ 195 226 function translate_fields ( $fields, &$restric_fields ) 196 227 { 197 228 $return = array(); 198 229 199 230 $i = 0; 200 231 foreach ($fields as $field) … … 204 235 continue; 205 236 } 206 237 207 238 if (!is_array($this->trans_table[$field])) 208 239 { 209 240 $reference = $this->trans_table[$field]; 210 241 211 242 reset($restric_fields); 212 243 while(list(,$field_r) = each($restric_fields)) 213 244 { 245 214 246 if ($field_r['field'] === $reference and array_key_exists($field_r['value'], $this->trans_table[$reference])) 215 247 { … … 220 252 else 221 253 { 254 222 255 if (!is_array($return[$field])) 223 256 { … … 230 263 } 231 264 } 232 265 233 266 if (count($return)) 234 267 { 235 268 return $return; 236 269 } 237 270 238 271 return false; 239 272 } 240 273 241 274 /* 242 275 243 276 @function process_restrictions 244 277 @abstract Returns a LDAP filter string that corresponds to the 245 278 specified restriction rules 246 279 @author Raphael Derosso Pereira 247 280 248 281 @param string $rules The restriction rules 249 282 250 283 */ 251 284 function process_restrictions( $rules, &$trans_table, $join_type='&' ) … … 255 288 return null; 256 289 } 257 290 258 291 foreach($rules as $rule_i => $rule) 259 292 { … … 267 300 $join = '|'; 268 301 break; 269 302 270 303 case 'AND': 271 304 $join = '&'; 272 305 break; 273 306 274 307 case 'NOT': 275 308 $join = '!'; 276 309 break; 277 310 278 311 default: 279 312 $join = $join_type; … … 281 314 $return_t[] = $this->process_restrictions($rule['sub_branch'], $trans_table, $join); 282 315 break; 283 316 284 317 case '=': 285 318 if (array_key_exists($rule['field'], $trans_table)) … … 292 325 } 293 326 break; 294 295 case '!=': 327 328 case '!=': 296 329 if (array_key_exists($rule['field'], $trans_table)) 297 330 { … … 303 336 } 304 337 break; 305 338 306 339 case '<=': 307 340 case '<': … … 315 348 } 316 349 break; 317 350 318 351 case '>': 319 352 case '>=': … … 327 360 } 328 361 break; 329 362 330 363 case 'NULL': 331 364 if (array_key_exists($rule['field'], $trans_table)) … … 338 371 } 339 372 break; 340 373 341 374 case 'IN': 342 375 if (array_key_exists($rule['field'], $trans_table)) … … 358 391 $value_1 = strtoupper(str_replace('%', '*', $rule['value'])); 359 392 $value_2 = strtolower($value_1); 360 393 361 394 foreach($trans_table[$rule['field']] as $field) 362 395 { … … 367 400 } 368 401 break; 369 402 370 403 */ case 'LIKE': 371 404 if (array_key_exists($rule['field'], $trans_table)) 372 405 { 373 406 $value = str_replace('%', '*', $rule['value']); 374 407 375 408 foreach($trans_table[$rule['field']] as $field) 376 409 { … … 380 413 } 381 414 break; 382 415 383 416 case 'NOT NULL': 384 417 if (array_key_exists($rule['field'], $trans_table)) … … 391 424 } 392 425 break; 393 426 394 427 case 'NOT IN': 395 428 if (array_key_exists($rule['field'], $trans_table)) … … 411 444 $value_1 = strtoupper(str_replace('%', '*', $rule['value'])); 412 445 $value_2 = strtolower($value_1); 413 446 414 447 foreach($trans_table[$rule['field']] as $field) 415 448 { … … 425 458 { 426 459 $value = str_replace('%', '*', $rule['value']); 427 460 428 461 foreach($trans_table[$rule['field']] as $field) 429 462 { … … 435 468 } 436 469 } 437 470 438 471 if (count($return_t)) 439 472 { … … 453 486 454 487 /*! 455 488 456 489 @function get_restrictions_without_branch 457 490 @abstract Returns an array containing the restrictions ignoring the 458 491 branches 459 492 @author Raphael Derosso Pereira 460 493 461 494 @param array $restrictions The restrictions 462 495 463 496 */ 464 497 function get_restrictions_without_branch(&$restrictions) … … 468 501 return null; 469 502 } 470 503 471 504 $fields = array(); 472 505 473 506 foreach ($restrictions as $restrict_data) 474 507 { … … 478 511 $fields = array_merge($fields, $this->get_restrictions_without_branch($restrict_data['sub_branch'])); 479 512 break; 480 513 481 514 case '=': 482 case '!=': 515 case '!=': 483 516 case '<=': 484 517 case '<': … … 495 528 array_push($fields, $restrict_data); 496 529 break; 497 530 498 531 default: 499 exit('Error in '.__FILE__.' on '.__LINE__.'<br>The restriction type passed was: '.$restrict_data['type']); 500 } 501 } 502 532 exit('Error in '.__FILE__.' on '.__LINE__.'<br>The restriction type passed was: '.$restrict_data['type']); 533 } 534 } 535 503 536 return $fields; 504 537 } 505 506 538 539 507 540 /*********************************************************************\ 508 541 * Methods to Get Data * 509 542 \*********************************************************************/ 510 511 543 544 512 545 /*! 513 546 514 547 @function get_single_entry 515 548 @abstract Returns all information requested about one contact 516 549 @author Raphael Derosso Pereira 517 550 518 551 @param integer $id_contact The contact ID 519 552 @param array $fields The array returned by get_fields with true 520 553 on the fields to be taken. 521 554 522 555 */ 523 556 function get_single_entry ( $id_contact, $fields ) 524 557 { 525 if (!is_array($fields)) 526 { 527 if (is_object($GLOBALS['phpgw']->log)) 558 if (!is_array($fields)) 559 { 560 if (is_object($GLOBALS['phpgw']->log)) 528 561 { 529 562 $GLOBALS['phpgw']->log->message(array( … … 531 564 'line' => __LINE__, 532 565 'file' => __FILE__)); 533 566 534 567 $GLOBALS['phpgw']->log->commit(); 535 568 } 536 else 569 else 537 570 { 538 571 exit('Argument Error on: <br>File:'.__FILE__.'<br>Line:'.__LINE__.'<br>'); 539 572 } 540 573 } 541 574 542 575 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'],$this->src_info['acc'],$this->src_info['pw'],true); 543 576 544 577 if (!$ldap) 545 578 { 546 579 return false; 547 580 } 548 581 549 582 $resource = ldap_read($ldap, $id_contact, 'objectClass='.$this->src_info['obj']); 550 583 $n_entries = ldap_count_entries($ldap, $resource); … … 553 586 return false; 554 587 } 555 588 556 589 $first_entry = ldap_first_entry($ldap, $resource); 557 590 $contact = ldap_get_attributes($ldap,$first_entry); 558 if($contact['jpegPhoto']){ 559 $contact['jpegPhoto'] = ldap_get_values_len ($ldap, $first_entry, "jpegPhoto"); 591 if($contact['jpegPhoto']){ 592 $contact['jpegPhoto'] = ldap_get_values_len ($ldap, $first_entry, "jpegPhoto"); 560 593 } 561 594 562 595 // print_r($contact); 563 596 564 597 // $contact_data = $this->fields; 565 598 566 599 foreach($fields as $field => $trueness) 567 600 { … … 571 604 continue; 572 605 } 573 606 574 607 switch ($field) 575 608 { … … 580 613 $l_fields['department'] = $this->trans_table['contact.business_info.department']; 581 614 $l_fields['company_notes'] = $this->trans_table['contact.company.company_notes']; 582 615 583 616 $contact_data['companies'] = array(); 584 617 foreach($l_fields as $l_field => $l_value) … … 588 621 continue; 589 622 } 590 591 $contact_data['companies']['company1'][$l_field] = $contact[$l_value[0]][0];592 } 593 623 624 $contact_data['companies']['company1'][$l_field] = utf8_decode($contact[$l_value[0]][0]); 625 } 626 594 627 if (!(count($contact_data['companies']))) 595 628 { … … 597 630 } 598 631 break; 599 632 600 633 case 'relations': 601 634 unset($l_fields); … … 604 637 unset($contact_data['relations']); 605 638 } 606 639 607 640 $contact_data['relations'] = array(); 608 641 if (!is_array($this->trans_table['contact.contact_related.names_ordered'])) … … 612 645 continue; 613 646 } 614 647 615 648 $i = 1; 616 649 foreach($trans as $l_type => $l_type_fields) … … 620 653 continue; 621 654 } 622 655 623 656 $contact_data['relations']['relation'.$i]['type'] = $l_type; 624 $contact_data['relations']['relation'.$i]['names_ordered'] = $contact[$l_type_fields[0]][0];657 $contact_data['relations']['relation'.$i]['names_ordered'] = utf8_decode($contact[$l_type_fields[0]][0]); 625 658 $i++; 626 659 } 627 660 } 628 661 629 662 if (!(count($contact_data['relations']))) 630 663 { … … 632 665 } 633 666 break; 634 667 635 668 case 'addresses': 636 669 unset($l_fields); … … 661 694 continue; 662 695 } 663 696 664 697 $i = 1; 665 698 foreach($trans as $l_type => $l_type_fields) … … 669 702 continue; 670 703 } 671 704 672 705 $contact_data['addresses']['address'.$i]['type'] = $l_type; 673 $contact_data['addresses']['address'.$i][$l_field] = $contact[$l_type_fields[0]][0];706 $contact_data['addresses']['address'.$i][$l_field] = utf8_decode($contact[$l_type_fields[0]][0]); 674 707 $i++; 675 708 } … … 677 710 else 678 711 { 679 $contact_data['addresses']['address1'][$l_field] = $contact[$l_value[0]][0];680 } 681 } 682 712 $contact_data['addresses']['address1'][$l_field] = utf8_decode($contact[$l_value[0]][0]); 713 } 714 } 715 683 716 if (!(count($contact_data['addresses']))) 684 717 { … … 686 719 } 687 720 break; 688 721 689 722 case 'connections': 690 723 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); … … 707 740 continue; 708 741 } 709 742 710 743 $i = 1; 711 744 foreach($trans as $l_type => $l_type_fields) … … 715 748 continue; 716 749 } 717 750 718 751 switch ($l_type) 719 752 { … … 726 759 } 727 760 $contact_data['connections']['connection'.$i]['type'] = $l_type; 728 $contact_data['connections']['connection'.$i][$l_field] = $contact[$l_type_fields[0]][0];761 $contact_data['connections']['connection'.$i][$l_field] = utf8_decode($contact[$l_type_fields[0]][0]); 729 762 $i++; 730 763 } … … 732 765 else 733 766 { 734 $contact_data['connections']['connection1'][$l_field] = $contact[$l_value[0]][0];735 } 736 } 737 767 $contact_data['connections']['connection1'][$l_field] = utf8_decode($contact[$l_value[0]][0]); 768 } 769 } 770 738 771 if (!(count($contact_data['connections']))) 739 772 { … … 741 774 } 742 775 break; 743 776 744 777 case 'prefix': 745 778 unset($l_fields); … … 750 783 continue; 751 784 } 752 753 $contact_data['prefix'] = $contact[$l_fields[0]][0];754 break; 755 785 786 $contact_data['prefix'] = utf8_decode($contact[$l_fields[0]][0]); 787 break; 788 756 789 case 'suffix': 757 790 unset($l_fields); … … 762 795 continue; 763 796 } 764 765 $contact_data['suffix'] = $contact[$l_fields[0]][0];766 break; 767 797 798 $contact_data['suffix'] = utf8_decode($contact[$l_fields[0]][0]); 799 break; 800 768 801 case 'status': 769 802 unset($l_fields); … … 774 807 continue; 775 808 } 776 777 $contact_data['status'] = $contact[$l_fields[0]][0];778 break; 779 809 810 $contact_data['status'] = utf8_decode($contact[$l_fields[0]][0]); 811 break; 812 780 813 case 'photo': 781 814 unset($l_fields); … … 786 819 continue; 787 820 } 788 821 789 822 $contact_data['photo'] = $contact[$l_fields[0]][0]; 790 break; 823 break; 791 824 792 825 default: … … 798 831 continue; 799 832 } 800 833 801 834 if(count($contact[$l_fields[0]]) > 1) 802 $contact_data[$field] = $contact[$l_fields[0]]; 835 { 836 $tmp = array(); 837 foreach ($contact[$l_fields[0]] as $i => $j) 838 { 839 $tmp["$i"] = utf8_decode($j); 840 } 841 //$contact_data[$field] = $contact[$l_fields[0]]; 842 $contact_data[$field] = $tmp; 843 } 803 844 else 804 $contact_data[$field] = $contact[$l_fields[0]][0];805 806 break; 807 } 808 } 809 845 $contact_data[$field] = utf8_decode($contact[$l_fields[0]][0]); 846 847 break; 848 } 849 } 850 810 851 if (!is_array($contact_data)) 811 852 { 812 853 return false; 813 854 } 814 855 815 856 return $contact_data; 816 857 } 817 858 859 /*! 860 861 @function get_all_entries 862 @abstract Returns all information requested about a bunch of contacts, usually a page 863 @author Raphael Derosso Pereira 864 @author Mário César Kolling 865 866 @param string $filter Filter (returned by generate_filter). 867 @param array $fields The array returned by get_fields with true 868 on the fields to be taken. 869 870 */ 871 function get_all_entries($filter, $fields) 872 { 873 if (!is_array($fields)) 874 { 875 if (is_object($GLOBALS['phpgw']->log)) 876 { 877 $GLOBALS['phpgw']->log->message(array( 878 'text' => 'F-BadcontactcenterParam, wrong get_single_entry parameters type.', 879 'line' => __LINE__, 880 'file' => __FILE__)); 881 882 $GLOBALS['phpgw']->log->commit(); 883 } 884 else 885 { 886 exit('Argument Error on: <br>File:'.__FILE__.'<br>Line:'.__LINE__.'<br>'); 887 } 888 } 889 890 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'],$this->src_info['acc'],$this->src_info['pw'],true); 891 892 if (!$ldap) 893 { 894 return false; 895 } 896 897 $resource = @ldap_search($ldap, $this->src_info['dn'], $filter); 898 $n_entries = @ldap_count_entries($ldap, $resource); 899 900 ldap_sort($ldap, $resource, 'cn'); 901 902 if ( $n_entries < 1) 903 { 904 return false; 905 } 906 907 $contacts = array(); 908 909 for ($entry = ldap_first_entry($ldap, $resource); 910 $entry != false; 911 $entry = ldap_next_entry($ldap, $entry)) 912 { 913 $contact = ldap_get_attributes($ldap,$entry); 914 if($contact['jpegPhoto']){ 915 $contact['jpegPhoto'] = ldap_get_values_len ($ldap, $entry, "jpegPhoto"); 916 } 917 918 foreach($fields as $field => $trueness) 919 { 920 if (!$trueness) 921 { 922 //unset($contact_data[$field]); 923 continue; 924 } 925 926 switch ($field) 927 { 928 case 'companies': 929 unset($l_fields); 930 $l_fields['company_name'] = $this->trans_table['contact.company.company_name']; 931 $l_fields['title'] = $this->trans_table['contact.business_info.title']; 932 $l_fields['department'] = $this->trans_table['contact.business_info.department']; 933 $l_fields['company_notes'] = $this->trans_table['contact.company.company_notes']; 934 935 ///Relaciona o array com o atributo 'employeeNumber' do RHDS 936 $l_fields['empNumber'] = $this->trans_table['contact.business_info.empNumber']; 937 938 $contact_data['companies'] = array(); 939 foreach($l_fields as $l_field => $l_value) 940 { 941 if (!( $contact[$l_value[0]][0])) 942 { 943 continue; 944 } 945 946 $contact_data['companies']['company1'][$l_field] = utf8_decode($contact[$l_value[0]][0]); 947 } 948 949 if (!(count($contact_data['companies']))) 950 { 951 unset($contact_data['companies']); 952 } 953 break; 954 955 case 'relations': 956 unset($l_fields); 957 if (!$this->trans_table['contact.contact_related.names_ordered']) 958 { 959 unset($contact_data['relations']); 960 } 961 962 $contact_data['relations'] = array(); 963 if (!is_array($this->trans_table['contact.contact_related.names_ordered'])) 964 { 965 if (!($trans = $this->trans_table[$this->trans_table['contact.contact_related.names_ordered']])) 966 { 967 continue; 968 } 969 970 $i = 1; 971 foreach($trans as $l_type => $l_type_fields) 972 { 973 if (!($contact[$l_type_fields[0]][0])) 974 { 975 continue; 976 } 977 978 $contact_data['relations']['relation'.$i]['type'] = $l_type; 979 $contact_data['relations']['relation'.$i]['names_ordered'] = utf8_decode($contact[$l_type_fields[0]][0]); 980 $i++; 981 } 982 } 983 984 if (!(count($contact_data['relations']))) 985 { 986 unset($contact_data['relations']); 987 } 988 break; 989 990 case 'addresses': 991 unset($l_fields); 992 $l_fields['address1'] = $this->trans_table['contact.address.address1']; 993 $l_fields['address2'] = $this->trans_table['contact.address.address2']; 994 $l_fields['complement'] = $this->trans_table['contact.address.complement']; 995 $l_fields['address_other'] = $this->trans_table['contact.address.address_other']; 996 $l_fields['postal_code'] = $this->trans_table['contact.address.postal_code']; 997 $l_fields['po_box'] = $this->trans_table['contact.address.po_box']; 998 $l_fields['id_city'] = $this->trans_table['contact.address.city.id_city']; 999 $l_fields['city_name'] = $this->trans_table['contact.address.city.city_name']; 1000 $l_fields['city_timezone'] = $this->trans_table['contact.address.city.city_timezone']; 1001 $l_fields['city_geo_location'] = $this->trans_table['contact.address.city.city_geo_location']; 1002 $l_fields['id_state'] = $this->trans_table['contact.address.city.state.id_state']; 1003 $l_fields['state_name'] = $this->trans_table['contact.address.city.state.state_name']; 1004 $l_fields['state_symbol'] = $this->trans_table['contact.address.city.state.state_symbol']; 1005 $l_fields['id_country'] = $this->trans_table['contact.address.city.country.id_country']; 1006 $l_fields['country_name'] = $this->trans_table['contact.address.city.country.country_name']; 1007 $l_fields['address_is_default'] = $this->trans_table['contact.address.address_is_default']; 1008 1009 $contact_data['addresses'] = array(); 1010 foreach($l_fields as $l_field => $l_value) 1011 { 1012 if (!is_array($l_value)) 1013 { 1014 if (!($trans = $this->trans_table[$l_value])) 1015 { 1016 continue; 1017 } 1018 1019 $i = 1; 1020 foreach($trans as $l_type => $l_type_fields) 1021 { 1022 if (!($contact[$l_type_fields[0]][0])) 1023 { 1024 continue; 1025 } 1026 1027 $contact_data['addresses']['address'.$i]['type'] = $l_type; 1028 $contact_data['addresses']['address'.$i][$l_field] = utf8_decode($contact[$l_type_fields[0]][0]); 1029 $i++; 1030 } 1031 } 1032 else 1033 { 1034 $contact_data['addresses']['address1'][$l_field] = utf8_decode($contact[$l_value[0]][0]); 1035 } 1036 } 1037 1038 if (!(count($contact_data['addresses']))) 1039 { 1040 unset($contact_data['addresses']); 1041 } 1042 break; 1043 1044 case 'connections': 1045 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 1046 if (!is_array($preferences)) 1047 { 1048 $preferences['personCardEmail'] = 1; 1049 $preferences['personCardPhone'] = 2; 1050 } 1051 unset($l_fields); 1052 $l_fields['connection_name'] = $this->trans_table['contact.connection.connection_name']; 1053 $l_fields['connection_value'] = $this->trans_table['contact.connection.connection_value']; 1054 1055 $contact_data['connections'] = array(); 1056 foreach($l_fields as $l_field => $l_value) 1057 { 1058 if (!is_array($l_value)) 1059 { 1060 if (!($trans = $this->trans_table[$l_value])) 1061 { 1062 continue; 1063 } 1064 1065 $i = 1; 1066 foreach($trans as $l_type => $l_type_fields) 1067 { 1068 if (!($contact[$l_type_fields[0]][0])) 1069 { 1070 continue; 1071 } 1072 1073 switch ($l_type) 1074 { 1075 case 'email': 1076 $contact_data['connections']['connection'.$i]['id_type'] = $preferences['personCardEmail']; 1077 break; 1078 1079 default: 1080 $contact_data['connections']['connection'.$i]['id_type'] = $preferences['personCardPhone']; 1081 } 1082 $contact_data['connections']['connection'.$i]['type'] = $l_type; 1083 $contact_data['connections']['connection'.$i][$l_field] = utf8_decode($contact[$l_type_fields[0]][0]); 1084 $i++; 1085 } 1086 } 1087 else 1088 { 1089 $contact_data['connections']['connection1'][$l_field] = utf8_decode($contact[$l_value[0]][0]); 1090 } 1091 } 1092 1093 if (!(count($contact_data['connections']))) 1094 { 1095 unset($contact_data['connections']); 1096 } 1097 break; 1098 1099 case 'prefix': 1100 unset($l_fields); 1101 $l_fields = $this->trans_table['contact.prefixes.prefix']; 1102 if (!$l_fields or !$contact[$l_fields[0]][0]) 1103 { 1104 unset($contact_data['prefix']); 1105 continue; 1106 } 1107 1108 $contact_data['prefix'] = utf8_decode($contact[$l_fields[0]][0]); 1109 break; 1110 1111 case 'suffix': 1112 unset($l_fields); 1113 $l_fields = $this->trans_table['contact.suffixes.suffix']; 1114 if (!$l_fields or !$contact[$l_fields[0]][0]) 1115 { 1116 unset($contact_data['suffix']); 1117 continue; 1118 } 1119 1120 $contact_data['suffix'] = utf8_decode($contact[$l_fields[0]][0]); 1121 break; 1122 1123 case 'status': 1124 unset($l_fields); 1125 $l_fields = $this->trans_table['contact.status.status_name']; 1126 if (!$l_fields or !$contact[$l_fields[0]][0]) 1127 { 1128 unset($contact_data['status']); 1129 continue; 1130 } 1131 1132 $contact_data['status'] = utf8_decode($contact[$l_fields[0]][0]); 1133 break; 1134 1135 case 'photo': 1136 unset($l_fields); 1137 $l_fields = $this->trans_table['contact.photo']; 1138 if (!$l_fields or !$contact[$l_fields[0]][0]) 1139 { 1140 unset($contact_data['photo']); 1141 continue; 1142 } 1143 1144 $contact_data['photo'] = $contact[$l_fields[0]][0]; 1145 break; 1146 1147 default: 1148 unset($l_fields); 1149 $l_fields = $this->trans_table['contact.'.$field]; 1150 if (!$l_fields or !$contact[$l_fields[0]][0]) 1151 { 1152 unset($contact_data[$field]); 1153 continue; 1154 } 1155 1156 if(count($contact[$l_fields[0]]) > 1) 1157 { 1158 $tmp = array(); 1159 foreach ($contact[$l_fields[0]] as $i => $j) 1160 { 1161 $tmp["$i"] = utf8_decode($j); 1162 } 1163 //$contact_data[$field] = $contact[$l_fields[0]]; 1164 $contact_data[$field] = $tmp; 1165 } 1166 else 1167 $contact_data[$field] = utf8_decode($contact[$l_fields[0]][0]); 1168 1169 break; 1170 1171 } 1172 } 1173 1174 if (is_array($contact_data)) 1175 { 1176 $contacts[ldap_get_dn($ldap, $entry)] = $contact_data; 1177 } 1178 1179 } 1180 1181 return $contacts; 1182 } 1183 818 1184 function get_multiple_entries ( $id_contacts, $fields, $other_data = false ) 819 1185 { 820 1186 if (!is_array($id_contacts) or !is_array($fields) or ($other_data != false and !is_array($other_data))) 821 1187 { 822 if (is_object($GLOBALS['phpgw']->log)) 1188 if (is_object($GLOBALS['phpgw']->log)) 823 1189 { 824 1190 $GLOBALS['phpgw']->log->message(array( … … 826 1192 'line' => __LINE__, 827 1193 'file' => __FILE__)); 828 1194 829 1195 $GLOBALS['phpgw']->log->commit(); 830 1196 } … … 833 1199 } 834 1200 } 835 1201 836 1202 $contacts = array(); 837 1203 838 1204 if ($other_data) 839 1205 { 840 1206 //TODO 841 1207 } 842 843 foreach ($id_contacts as $id) 844 { 845 $contacts[$id] = $this->get_single_entry($id,$fields); 846 } 847 848 return $contacts; 1208 1209 $filter = $this->generate_filter($id_contacts); 1210 1211 //$teste = $this->get_all_entries($filter, $fields); 1212 1213 return $this->get_all_entries($filter, $fields); 1214 } 1215 1216 function generate_filter($id_contacts) 1217 { 1218 if (($size = count($id_contacts))) 1219 { 1220 $filter = '(&(objectClass='.$this->src_info['obj'] . ')(|'; 1221 for ($i = 0; $i < $size; $i++) 1222 { 1223 1224 /* 1225 * Não utiliza mais a função ldap_explode, usa a expressão regular a seguir para pegar o primeiro 1226 * componente da dn 1227 */ 1228 preg_match('/^(\w*=[^,]*),.*$/', $id_contacts[$i], $cn); 1229 1230 /* 1231 * Adicionados os str_replace para adicionar caracteres de escape em frente aos caracteres '(' e ')', 1232 * posteriormente poderá ser necessário substituir por uma expressão regular mais genérica. 1233 */ 1234 if ($cn[1]) 1235 { 1236 /* 1237 * Esta operação resolve o problema causado pela conversão de caracteres acentuados realizada 1238 * pela função ldap_explode_dn(). Talvez seja necessário utilizar esta tradução em outros lugares, 1239 * neste caso é mais apropriado colocar dentro de uma função. 1240 */ 1241 //foreach($cn as $key=>$value){ 1242 // $cn[$key]=preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $value); 1243 //} 1244 1245 $filter .= '(' . str_replace(')', '\)', str_replace('(','\(',$cn[1])) . ')'; 1246 } 1247 } 1248 $filter .= '))'; 1249 } 1250 1251 return $filter; 1252 849 1253 } 850 1254 … … 876 1280 return null; 877 1281 } 878 1282 879 1283 function get_relations ($id_contact,$extra=false) 880 1284 { 881 1285 } 882 1286 883 1287 function get_addresses ( $id_contact,$extra=false ) 884 1288 { 885 1289 } 886 1290 887 1291 function get_connections ( $id_contact,$extra=false ) 888 1292 { 889 1293 } 890 1294 891 1295 function get_companies ( $id_contact, $extra=false ) 892 1296 { 893 1297 } 894 1298 895 1299 function get_all_prefixes ( ) 896 1300 { 897 1301 } 898 1302 899 1303 function get_all_suffixes ( ) 900 1304 { 901 1305 } 902 1306 903 1307 function get_all_status ( ) 904 1308 { 905 1309 } 906 1310 907 1311 function get_all_relations_types ( ) 908 1312 { 909 1313 } 910 1314 911 1315 function get_all_addresses_types ( ) 912 1316 { 913 1317 } 914 1318 915 1319 function get_all_connections_types ( ) 916 1320 { 917 1321 } 918 1322 919 1323 function get_vcard ( $id_contact ) 920 1324 { 921 1325 } 922 923 924 925 1326 1327 1328 1329 926 1330 function get_global_tree ( $root ) 927 1331 { 928 1332 } 929 1333 930 1334 function get_actual_brach ( ) 931 1335 { 932 1336 } 933 1337 934 1338 function set_actual_branch ( $branch ) 935 1339 { -
trunk/contactcenter/inc/class.bo_ldap_manager.inc.php
r23 r284 12 12 \***************************************************************************/ 13 13 14 14 15 15 /* 16 16 This class is responsible for the LDAP control/generic functions and for 17 17 configuration gathering 18 18 */ 19 20 class bo_ldap_manager 19 include_once('class.Thread.inc.php'); 20 21 class bo_ldap_manager 21 22 { 22 23 23 24 var $srcs; 24 25 25 26 26 function bo_ldap_manager () 27 27 { 28 28 29 if (!($this->srcs = $GLOBALS['phpgw']->session->appsession('bo_ldap_manager.srcs','contactcenter'))) 29 30 { 30 31 $c = CreateObject('phpgwapi.config','contactcenter'); 31 32 $data = $c->read_repository(); 32 33 33 34 if (!$data or $data['cc_global_source0'] !== 'ldap') 34 35 { … … 36 37 return; 37 38 } 38 39 39 40 $this->srcs = array( 40 41 1 => array( … … 47 48 'branch' => strtolower('ou') 48 49 ) 50 49 51 ); 50 52 } … … 54 56 { 55 57 } 56 58 57 59 /* 58 60 59 61 @function get_all_ldap_sources 60 62 @abstract Returns an array containing all LDAP sources informations 61 63 @author Raphael Derosso Pereira 62 64 63 65 @return array All LDAP information 64 66 $return = array( … … 67 69 'dn' => (string), 68 70 'acc' => (string), 69 'pw' => (string) 71 'pw' => (string) 70 72 ), 71 73 ... 72 74 ) 73 75 74 76 TODO: Return multiple sources... 75 77 */ … … 78 80 return $this->srcs; 79 81 } 80 82 83 /* 84 * @function get_external_ldap_sources 85 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 86 * @abstract returns an array with the external sources 87 * @return (array) the external sources 88 */ 89 90 function get_external_ldap_sources() 91 { 92 include(PHPGW_INCLUDE_ROOT . '/contactcenter/setup/external_catalogs.inc.php' ); 93 //include('external_catalogs.inc.php' ); 94 return $external_srcs; 95 } 96 97 /* 98 * @function get_ldap_fields_association 99 * @abstract get the fields associantion for ldap source 100 * @return an array with attribute mappings 101 */ 81 102 function get_ldap_fields_association ( $id_source ) 82 103 { 83 104 84 105 $op_iop = array( 85 106 'contact.id_contact' => array('dn'), … … 90 111 'contact.family_names' => array('sn'), 91 112 'contact.names_ordered' => array('cn'),//,'displayName'), 113 92 114 'contact.suffixes.suffix' => false, 93 115 'contact.birthdate' => false, … … 95 117 'contact.pgp_key' => false, 96 118 'contact.notes' => false, 97 'contact.mail_forwarding_address' => array('mailForwardingAddress'), 98 'contact.account_type' => array('phpgwAccountType'), 119 'contact.mail_forwarding_address' => array('mailForwardingAddress'), 120 'contact.account_type' => array('phpgwAccountType'), 121 'contact.account_status' => array('phpgwAccountStatus'), 122 'contact.account_visible' => array('phpgwAccountVisible'), 123 'contact.object_class' => array('objectClass'), 99 124 'contact.business_info.title' => array('title'), 100 'contact.business_info.department' => array('ou'), 125 'contact.business_info.department' => array('ou'), // Setor do empregado... 126 'contact.business_info.empNumber' => array('employeeNumber'), // Matricula do empregado 101 127 'contact.company.company_name' => array('o'), 102 128 'contact.company.company_notes' => array('businessCategory'), 103 129 104 130 'contact.contact_related.names_ordered' => 'contact.contact_related.typeof_relation.contact_relation_name', 105 131 'contact.contact_related.typeof_relation.contact_relation_name' => array( … … 107 133 'secretary' => array('secretary') 108 134 ), 109 135 110 136 'contact.address.address1' => 'contact.address.typeof_address.contact_address_type_name', 111 137 'contact.address.typeof_address.contact_address_type_name' => array( 112 138 'home' => array('street', 'st', 'postalAddress', 'homePostalAddress'), 113 139 ), 114 140 115 141 'contact.address.postal_code' => 'contact.address.typeof_address.contact_address_type_name', 116 142 'contact.address.typeof_address.contact_address_type_name' => array( 117 143 'home' => array('PostalCode'), 118 144 ), 119 145 120 146 'contact.address.city.city_name' => 'contact.address.typeof_address.contact_address_type_name', 121 147 'contact.address.typeof_address.contact_address_type_name' => array( 122 148 'home' => array('l'), 123 149 ), 124 150 125 151 'contact.address.city.state.state_name' => 'contact.address.typeof_address.contact_address_type_name', 126 152 'contact.address.typeof_address.contact_address_type_name' => array( 127 153 'home' => false, 128 154 ), 129 155 130 156 'contact.address.city.country.id_country' => 'contact.address.typeof_address.contact_address_type_name', 131 157 'contact.address.typeof_address.contact_address_type_name' => array( 132 158 'home' => array('c') 133 159 ), 134 160 135 161 'contact.connection.connection_value' => 'contact.connection.typeof_connection.contact_connection_type_name', 136 162 'contact.connection.typeof_connection.contact_connection_type_name' => array ( … … 143 169 ), 144 170 ); 145 171 146 172 return $op_iop; 173 174 } 175 176 /* 177 * @function get_external_ldap_fields_association 178 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 179 * @abstract get the fields association for an external ldap_source 180 * @return an array with attribute mappings 181 */ 182 function get_external_ldap_fields_association ( $id_source ) 183 { 184 include(PHPGW_INCLUDE_ROOT . '/contactcenter/setup/external_catalogs.inc.php' ); 185 //include('external_catalogs.inc.php' ); 186 return $external_mappings[$id_source]; 187 } 188 189 /* 190 * @function test_connection 191 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 192 * @abstract Test if we can bind to a ldap server in a reasonable time 193 * @param (string) $host ldap server's hostname 194 * @param (string) $account ldap bind dn 195 * @param (string) $password a bind dn's password 196 * @return (array) an array with the answer from the subprocess, null otherwise 197 */ 198 function test_connection($host, $account, $password, $timeout = 5) 199 { 200 //opens a subprocess for nonblocking bind 201 $tsearch = Thread::Create('class.ldap_assync.inc.php', array('host' => $host, 202 'account' => $account, 203 'password' => $password 204 ) 205 ); 206 207 // It's problably more efficient to let method readResponse control the timeout through 208 // stream_select native timeout. 209 $response = NULL; 210 for ($i = 0; $i < $timeout; $i++) 211 { 212 if ($tsearch->isActive()) 213 { 214 sleep(1); 215 if (($response = $tsearch->readResponse()) !== NULL) 216 { 217 $tsearch->close(); 218 return $response; 219 } 220 221 } 222 else 223 { 224 $response = $tsearch->readResponse(); 225 break; 226 } 227 } 228 229 $tsearch->close(); 230 return null; 147 231 } 148 232 149 233 /*! 150 234 151 235 @function get_ldap_tree 152 236 @abstract Returns the LDAP tree corresponding to the specified level 153 237 @author Raphael Derosso Pereira 154 238 155 239 @param (integer) $id_source The ID of the LDAP source 156 240 157 241 @param (string) $context The context to be used as root branch 158 242 159 243 @param (boolean) $recursive Make it a recursive construction. 160 244 CAUTION! This is EXTREMELY SLOW on large LDAP databases, 161 245 specially when they're not indexed 162 */ 163 function get_ldap_tree($id_source, $context = false, $recursive = false) 246 */ 247 function get_ldap_tree($id_source, $context = false, $recursive = false) 164 248 { 165 249 if (!$this->srcs[$id_source]) … … 167 251 return null; 168 252 } 169 253 170 254 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], false); 171 255 if (!$ldap) … … 173 257 return false; 174 258 } 175 259 176 260 if ($recursive) 177 261 { … … 181 265 return $tree; 182 266 } 183 184 return $this->get_ldap_tree_level($id_source, $ldap, $context, $this->srcs[$id_source]['obj'],$this->srcs[$id_source]['branch']); 185 } 186 267 268 return $this->get_ldap_tree_level($id_source, $ldap, $context, $this->srcs[$id_source]['obj'],$this->srcs[$id_source]['branch'], 0); 269 } 270 271 /*! 272 273 @function get_external_ldap_tree 274 @abstract Returns the LDAP external tree corresponding to the specified level 275 @author Mário César Kolling <mario.kolling@serpro.gov.br> 276 @param (integer) $id_source The ID of the external LDAP source 277 @param (string) $context The context to be used as root branch 278 @param (boolean) $recursive Make it a recursive construction. 279 CAUTION! This is EXTREMELY SLOW on large LDAP databases, 280 specially when they're not indexed 281 */ 282 function get_external_ldap_tree($id_source, $context = false, $recursive = false) 283 { 284 285 286 include(PHPGW_INCLUDE_ROOT . '/contactcenter/setup/external_catalogs.inc.php' ); 287 //include('external_catalogs.inc.php' ); 288 289 if (!$external_srcs[$id_source]) 290 { 291 return null; 292 } 293 294 // calls test_connection first. If succeeded continue, return error message otherwise. 295 if (!($response = $this->test_connection($external_srcs[$id_source]['host'], $external_srcs[$id_source]['acc'], $external_srcs[$id_source]['pw'], 10))) 296 { 297 return array( 298 'msg' => lang("Catalog %1 temporarily unavailable. Please try again later!", $external_srcs[$id_source]['name']), 299 'timeout' => 'true' 300 ); 301 } 302 303 $ldap = $GLOBALS['phpgw']->common->ldapConnect($external_srcs[$id_source]['host'], $external_srcs[$id_source]['acc'],$external_srcs[$id_source]['pw'], false); 304 if (!$ldap) 305 { 306 return false; 307 } 308 309 // Option recursive commented out 310 /* 311 if ($recursive) 312 { 313 $tree = $this->get_ldap_tree_recursive($ldap, $context, $this->srcs[$id_source]['obj'],$this->srcs[$id_source]['branch']); 314 $tree['recursive'] = true; 315 316 return $tree; 317 } 318 */ 319 320 return $this->get_ldap_tree_level($id_source, $ldap, $context, $external_srcs[$id_source]['obj'],$external_srcs[$id_source]['branch'], 1); 321 } 187 322 188 323 /*! … … 201 336 return null; 202 337 } 203 338 204 339 $count = ldap_count_entries($resource,$result_res); 205 340 if ( $count == 0 ) … … 218 353 } 219 354 } 220 355 221 356 $entries = ldap_get_entries($resource, $result_res); 222 357 223 358 for ($i = 0; $i < $entries['count']; $i++) 224 359 { 225 360 $subtree = $this->get_ldap_tree_recursive($resource, $entries[$i]['dn'], $objectClass); 226 361 227 362 $dn_parts=ldap_explode_dn($entries[$i]['dn'],1); 228 229 if ($subtree !== null and is_array($subtree)) 363 364 365 366 if ($subtree !== null and is_array($subtree)) 230 367 { 231 368 $tree[$i]['name'] = $dn_parts[0]; … … 244 381 'sub_branch' => false 245 382 ); 246 } 383 } 247 384 } 248 385 … … 256 393 } 257 394 } 258 395 259 396 function get_ldap_referrals($ds, $dn, $filter) { 260 397 261 398 ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); 262 399 ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,3); 263 400 264 401 if ($ds) { 265 402 ldap_bind($ds); 266 $sr=ldap_list($ds,$dn, $filter); 403 $sr=ldap_list($ds,$dn, $filter); 267 404 $ref = ldap_first_reference($ds, $sr); 268 405 $array_referral = array(); 269 406 $idx = 0; 270 407 271 408 while ($ref) { 272 409 $array_referral[$idx++] = ldap_get_dn($ds, $ref); … … 275 412 return $array_referral; 276 413 } 277 else 414 else 278 415 return false; 279 416 } 280 417 281 418 function get_ldap_sub_branches_referrals($ds, $dn, $filter) { 282 419 283 420 $referral = $this -> get_ldap_referrals($ds, $dn, $filter); 284 421 $sub_branches = array(); 285 422 286 423 for($i = 0; $i <count($referral); $i++) { 287 424 $dn = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $referral[$i])); 288 $dn = explode(",",$dn); 425 $dn = explode(",",$dn); 289 426 $dn = strtoupper(str_replace("ou=", "",$dn[0])); 290 427 $dn = str_replace("DC=", "",$dn); 291 428 292 429 $sub_branch = array( 293 430 'name' => $dn, 294 431 'type' => 'unknown', 295 432 'value' => $referral[$i], 296 'sub_branch' => false 297 ); 298 $sub_branches[$i] = $sub_branch; 433 'sub_branch' => false 434 ); 435 $sub_branches[$i] = $sub_branch; 299 436 } 300 437 return $sub_branches; 301 438 } 302 303 304 function get_ldap_tree_level($id_source, $resource, $context, $objectClass, $branch_dn) 439 440 function translate_accentuation($text) 441 { 442 /* 443 * Esta operação resolve o problema causado pela conversão de caracteres acentuados realizada 444 * pela função ldap_explode_dn(). 445 */ 446 447 return utf8_decode(preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $text)); 448 } 449 450 function get_ldap_tree_level($id_source, $resource, $context, $objectClass, $branch_dn, $external = 0) 305 451 { 306 452 if(strstr($context, "ldap://")){ 307 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $context)); 308 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $context); 453 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $context)); 454 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $context); 309 455 $resource = ldap_connect($host); 310 ldap_bind($resource); 311 } 312 $dn_parts = ldap_explode_dn(($refer_context ? $refer_context : $context),1); 456 ldap_bind($resource); 457 } 458 459 /* 460 * TODO: Search timeouts 461 */ 462 463 $dn_parts = ldap_explode_dn(($refer_context ? $refer_context : $context),1); 313 464 //$filter = '(!(objectClass='.$objectClass.'))'; 314 465 // Don't show OU's whith phpgwAccountVisible equal to '-1' 315 $filter = '(&(!(objectClass='.$objectClass.')) (!(phpgwAccountVisible=-1)))'; 316 $result_res = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter); 466 467 if ($external) 468 { 469 // external source: get all organizationalUnits 470 $filter = '(objectClass=organizationalUnit)'; 471 } 472 else 473 { 474 // get any objectClass except the objectClass used for the source 475 // and whose attribute phpgwAccountVisible value is different from -1 476 $filter = '(&(!(objectClass='.$objectClass.')) (!(phpgwAccountVisible=-1)))'; 477 } 478 $result_res = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, array(), 0, 0); 317 479 @ldap_sort($resource, $result_res, 'ou'); 318 480 481 // Timeouts commented out 482 /* 319 483 if ($result_res === false) 320 484 { 485 if (ldap_errno($resource) === 3) 486 { 487 return array('error_msg' => ldap_error($resource)); 488 } 321 489 return null; 322 490 } 491 */ 323 492 324 493 $count = ldap_count_entries($resource,$result_res); … … 326 495 if ( $count == 0 ) 327 496 { 328 $filter = 'objectClass='.$objectClass; 329 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter); 497 $filter = '(objectClass='.$objectClass.')'; 498 // Get only one attribute of the source's objectClass 499 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1); 330 500 $entries_count = ldap_count_entries($resource, $result_res2); 331 501 … … 333 503 { 334 504 return array( 335 'name' => $ dn_parts[0],505 'name' => $this->translate_accentuation($dn_parts[0]), 336 506 'type' => 'catalog', 337 507 'class' => 'bo_global_ldap_catalog', 338 'class_args' => array($id_source, $context), 508 // Pass the variable $external as a parameter to the constructor 509 'class_args' => array($id_source, $context, $external), 339 510 'icon' => 'globalcatalog-mini.png', 340 511 'value' => $context, … … 345 516 { 346 517 return array( 347 'name' => $ dn_parts[0],518 'name' => $this->translate_accentuation($dn_parts[0]), 348 519 'type' => 'empty' 349 520 ); … … 361 532 $dn_parts_full = ldap_explode_dn($dn,0); 362 533 list($group) = explode('=',$dn_parts_full[0]); 363 364 if ($group == $branch_dn or $branch_dn === 'all') 534 535 //Faz a comparação do branch como case insensitive 536 if (strtolower($group) == strtolower($branch_dn) or $branch_dn === 'all') 365 537 { 366 538 $tree['sub_branch'][$i] = array( 367 'name' => $ dn_parts_1[0],539 'name' => $this->translate_accentuation($dn_parts_1[0]), 368 540 'type' => 'unknown', 369 541 'value' => ($refer_context ? $host."/" : "").$dn, 370 'sub_branch' => false 542 'sub_branch' => false 371 543 ); 372 544 $sub_branch_found = true; … … 374 546 $i++; 375 547 } 376 548 377 549 if(! $refer_context) { 378 550 $array_referral = $this -> get_ldap_sub_branches_referrals($resource, $context,'(objectClass=organizationalUnit)'); … … 383 555 384 556 $filter = 'objectClass='.$objectClass; 385 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter );557 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1); 386 558 $entries_count = ldap_count_entries($resource, $result_res2); 387 559 388 560 if ($result_res2 !== false && $entries_count > 0 && $sub_branch_found) 389 561 { 390 $tree['name'] = $ dn_parts[0];562 $tree['name'] = $this->translate_accentuation($dn_parts[0]); 391 563 $tree['type'] = 'mixed_catalog_group'; 392 564 $tree['class'] = 'bo_global_ldap_catalog'; 393 $tree['class_args'] = array($id_source,$context); 565 // Pass the variable $external as a parameter to the constructor 566 $tree['class_args'] = array($id_source,$context,$external); 394 567 $tree['icon'] = 'globalcatalog-mini.png'; 395 568 $tree['value'] = $context; … … 398 571 { 399 572 return array( 400 'name' => $ dn_parts[0],573 'name' => $this->translate_accentuation($dn_parts[0]), 401 574 'type' => 'catalog', 402 575 'class' => 'bo_global_ldap_catalog', 403 'class_args' => array($id_source, $context), 576 // Pass the variable $external as a parameter to the constructor 577 'class_args' => array($id_source, $context,$external), 404 578 'icon' => 'globalcatalog-mini.png', 405 579 'value' => $context, … … 409 583 else 410 584 { 411 $tree['name'] = $ dn_parts[0];585 $tree['name'] = $this->translate_accentuation($dn_parts[0]); 412 586 $tree['type'] = 'catalog_group'; 413 587 $tree['class'] = 'bo_catalog_group_catalog'; 414 $tree['class_args'] = array('$this', '$this->get_branch_by_level($this->catalog_level[0])'); 588 // Pass the variable $external as a parameter to the constructor 589 $tree['class_args'] = array('$this', '$this->get_branch_by_level($this->catalog_level[0])', $external); 415 590 $tree['value'] = $context; 416 591 $tree['ldap'] = array('id_source' => $id_source, 'context' => $context); 417 592 } 418 419 593 usort($tree['sub_branch'], array($this, "compareTreeNodes")); 420 594 return $tree; … … 422 596 423 597 function compareTreeNodes($a, $b) { 424 598 425 599 return strnatcasecmp($a['name'], $b['name']); 426 } 600 } 427 601 428 602 } -
trunk/contactcenter/inc/class.bo_people_catalog.inc.php
r203 r284 1417 1417 if ($altered) 1418 1418 { 1419 $contact->set_field("last_status", 'U');1420 $contact->set_field("last_update",time()."000");1421 1419 return $contact->commit(); 1422 1420 } -
trunk/contactcenter/inc/class.so_contact.inc.php
r203 r284 110 110 'is_global' => array( 111 111 'name' => 'is_global', 112 'type' => false,113 'state' => 'empty',114 'value' => false),115 'last_status' => array(116 'name' => 'last_status',117 'type' => false,118 'state' => 'empty',119 'value' => false),120 'last_update' => array(121 'name' => 'last_update',122 112 'type' => false, 123 113 'state' => 'empty', -
trunk/contactcenter/inc/class.so_group.inc.php
r258 r284 117 117 'A.id_contact = B.id_contact and B.id_connection = C.id_connection and '. 118 118 'C.connection_is_default = true and B.id_typeof_contact_connection = 1 and '. 119 'A.id_owner ='.$this->owner.' order by A.names_ordered ,C.connection_value';119 'A.id_owner ='.$this->owner.' order by A.names_ordered'; 120 120 121 121 -
trunk/contactcenter/inc/class.ui_api.inc.php
r203 r284 18 18 * 19 19 */ 20 20 21 21 class ui_api 22 22 { 23 23 var $commons; 24 24 var $commons_loaded = false; 25 25 26 26 function ui_api() 27 27 { 28 28 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 29 29 30 30 if (!is_array($preferences)) 31 31 { … … 33 33 //$preferences['personCardPhone'] = 2; 34 34 } 35 36 //$template_dir = PHPGW_SERVER_ROOT . '/contactcenter/templates/default/'; 37 //$template = CreateObject('phpgwapi.Template',$template_dir); 38 $template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 35 36 $template_dir = PHPGW_SERVER_ROOT . '/contactcenter/templates/default/'; 37 $template = CreateObject('phpgwapi.Template',$template_dir); 39 38 40 39 $template->set_file(array('api' => 'api_common.tpl')); 41 40 42 41 $template->set_var('cc_email_id_type', $preferences['personCardEmail']); 43 44 42 45 43 /* Messages */ 46 44 $template->set_var('cc_msg_err_invalid_catalog',lang('Unavailable or empty Catalog')); 47 $template->set_var('cc_msg_err_contacting_server',lang('Couldn\'t contact server or server response is invalid. Contact Admin.'));45 $template->set_var('cc_msg_err_contacting_server',lang('Couldn\'t contact server or server response is invalid.')); 48 46 $template->set_var('cc_msg_err_timeout',lang('Operation Timed Out.')); 49 47 $template->set_var('cc_msg_err_serialize_data_unknown',lang('Data to be serialized is of unknown type!')); … … 77 75 $template->set_var('cc_js_djswin', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/js/dJSWin/dJSWin.js'); 78 76 $template->set_var('cc_js_catalog_tree', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_tree.js'); 79 77 80 78 $template->parse('out','api'); 81 79 … … 83 81 $this->commons_loaded = false; 84 82 } 85 83 86 84 /* DEPRECTED! Use get_email_win() instead */ 87 85 function ui_get_email_win() … … 93 91 { 94 92 //$search = $this->ui_get_search_win(); 95 93 96 94 $template_dir = PHPGW_SERVER_ROOT . '/contactcenter/templates/default/'; 97 95 $template = CreateObject('phpgwapi.Template', $template_dir); 98 96 99 97 $template->set_file(array('email_win' => 'email_win.tpl')); 100 98 101 99 if (!$this->commons_loaded) 102 100 { … … 108 106 $template->set_var('cc_api', ''); 109 107 } 110 108 111 109 //$template->set_var('cc_search_win', $search); 112 110 $template->set_var('cc_js_search', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_search.js'); 113 111 114 112 $template->set_var('cc_email_id_type', $search); 115 113 116 114 $template->set_var('cc_email_win_title',lang('Contact Center').' - '.lang('Catalog Entries Emails')); 117 115 $template->set_var('cc_email_status',lang('Status').':'); 118 116 $template->set_var('cc_email_search_text',lang('Search').'...'); 119 117 120 118 $template->set_var('cc_choose_catalogue',lang('Choose a catalogue').'...'); 121 119 $template->set_var('cc_choose_ordinance',lang('Choose a ordinance').'...'); 122 120 123 121 $template->set_var('cc_btn_to_add',lang('To').' >>'); 124 122 $template->set_var('cc_btn_to_del','<< '.lang('To')); … … 132 130 $template->set_var('cc_btn_ok',lang('Ok')); 133 131 $template->set_var('cc_btn_cancel',lang('Cancel')); 134 132 135 133 $template->set_var('cc_label_to',lang('To').':'); 136 134 $template->set_var('cc_label_cc',lang('Cc').':'); … … 140 138 $template->set_var('cc_label_catalogue_type',lang('Type Of Catalogue').':'); 141 139 $template->set_var('cc_label_ordinance_type',lang('Type Of Ordinace').':'); 142 140 143 141 $template->set_var('phpgw_img_dir', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/images'); 144 142 145 143 $template->set_var('cc_js_email_win', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_email_win.js'); 146 144 147 145 $template->parse('out','email_win'); 148 146 … … 161 159 162 160 $template->set_file(array('search' => 'search_win.tpl')); 163 161 164 162 if (!$this->commons_loaded) 165 163 { … … 171 169 $template->set_var('cc_api', ''); 172 170 } 173 171 174 172 $template->set_var('cc_search_title',lang('Contact Center - Search for Catalog Entries')); 175 173 $template->set_var('cc_search_minimize',lang('Minimize')); … … 180 178 $template->set_var('cc_search_go',lang('Go')); 181 179 $template->set_var('cc_search_cancel',lang('Cancel')); 182 180 183 181 $template->set_var('cc_js_search_win', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/cc_search_win.js'); 184 182 185 183 $template->set_var('phpgw_img_dir', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/images'); 186 184 187 185 $template->parse('out','search'); 188 186 … … 205 203 206 204 $template->set_file(array('full_add' => 'full_add.tpl')); 207 205 208 206 if (!$this->commons_loaded) 209 207 { … … 215 213 $template->set_var('cc_api', ''); 216 214 } 217 215 218 216 $template->set_var('cc_contact_title',lang('Contact Center').' - '.lang('Contacts')); 219 217 … … 223 221 $template->set_var('cc_msg_type_city',lang('Type new city here').'...'); 224 222 /* End Messages */ 225 223 226 224 /* Contact */ 227 225 $template->set_var('cc_contact_save',lang('Save')); … … 232 230 $template->set_var('cc_contact_addrs',lang('Addresses')); 233 231 $template->set_var('cc_contact_conns',lang('Connections')); 234 $template->set_var('emails_telephones', lang("E-Mails and Telephones"));235 $template->set_var('cc_default', lang("Default"));236 237 232 /* End Contact */ 238 233 239 234 /* Contact - Personal Data */ 240 235 $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 241 236 242 237 $j = 0; 243 238 for ($i = 0; $i < 5; $i+=2) … … 262 257 $j++; 263 258 } 264 259 265 260 $template->set_var('cc_pd_birth_size_0', "{$date[0]['size']}"); 266 261 $template->set_var('cc_pd_birth_size_1', "{$date[1]['size']}"); 267 262 $template->set_var('cc_pd_birth_size_2', "{$date[2]['size']}"); 268 263 269 264 $template->set_var('cc_pd_birthdate_0', "{$date[0]['name']}"); 270 265 $template->set_var('cc_pd_birthdate_1', "{$date[1]['name']}"); … … 273 268 $template->set_var('cc_pd_select_photo_b', lang('Browse').'...'); 274 269 $template->set_var('cc_form_photo_src', 'photo_form.html'); 275 270 276 271 $template->set_var('cc_pd_select_photo',lang('Select Photo')); 277 272 $template->set_var('cc_pd_alias',lang('Alias')); … … 291 286 $template->set_var('cc_pd_female',lang('Female')); 292 287 /* End Contact - Personal Data */ 293 288 294 289 /* Contact - Addresses */ 295 290 $template->set_var('cc_addr_types',lang('Type of Address')); … … 315 310 $template->set_var('cc_available',lang('Available')); 316 311 /* End Contact - Addresses */ 317 318 312 319 313 /* Contact - Connections */ 320 314 $template->set_var('cc_conn_type',lang('Type of Connection')); 321 315 $template->set_var('cc_conn_name',lang('Connection Name')); 322 316 $template->set_var('cc_conn_value',lang('Connection Value')); 323 317 324 318 $template->set_var('cc_new_same_type',lang('New from the same Type').'...'); 325 319 326 320 $template->set_var('cc_conn_type_none',lang('Choose Type of Connection').'...'); 327 321 /* End Contact - Connections */ 328 322 329 $template->set_var('email', lang("E-Mail"));330 $template->set_var('telephone', lang("Telephone"));331 $template->set_var('choose_email_telephone', lang("Choose 'E-Mail' or 'Telephone'"));332 333 323 $template->parse('out_full', 'full_add'); 334 324 … … 342 332 343 333 $template->set_file(array('quickAdd' => 'quickAddPlugin.tpl')); 344 334 345 335 if (!$this->commons_loaded) 346 336 { … … 352 342 $template->set_var('cc_api', ''); 353 343 } 354 344 355 345 $template->set_var('ccQAPluginFile', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/ccQuickAdd-plugin.js'); 356 346 … … 360 350 $nFields = 5; 361 351 $fields = array( 362 lang('Alias'), 363 lang('Given Names'), 364 lang('Family Names'), 352 lang('Alias'), 353 lang('Given Names'), 354 lang('Family Names'), 365 355 lang('Phone'), 366 356 lang('Email') 367 357 ); 368 358 369 359 $template->set_var('ccQAnFields', $nFields); 370 360 371 361 $fieldsHTML = ''; 372 362 $fieldsTop = 10; … … 375 365 { 376 366 $fieldsHTML .= '<span id="ccQuickAddT'.$i.'" style="position: absolute; top: '.($fieldsTop+$i*$fieldsSpace).'px; left: 5px; width: 100px; text-align: right; border: 0px solid #999;">'.$fields[$i].':</span>'."\n"; 377 $fieldsHTML .= '<input id="ccQuickAddI'.$i.'" type="text" value="" maxlength="50" style="position: absolute; top: '.($fieldsTop+$i*$fieldsSpace).'px; left: 110px; width: 135px;">'."\n"; 367 if ($i == 0){ 368 $fieldsHTML .= '<input id="ccQuickAddI'.$i.'" type="text" value="" maxlength="30" style="position: absolute; top: '.($fieldsTop+$i*$fieldsSpace).'px; left: 110px; width: 135px;">'."\n"; 369 } 370 else if ($i == 4){ 371 $fieldsHTML .= '<input id="ccQuickAddI'.$i.'" type="text" value="" maxlength="100" style="position: absolute; top: '.($fieldsTop+$i*$fieldsSpace).'px; left: 110px; width: 135px;">'."\n"; 372 } 373 else { 374 $fieldsHTML .= '<input id="ccQuickAddI'.$i.'" type="text" value="" maxlength="50" style="position: absolute; top: '.($fieldsTop+$i*$fieldsSpace).'px; left: 110px; width: 135px;">'."\n"; 375 } 378 376 } 379 377 … … 381 379 $template->set_var('ccQAWinHeight', ($i+1)*$fieldsSpace+$fieldsTop); 382 380 $template->set_var('ccQAFunctionsTop', ($fieldsTop+$i*$fieldsSpace).'px'); 383 381 384 382 /* Images Dir */ 385 383 $template->set_var('ccQACardImgRoot', $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/templates/default/images/'); 386 384 387 385 /* Texts */ 388 386 $template->set_var('ccQATitle', lang('Contact Center').' - '.lang('Quick Add')); … … 390 388 $template->set_var('ccQAClear', lang('Reset')); 391 389 $template->set_var('ccQACancel', lang('Cancel')); 392 390 393 391 $template->parse('out_QA', 'quickAdd'); 394 392 395 393 return $template->get_var('out_QA'); 396 394 } 397 395 398 396 function get_add_group() 399 397 { … … 402 400 403 401 $template->set_file(array('addGroup' => 'addGroup.tpl')); 404 402 405 403 if (!$this->commons_loaded) 406 404 { … … 410 408 else 411 409 { 412 410 413 411 $template->set_var('cc_api', ''); 414 412 } 415 416 $template->set_var('ccAGFile', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/ccAddGroup.js'); 417 $template->set_var('ccAGWinHeightIE', '285'); 413 414 $template->set_var('ccAGFile', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/contactcenter/js/ccAddGroup.js'); 415 $template->set_var('ccAGWinHeightIE', '285'); 418 416 $template->set_var('ccAGWinHeightMO', '335'); 419 417 420 418 /* Images Dir */ 421 419 $template->set_var('ccAGCardImgRoot', $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/templates/default/images/'); 422 420 423 421 /* Texts */ 424 422 $template->set_var('ccAGTitle', lang('Contact Center').' - '.lang('Group Add')); … … 426 424 $template->set_var('ccAGClear', lang('Reset')); 427 425 $template->set_var('ccAGCancel', lang('Cancel')); 428 $title = '<input type="text" id="title" name="title" value="'.$group['title'].'" size="50" maxlength="50"/>'; 429 430 $template->set_var('title', $title); 426 $title = '<input type="text" id="title" name="title" value="'.$group['title'].'" size="50" maxlength="50"/>'; 427 428 $template->set_var('title', $title); 431 429 // set content and label variables. 432 430 $template->set_var(array( 433 'msg_text' => lang($status), 434 'txt_title' => lang('Contact Group List'), 431 'msg_text' => lang($status), 432 'txt_title' => lang('Contact Group List'), 435 433 'txt_cancel'=> lang('cancel'), 436 'txt_add'=> lang('Add'), 434 'txt_add'=> lang('Add'), 437 435 'txt_rem'=> lang('Remove'), 438 436 'txt_personal_contacts' => lang('Personal Contacts'), 439 437 'txt_contacts_in_list' => lang("Participants"), 440 438 'txt_name' => lang('Full Name'))); 441 439 442 440 $template->parse('out_AG', 'addGroup'); 443 441 444 442 return $template->get_var('out_AG'); 445 443 } -
trunk/contactcenter/inc/class.ui_data.inc.php
r276 r284 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 //TODO: Achar um modo de descarregar este array da sessï¿œo quando o usuï¿œrio sair da tela do contactcenter. 51 //TODO: Descarregar este array da memï¿œria toda vez que uma nova consulta por letras ou mudanï¿œa de catï¿œlogo for feita. 52 $temp3 = $GLOBALS['phpgw']->session->appsession('ui_data.last_search_ids','contactcenter'); 53 50 54 $this->bo = CreateObject('contactcenter.bo_contactcenter'); 51 55 52 56 if ($temp) 53 57 { … … 59 63 $this->all_entries = $temp2; 60 64 } 61 65 66 if ($temp3) 67 { 68 $this->last_search_ids = $temp3; 69 } 70 62 71 if (!$this->page_info['actual_catalog']) 63 72 { … … 65 74 $this->page_info['actual_catalog'] = $catalogs[0]; 66 75 } 67 68 $this->page_info['actual_catalog'] =& $this->bo->set_catalog($this->page_info['actual_catalog']); 69 76 77 $this->page_info['actual_catalog'] =& $this->bo->set_catalog($this->page_info['actual_catalog']); 78 70 79 if($this->page_info['actual_catalog']['class'] == 'bo_group_manager') 71 80 $this -> typeContact = 'groups'; … … 75 84 76 85 /*! 77 86 78 87 @function index 79 88 @abstract Builds the Main Page 80 89 @author Raphael Derosso Pereira 81 90 @author Jonas Goes 82 83 */ 91 92 */ 84 93 function index() 85 { 94 { 86 95 if(!@is_object($GLOBALS['phpgw']->js)) 87 96 { … … 92 101 $GLOBALS['phpgw']->js->validate_file('venus','jsStructUtil'); 93 102 $GLOBALS['phpgw']->js->validate_file('venus','cssUtil'); 94 103 95 104 // $GLOBALS['phpgw']->js->set_onload('setTimeout(\'updateCards()\',1000)'); 96 105 $GLOBALS['phpgw']->common->phpgw_header(); 97 106 98 107 $GLOBALS['phpgw']->template->set_file(array('index' => 'index.tpl')); 99 108 $GLOBALS['phpgw']->template->set_var('cc_root_dir', $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/'); 100 109 101 110 /* Quick Add */ 102 111 $GLOBALS['phpgw']->template->set_var('cc_qa_alias',lang('Alias').':'); … … 107 116 $GLOBALS['phpgw']->template->set_var('cc_qa_save',lang('Save')); 108 117 $GLOBALS['phpgw']->template->set_var('cc_qa_clear',lang('Clear')); 109 $GLOBALS['phpgw']->template->set_var('cc_qa_close',lang('Close'));110 118 /* End Quick Add */ 111 119 112 120 $cc_css_file = $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/styles/cc.css'; 113 121 $cc_card_image_file = $GLOBALS['phpgw_info']['server']['webserver_url'].'/contactcenter/templates/default/images/card.png'; … … 115 123 $GLOBALS['phpgw']->template->set_var('cc_dtree_css', $cc_dtree_file); 116 124 $GLOBALS['phpgw']->template->set_var('cc_card_image',$cc_card_image_file); 117 125 118 126 $GLOBALS['phpgw']->template->set_var('cc_personal',lang('Personal')); 119 127 120 128 $GLOBALS['phpgw']->template->set_var('cc_full_add',lang('Full Add')); 121 129 $GLOBALS['phpgw']->template->set_var('cc_reset',lang('Reset')); 122 130 123 131 $GLOBALS['phpgw']->template->set_var('cc_personal_data',lang('Personal Data')); 124 132 $GLOBALS['phpgw']->template->set_var('cc_addresses',lang('Addresses')); … … 129 137 $GLOBALS['phpgw']->template->set_var('cc_catalogs',lang('Catalogues')); 130 138 $GLOBALS['phpgw']->template->set_var('cc_group_add',lang('Group Add')); 131 139 132 140 /* Panel */ 133 141 $GLOBALS['phpgw']->template->set_var('cc_panel_new',lang('New').'...'); … … 135 143 $GLOBALS['phpgw']->template->set_var('cc_panel_table',lang('Table View')); 136 144 $GLOBALS['phpgw']->template->set_var('cc_panel_cards',lang('Cards View')); 137 $GLOBALS['phpgw']->template->set_var('cc_btn_import_export', lang('Import/Export')); 138 $GLOBALS['phpgw']->template->set_var('cc_btn_new', lang("New...")); 139 145 140 146 $GLOBALS['phpgw']->template->set_var('cc_panel_search_found',lang('Showing found entries')); 141 147 $GLOBALS['phpgw']->template->set_var('cc_panel_first_page',lang('First Page')); … … 145 151 $GLOBALS['phpgw']->template->set_var('cc_all',lang('all')); 146 152 /* End Panel */ 147 153 148 154 /* Messages */ 149 155 $GLOBALS['phpgw']->template->set_var('cc_msg_no_cards',lang('No Cards')); … … 160 166 $GLOBALS['phpgw']->template->set_var('cc_empty',lang('Empty')); 161 167 /* End Messages */ 162 168 163 169 $GLOBALS['phpgw']->template->set_var('cc_results',lang('Results')); 164 170 $GLOBALS['phpgw']->template->set_var('cc_is_my',lang('Is My')); 165 $GLOBALS['phpgw']->template->set_var('cc_ie_personal',lang('Import/Export pesonal contacts'));166 171 $GLOBALS['phpgw']->template->set_var('cc_btn_search',lang('Search')); 167 172 $GLOBALS['phpgw']->template->set_var('cc_add_relation',lang('Add Relation')); 168 $GLOBALS['phpgw']->template->set_var('cc_del_relation',lang('Remove Selected Relations')); 173 $GLOBALS['phpgw']->template->set_var('cc_del_relation',lang('Remove Selected Relations')); 169 174 $GLOBALS['phpgw']->template->set_var('cc_msg_group',lang('Group')); 170 175 $GLOBALS['phpgw']->template->set_var('cc_msg_contact_full',lang('Contact [Full]')); … … 174 179 $GLOBALS['phpgw']->template->set_var('phpgw_img_dir', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/phpgwapi/images'); 175 180 176 $GLOBALS['phpgw']->template->set_var('cc_msg_import_contacts', lang('Import Contacts'));177 $GLOBALS['phpgw']->template->set_var('cc_msg_export_contacts', lang('Export Contacts'));178 $GLOBALS['phpgw']->template->set_var('cc_msg_expresso_info_csv', lang('The Expresso supports the contacts importation in the CSV file format.'));179 $GLOBALS['phpgw']->template->set_var('cc_msg_choose_file_type', lang('Select the file type'));180 $GLOBALS['phpgw']->template->set_var('cc_msg_outlook_express', lang('Outlook Express'));181 $GLOBALS['phpgw']->template->set_var('cc_msg_outlook2k', lang('Outlook 2000'));182 $GLOBALS['phpgw']->template->set_var('cc_msg_expresso_default', lang('Expresso (default)'));183 $GLOBALS['phpgw']->template->set_var('cc_msg_choose_contacts_file', lang('Select the file that contains the contacts to be imported:'));184 $GLOBALS['phpgw']->template->set_var('cc_msg_close_win', lang('Close'));185 $GLOBALS['phpgw']->template->set_var('cc_msg_ie_personal', lang('Import / Export personal Contacts'));186 $GLOBALS['phpgw']->template->set_var('cc_msg_import_fail', lang('The importation has failed. Verify the file format.'));187 $GLOBALS['phpgw']->template->set_var('cc_msg_importing_contacts', lang('Importing Contacts...'));188 $GLOBALS['phpgw']->template->set_var('cc_msg_import_finished', lang('The importation has finished.'));189 $GLOBALS['phpgw']->template->set_var('cc_msg_new', lang(' new'));190 $GLOBALS['phpgw']->template->set_var('cc_msg_failure', lang(' failed'));191 $GLOBALS['phpgw']->template->set_var('cc_msg_exists', lang(' were existent'));192 $GLOBALS['phpgw']->template->set_var('cc_msg_show_more_info', lang('show more info'));193 $GLOBALS['phpgw']->template->set_var('cc_msg_clean', lang('Clean'));194 $GLOBALS['phpgw']->template->set_var('cc_msg_invalid_csv', lang('Select a valid CSV file to import your contacts'));195 $GLOBALS['phpgw']->template->set_var('cc_msg_export_csv', lang('Select the format type that you want to export your contacts'));196 $GLOBALS['phpgw']->template->set_var('cc_msg_automatic', lang('Automatic'));197 $GLOBALS['phpgw']->template->set_var('cc_msg_export_error', lang('An error has occurred while the exportation.'));198 $GLOBALS['phpgw']->template->set_var('cc_msg_new_email', lang('New Email'));199 $GLOBALS['phpgw']->template->set_var('cc_msg_main', lang('Main'));200 $GLOBALS['phpgw']->template->set_var('cc_msg_alternative', lang('Alternative'));201 $GLOBALS['phpgw']->template->set_var('cc_msg_select_email', lang('Select E-Mail'));202 $GLOBALS['phpgw']->template->set_var('cc_msg_new_phone', lang('New Telephone'));203 $GLOBALS['phpgw']->template->set_var('cc_msg_home', lang('Home'));204 $GLOBALS['phpgw']->template->set_var('cc_msg_cellphone', lang('Cellphone'));205 $GLOBALS['phpgw']->template->set_var('cc_msg_work', lang('Work'));206 $GLOBALS['phpgw']->template->set_var('cc_msg_fax', lang('Fax'));207 $GLOBALS['phpgw']->template->set_var('cc_msg_pager', lang('Pager'));208 $GLOBALS['phpgw']->template->set_var('cc_msg_choose_phone', lang('Select the telephone'));209 $GLOBALS['phpgw']->template->set_var('cc_msg_warn_firefox', lang('Warning: Too old version of Firefox'));210 $GLOBALS['phpgw']->template->set_var('cc_msg_firefox_half1', lang('For this application work correctly</u>'));211 $GLOBALS['phpgw']->template->set_var('cc_msg_firefox_half2', lang('it\'s necessary to update your Firefox Browser for a new version (version > 1.5) Install now clicking in the link bellow, or if you want to update it later'));212 $GLOBALS['phpgw']->template->set_var('cc_msg_click_close', lang('click Close'));213 $GLOBALS['phpgw']->template->set_var('cc_msg_install_now', lang('Install Now'));214 $GLOBALS['phpgw']->template->set_var('cc_msg_install_new_firefox', lang('Install a new Firefox version'));215 $GLOBALS['phpgw']->template->set_var('cc_msg_moz_thunderbird', lang('Export as Mozilla Thunderbird CSV.'));216 $GLOBALS['phpgw']->template->set_var('cc_msg_outlook_express_pt', lang('Export as Outlook Express (Portuguese) CSV.'));217 $GLOBALS['phpgw']->template->set_var('cc_msg_outlook_express_en', lang('Export as Outlook Express (English) CSV.'));218 $GLOBALS['phpgw']->template->set_var('cc_msg_outlook_2k_pt', lang('Export as Outlook 2000 (Portuguese) CSV.'));219 $GLOBALS['phpgw']->template->set_var('cc_msg_outlook_2k_en', lang('Export as Outlook 2000 (English) CSV.'));220 $GLOBALS['phpgw']->template->set_var('cc_msg_expresso_default_csv', lang('Export as Expresso (Default) CSV.'));221 $GLOBALS['phpgw']->template->set_var('cc_msg_copy_to_catalog', lang('Copy to personal catalog.'));222 $GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.'));223 $GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name'));224 225 181 $GLOBALS['phpgw']->template->parse('out','index'); 226 182 227 183 $api = CreateObject('contactcenter.ui_api'); 228 184 $main = $api->get_full_add(); … … 235 191 } 236 192 237 193 238 194 /*! 239 195 240 196 @function data_manager 241 @abstract Calls the right method and passes to it the right 197 @abstract Calls the right method and passes to it the right 242 198 parameters 243 199 @author Raphael Derosso Pereira 244 200 245 201 */ 246 202 function data_manager() … … 251 207 case 'set_n_cards': 252 208 return $this->set_n_cards((int)$_GET['ncards']); 253 209 254 210 case 'get_cards_data': 255 return $this->get_cards_data($_POST['letter'], $_POST['page'], unserialize(str_replace('\\"','"',$_POST['ids']))); 211 212 $ids = false; 213 // To support ldap catalogs using accentuation 214 if ($_POST['letter'] == 'search' && isset($_POST['data'])) 215 { 216 //$ids = utf8_decode($this->search($_POST['data'])); 217 $ids = $this->search($_POST['data']); 218 } 219 220 //return $this->get_cards_data($_POST['letter'], $_POST['page'], unserialize(str_replace('\\"','"',$ids))); 221 return $this->get_cards_data($_POST['letter'], $_POST['page'], $ids); 222 //return $this->get_cards_data($_POST['letter'], $_POST['page'], unserialize(str_replace('\\"','"',$_POST['ids']))); 223 256 224 case 'get_cards_data_get': 257 225 return $this->get_cards_data($_GET['letter'], $_GET['page'], unserialize(str_replace('\\"','"',$_GET['ids']))); … … 261 229 return $this->get_photo($_GET['id']); 262 230 263 231 264 232 /* Catalog Methods */ 265 233 case 'set_catalog': 266 234 return $this->set_catalog($_GET['catalog']); 267 235 268 236 case 'get_catalog_tree': 269 237 echo serialize($this->get_catalog_tree($_GET['level'])); … … 279 247 280 248 case 'get_catalog_add_contact': 281 echo serialize($this->get_catalog_add_contact($_POST['id'])); 249 // To support ldap catalogs with accentuation 250 echo serialize($this->get_catalog_add_contact(utf8_decode($_POST['id']))); 282 251 return; 283 252 284 253 /* Full Add Methods */ 285 254 case 'get_full_data': 286 255 return $this->get_full_data($_GET['id']); 287 256 288 257 case 'get_group': 289 258 return $this->get_group_data($_GET['id']); 290 259 291 260 case 'get_contact_full_add_const': 292 261 return $this->get_contact_full_add_const(); … … 300 269 case 'get_states': 301 270 return $this->get_states($_GET['country']); 302 271 303 272 case 'get_cities': 304 273 return $this->get_cities($_GET['country'], $_GET['state'] ? $_GET['state'] : null); 305 306 274 275 307 276 /* Other Methods */ 308 case 'quick_add': 277 case 'quick_add': 309 278 return $this->quick_add($_POST['add']); 310 311 case 'add_group': 279 280 case 'add_group': 312 281 return $this->add_group($_POST['add']); 313 282 314 283 case 'remove_entry': 315 284 return $this->remove_entry((int)$_GET['remove']); 316 285 317 286 case 'remove_all_entries': 318 287 return $this->remove_all_entries(); 319 288 320 289 case 'remove_group': 321 322 return $this->remove_group((int)$_GET['remove']); 290 291 return $this->remove_group((int)$_GET['remove']); 323 292 324 293 case 'search': … … 357 326 358 327 /*! 359 328 360 329 @function set_n_cards 361 330 @abstract Informs the class the number of cards the page can show 362 331 @author Raphael Derosso Pereira 363 332 364 333 @param integer $n_cards The number of cards 365 334 366 335 */ 367 336 function set_n_cards($n_cards) … … 372 341 echo 1; 373 342 } 374 343 375 344 $this->save_session(); 376 345 } 377 346 378 347 /*! 379 348 380 349 @function set_catalog 381 350 @abstract Sets the current catalog selected by the user 382 351 @author Raphael Derosso Pereira 383 352 384 353 @param string $id_catalog The sequence of IDs to reach the catalog 385 354 separated by commas 386 355 387 356 */ 388 357 function set_catalog($id_catalog) … … 390 359 $id_catalog = str_replace('\\"', '"', $id_catalog); 391 360 $temp =& $this->bo->set_catalog($id_catalog); 392 361 393 362 if ($temp) 394 363 { … … 397 366 $this->page_info['actual_catalog'] =& $temp; 398 367 $this->save_session(); 399 368 400 369 $catalog_info = $this->bo->get_branch_by_level($this->bo->catalog_level[0]); 401 370 402 371 if ($catalog_info['class'] === 'bo_global_ldap_catalog' || 403 372 $catalog_info['class'] === 'bo_catalog_group_catalog') … … 409 378 $perms = 15; 410 379 } 411 380 412 381 echo serialize(array( 413 382 'status' => 'ok', … … 417 386 return; 418 387 } 419 388 420 389 echo serialize(array( 421 390 'status' => 'ok', … … 423 392 )); 424 393 } 425 426 394 395 427 396 /*! 428 397 429 398 @function get_catalog_tree 430 399 @abstract Returns the JS serialized array to used as the tree 431 400 level 432 401 @author Raphael Derosso Pereira 433 434 @param (string) $level The level to be taken 435 402 @author Mï¿œrio Cï¿œsar Kolling (error messages and timeout) 403 404 @param (string) $level The level to be taken 405 436 406 */ 437 407 function get_catalog_tree($level) … … 442 412 443 413 $parent = '0'; 444 414 445 415 if (!($tree = $this->bo->get_catalog_tree($level))) 446 416 { … … 456 426 $parent = substr($level, 0, $last_dot); 457 427 $child = substr($level, $last_dot+1, strlen($level)); 458 428 459 429 if (!($tree[$child] = $this->bo->get_catalog_tree($level))) 460 430 { … … 464 434 ); 465 435 } 466 } 467 436 // Deals with timeout and returns the generated message to the browser 437 else if (!empty($tree[$child]['timeout']) && !empty($tree[$child]['msg'])) 438 { 439 $tmp = array( 440 'msg' => $tree[$child]['msg'], 441 'status' => 'fatal' 442 ); 443 unset($tree[$child]); 444 return $tmp; 445 } 446 } 447 468 448 $folderImageDir = $GLOBALS['phpgw']->common->image('contactcenter','globalcatalog-mini.png'); 469 449 $folderImageDir = substr($folderImageDir, 0, strpos($folderImageDir, 'globalcatalog-mini.png')); 470 450 451 // Deals with error messages from the server and returns them to the browser 452 if ($tree['msg']) 453 { 454 $msg = $tree['msg']; 455 unset($tree['msg']); 456 } 457 471 458 $tree_js = $this->convert_tree($tree, $folderImageDir, $parent); 472 473 return array( 474 'data' => $tree_js, 475 'msg' => lang('Catalog Tree Successfully taken!'), 476 'status' => 'ok' 477 ); 478 } 479 459 460 // Return status = ok, or else return generated message to the browser 461 if (!$msg) 462 { 463 return array( 464 'data' => $tree_js, 465 'msg' => lang('Catalog Tree Successfully taken!'), 466 'status' => 'ok' 467 ); 468 } 469 else 470 { 471 return array( 472 'data' => $tree_js, 473 'msg' => $msg, 474 'status' => 'error' 475 ); 476 477 } 478 } 479 480 480 /* function get_catalog_tree($level, $name = 'tree') 481 481 { … … 487 487 $parent = '0'; 488 488 $child = '0'; 489 489 490 490 if (!($tree = $this->bo->get_catalog_tree($level))) 491 491 { … … 498 498 $parent = substr($level, 0, $last_dot); 499 499 $child = substr($level, $last_dot+1, strlen($level)); 500 500 501 501 $tree_js = ''; 502 502 503 503 if (!($tree[$child] = $this->bo->get_catalog_tree($level))) 504 504 { … … 506 506 } 507 507 } 508 508 509 509 $folderImageDir = $GLOBALS['phpgw']->common->image('contactcenter','globalcatalog-mini.png'); 510 510 $folderImageDir = substr($folderImageDir, 0, strpos($folderImageDir, 'globalcatalog-mini.png')); 511 511 512 512 $tree_js .= $this->convert_tree($tree, $name, $folderImageDir, $parent); 513 513 514 514 return $tree_js; 515 515 } 516 */ 517 516 */ 517 518 518 /*! 519 519 520 520 @function get_actual_catalog 521 521 @abstract Returns the actual selected Catalog … … 524 524 */ 525 525 function get_actual_catalog() 526 { 526 { 527 527 $level = $this->bo->get_level_by_branch($this->bo->get_actual_catalog(), $this->bo->tree['branches'], '0'); 528 528 529 529 if ($level) 530 530 { … … 540 540 ); 541 541 } 542 542 543 543 /*! 544 544 545 545 @function get_cards_data 546 546 @abstract Returns the information that is placed on the cards 547 547 @author Raphael Derosso Pereira 548 548 549 549 @param string $letter The first letter to be searched 550 @param (int) $page The page to be taken 550 @param (int) $page The page to be taken 551 551 @param (str) $ids The ids to be taken in case of search 552 552 … … 556 556 function get_cards_data($letter, $page, $ids) 557 557 { 558 559 // It's an external catalog? 560 $external = $this->bo->is_external($this->page_info['actual_catalog']); 561 558 562 //echo $page."\n"; 559 563 if ($letter !== 'search' and ($letter != $this->page_info['actual_letter'] or 560 ($letter == $this->page_info['actual_letter'] and $page == $this->page_info['actual_page']) or 564 ($letter == $this->page_info['actual_letter'] and $page == $this->page_info['actual_page']) or 561 565 $this->page_info['changed'])) 562 566 { 563 567 unset($ids); 564 568 $this->page_info['changed'] = false; 565 569 566 570 switch ($this->page_info['actual_catalog']['class']) 567 571 { … … 650 654 ); 651 655 } 652 656 653 657 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 654 658 655 659 $find_other[0] = array( 656 660 //'offset' => (($page-1)*$this->page_info['n_cards']), … … 658 662 'order' => 'contact.names_ordered' 659 663 ); 660 664 661 665 break; 662 666 667 //case 'bo_external_ldap_catalog': 668 669 // break; 670 663 671 case 'bo_global_ldap_catalog': 664 672 $field_name = 'id_contact'; … … 671 679 'type' => 'iLIKE', 672 680 'value' => $letter !== 'all' ? $letter.'%' : '%' 673 ) 681 ), 682 /* 683 * Restrict the returned contacts in a "first letter" search 684 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 685 * phpgwAccountVisible != -1 and objectClass = inetOrgPerson 686 */ 687 1 => array( 688 'field' => 'contact.object_class', 689 'type' => '=', 690 'value' => 'phpgwAccount' 691 ), 692 2 => array( 693 'field' => 'contact.account_status', 694 'type' => 'iLIKE', 695 'value' => '%' 696 ), 697 3 => array( 698 'field' => 'contact.account_visible', 699 'type' => '!=', 700 'value' => '-1' 701 ), 702 4 => array( 703 'field' => 'contact.object_class', 704 'type' => '=', 705 'value' => 'inetOrgPerson' 706 ), 674 707 ); 675 $find_restric[0][1] = array( 676 'type' => 'branch', 677 'value' => 'OR', 678 'sub_branch' => array( 679 0 => array( 680 'field' => 'contact.account_type', 681 'type' => '=', 682 'value' => 'u' 683 ), 684 /*1 => array( 685 'field' => 'contact.account_type', 686 'type' => '=', 687 'value' => 'g' 688 ),*/ 689 2 => array( 690 'field' => 'contact.account_type', 691 'type' => '=', 692 'value' => 'l' 708 // If not external catalog get only phpgwAccountType = u ou l 709 if (!$external) 710 { 711 $find_restric[0][5] = array( 712 'type' => 'branch', 713 'value' => 'OR', 714 'sub_branch' => array( 715 0 => array( 716 'field' => 'contact.account_type', 717 'type' => '=', 718 'value' => 'u' 719 ), 720 /*1 => array( 721 'field' => 'contact.account_type', 722 'type' => '=', 723 'value' => 'g' 724 ),*/ 725 2 => array( 726 'field' => 'contact.account_type', 727 'type' => '=', 728 'value' => 'l' 729 ) 693 730 ) 694 )695 );731 ); 732 } 696 733 } 697 734 else 698 735 { 699 736 $find_restric[0] = array( 737 /* 738 * Restrict the returned contacts in a "first number" search 739 * to objectClass = phpgwAccount, must have attibute phpgwAccountStatus, 740 * phpgwAccountVisible != -1 and objectClass = inetOrgPerson 741 */ 700 742 0 => array( 743 'field' => 'contact.object_class', 744 'type' => '=', 745 'value' => 'phpgwAccount' 746 ), 747 1 => array( 748 'field' => 'contact.account_status', 749 'type' => 'iLIKE', 750 'value' => '%' 751 ), 752 2 => array( 753 'field' => 'contact.account_visible', 754 'type' => '!=', 755 'value' => '-1' 756 ), 757 3 => array( 758 'field' => 'contact.object_class', 759 'type' => '=', 760 'value' => 'inetOrgPerson' 761 ), 762 4 => array( 701 763 'type' => 'branch', 702 764 'value' => 'OR', … … 755 817 ), 756 818 ); 757 $find_restric[0][1] = array( 758 'type' => 'branch', 759 'value' => 'OR', 760 'sub_branch' => array( 761 0 => array( 762 'field' => 'contact.account_type', 763 'type' => '=', 764 'value' => 'u' 765 ), 766 /*1 => array( 767 'field' => 'contact.account_type', 768 'type' => '=', 769 'value' => 'g' 770 ),*/ 771 2 => array( 772 'field' => 'contact.account_type', 773 'type' => '=', 774 'value' => 'l' 819 // If not external catalog get only phpgwAccountType = u ou l 820 if (!$external) 821 { 822 $find_restric[0][5] = array( 823 'type' => 'branch', 824 'value' => 'OR', 825 'sub_branch' => array( 826 0 => array( 827 'field' => 'contact.account_type', 828 'type' => '=', 829 'value' => 'u' 830 ), 831 /*1 => array( 832 'field' => 'contact.account_type', 833 'type' => '=', 834 'value' => 'g' 835 ),*/ 836 2 => array( 837 'field' => 'contact.account_type', 838 'type' => '=', 839 'value' => 'l' 840 ) 775 841 ) 776 ) 777 ); 842 ); 843 } 844 778 845 } 779 780 $find_field[0] = array('contact.id_contact','contact.names_ordered','contact.account_type'); 781 846 847 if (!$external) 848 { 849 // Get only this attributes: dn, cn, phpgwAccountType, objectClass, phpgwAccountStatus, phpghAccountVisible 850 // for non-external catalogs, used to restrict the attributes used in filters 851 $find_field[0] = array('contact.id_contact','contact.names_ordered','contact.account_type', 852 'contact.object_class','contact.account_status','contact.account_visible'); 853 } 854 else 855 { 856 // Get only this attributes: dn, cn for external catalogs, 857 // used to restrict the attributes used in filters 858 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 859 } 860 782 861 $find_other[0] = array( 783 862 //'offset' => (($page-1)*$this->page_info['n_cards']), … … 785 864 'order' => 'contact.names_ordered' 786 865 ); 787 866 788 867 break; 789 868 790 869 case 'bo_company_manager': 791 870 $field_name = 'id_company'; 792 871 793 872 $find_field[0] = array('company.id_company','company.company_name'); 794 873 795 874 $find_other[0] = array( 796 875 //'offset' => (($page-1)*$this->page_info['n_cards']), … … 798 877 'order' => 'company.company_name' 799 878 ); 800 879 801 880 $find_restric[0] = array( 802 881 0 => array( … … 806 885 ) 807 886 ); 808 887 809 888 break; 810 889 811 890 case 'bo_group_manager': 812 891 813 892 $field_name = 'id_group'; 814 893 815 894 if ($letter !== 'number') { 816 895 817 896 $find_restric[0] = array( 818 897 0 => array( … … 824 903 } 825 904 else { 826 905 827 906 $find_restric[0] = array( 828 907 0 => array( 829 908 'field' => 'group.title', 830 909 'type' => 'LIKE', 831 'value' => '0%' 910 'value' => '0%' 832 911 ) 833 ); 912 ); 834 913 } 835 914 836 915 array_push($find_restric[0], array( 837 916 'field' => 'group.owner', 838 917 'type' => '=', 839 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 918 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 840 919 ) 841 920 ); 842 843 $find_field[0] = array('group.id_group','group.title','group.short_name'); 921 922 $find_field[0] = array('group.id_group','group.title','group.short_name'); 844 923 $find_other[0] = array( 845 924 'order' => 'group.title' 846 925 ); 847 926 848 927 break; 849 928 850 929 case 'bo_catalog_group_catalog': 851 930 $this->page_info['actual_entries'] = false; 852 931 853 932 $this->page_info['actual_letter'] = $letter; 854 933 $this->page_info['actual_page'] = 0; 855 934 856 935 $this->save_session(); 857 936 $final[0] = 0; 858 937 $final[1] = $this -> typeContact; 859 echo serialize($final); 938 echo serialize($final); 860 939 return; 861 940 862 941 } 863 942 864 943 $result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]); 865 944 $n_entries = count($result); 866 945 867 946 if ($n_entries) 868 947 { … … 878 957 { 879 958 $this->page_info['actual_entries'] = false; 880 959 881 960 $this->page_info['actual_letter'] = $letter; 882 961 $this->page_info['actual_page'] = 0; 883 884 $this->save_session(); 962 963 $this->save_session(); 885 964 $final[0] = 0; 886 965 $final[1] = $this -> typeContact; 887 echo serialize($final); 966 echo serialize($final); 888 967 return; 889 968 } … … 894 973 { 895 974 $this->page_info['actual_entries'][] = $value[$field_name]; 896 } 897 //print_r($this->page_info['actual_entries']);898 899 } 975 } 976 } 977 } 978 //************************************************************************* 900 979 else if ($letter === 'search') 901 980 { 902 if (!$ids and $this->page_info['actual_letter'] !== 'search') 903 { 981 //if (!$ids and $this->page_info['actual_letter'] !== 'search') 982 if (!$ids && !$this->last_search_ids) 983 { 984 error_log('!$ids e $this->page_info[\'actual_letter\'] != search'); 904 985 $this->page_info['actual_entries'] = false; 905 986 906 987 $this->page_info['actual_letter'] = $letter; 907 988 $this->page_info['actual_page'] = 0; 908 989 909 990 $this->save_session(); 910 991 $final[0] = 0; 911 992 $final[1] = $this -> typeContact; 912 echo serialize($final); 993 echo serialize($final); 913 994 return; 914 995 } 915 else if ($ids) 916 { 996 else if ($ids['error']) 997 { 998 $this->page_info['actual_entries'] = false; 999 $this->page_info['actual_letter'] = $letter; 1000 $this->page_info['actual_page'] = 0; 1001 1002 $this->save_session(); 1003 $final[0] = 0; 1004 $final[1] = $this -> typeContact; 1005 $final['error'] = $ids['error']; 1006 echo serialize($final); 1007 return; 1008 } 1009 else if ($ids || $this->last_search_ids) 1010 { 1011 1012 if ($ids) 1013 { 1014 1015 $this->last_search_ids = $ids; 1016 1017 } 1018 else { 1019 1020 $ids = $this->last_search_ids; 1021 1022 } 1023 917 1024 $this->page_info['actual_letter'] = $letter; 918 1025 $this->page_info['actual_entries'] = $ids; … … 931 1038 $page = $this->page_info['n_pages']; 932 1039 } 933 1040 934 1041 $final = array( 935 1042 0 => (int)$this->page_info['n_pages'], … … 943 1050 5 => 'cc_alias', 944 1051 6 => 'cc_id', 945 7 => 'cc_forwarding_address' 1052 7 => 'cc_forwarding_address', 1053 8 => 'cc_empNumber', 1054 9 => 'cc_department' 946 1055 ) 947 1056 ); 948 1057 949 1058 //echo 'Page: '.$page.'<br>'; 950 1059 $id_i = (($page-1)*$this->page_info['n_cards']); 951 1060 $id_f = $id_i + $this->page_info['n_cards']; 952 1061 $n_entries = count($this->page_info['actual_entries']); 953 1062 954 1063 //echo 'ID_I: '.$id_i.'<br>'; 955 1064 //echo 'ID_F: '.$id_f.'<br>'; 956 ///---------------- Corre ção Temporária PHP5 -----------------------///1065 ///---------------- Correᅵᅵo Temporï¿œria PHP5 -----------------------/// 957 1066 $ids = array(); 958 $array_temp = array(); 959 1067 $array_temp = array(); 1068 960 1069 foreach($this->page_info['actual_entries'] as $key=>$tmp){ 961 $array_temp[] = $tmp; 962 } 963 1070 $array_temp[] = $tmp; 1071 } 1072 964 1073 for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 965 1074 { 966 1075 $ids[] = $array_temp[$i]; 967 1076 } 968 1077 969 1078 /// Original 970 1079 //for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) … … 973 1082 //} 974 1083 /// 975 1084 976 1085 $fields = $this->bo->catalog->get_fields(false); 977 1086 … … 985 1094 2 => 'cc_id', 986 1095 3 => 'cc_contacts' 987 ) 988 ); 989 1096 ) 1097 ); 1098 990 1099 $groups =& $this->bo->catalog->get_multiple_entries($ids,$fields); 991 1100 992 1101 $i = 0; 993 1102 // contatos do grupo 994 $boGroups = CreateObject('contactcenter.bo_group'); 1103 $boGroups = CreateObject('contactcenter.bo_group'); 995 1104 $contacts = array(); 996 1105 foreach($groups as $group) { 997 1106 998 1107 $final[3][$i][0] = $group['title'] ? $group['title'] : 'none'; 999 $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none'; 1108 $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none'; 1000 1109 $final[3][$i][2] = $group['id_group'] ? $group['id_group'] : 'none'; 1001 1110 $contacts = $boGroups -> get_contacts_by_group($group['id_group']); 1002 1111 $final[3][$i][3] = $contacts; 1003 $i++; 1112 $i++; 1004 1113 } 1005 1114 1006 1115 $this->page_info['actual_letter'] = $letter; 1007 $this->page_info['actual_page'] = $page; 1008 1009 1116 $this->page_info['actual_page'] = $page; 1117 1118 1010 1119 $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 1011 1120 1012 1121 $final[5] = '<span class="link" onclick="'.$lnk_compose; 1013 $final[10] = 'groups'; 1014 $this->save_session(); 1122 $final[10] = 'groups'; 1123 $this->save_session(); 1015 1124 echo serialize($final); 1016 return; 1017 } 1018 1125 return; 1126 } 1127 1019 1128 $fields['photo'] = true; 1020 1129 $fields['names_ordered'] = true; … … 1023 1132 $fields['companies'] = 'default'; 1024 1133 $fields['connections'] = 'default'; 1134 1135 // ?aqui alterar a chamada desse mï¿œtodo para receber o base dn? 1025 1136 $contacts =& $this->bo->catalog->get_multiple_entries($ids,$fields); 1026 1027 1137 1028 1138 if (!is_array($contacts) or !count($contacts)) 1029 1139 { … … 1033 1143 return; 1034 1144 } 1035 1145 1036 1146 $i = 0; 1037 foreach($contacts as $contact) 1038 { 1039 $final[3][$i][0] = $contact['companies']['company1']['company_name']?$contact['companies']['company1']['company_name']:'none'; 1040 $final[3][$i][1] = $contact['names_ordered'] ? $contact['names_ordered'] : 'none'; 1041 $final[3][$i][2] = $contact['companies']['company1']['title']?$contact['companies']['company1']['title']:'none'; 1042 1043 /* Select the correct Email and Telephone to be shown */ 1044 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 1045 if (!is_array($preferences)) 1046 { 1047 $preferences['personCardEmail'] = 1; 1048 $preferences['personCardPhone'] = 2; 1049 } 1050 if ($contact['connections']) 1051 { 1052 $default_email_found = false; 1053 $default_phone_found = false; 1054 foreach($contact['connections'] as $conn_info) 1147 foreach($contacts as $index => $contact) 1148 { 1149 /* 1150 * TODO: Os timeouts de conexï¿œo foram retirados, ver se serï¿œ necessï¿œrio retornar essa funcionalidade, e, 1151 * neste caso, terminar a implementaᅵᅵo das mensagens de retorno. 1152 */ 1153 if ($index !== 'error'){ 1154 $final[3][$i][0] = $contact['companies']['company1']['company_name']?$contact['companies']['company1']['company_name']:'none'; 1155 $final[3][$i][1] = $contact['names_ordered'] ? $contact['names_ordered'] : 'none'; 1156 $final[3][$i][2] = $contact['companies']['company1']['title']?$contact['companies']['company1']['title']:'none'; 1157 1158 //Para exibir a matricula do empregado 1159 $final[3][$i][8] = $contact['companies']['company1']['empNumber']?$contact['companies']['company1']['empNumber']:'none'; 1160 //Para exibir o setor/lotaᅵᅵo do empregado 1161 $final[3][$i][9] = $contact['companies']['company1']['department']?$contact['companies']['company1']['department']:'none'; 1162 1163 /* Select the correct Email and Telephone to be shown */ 1164 $preferences = ExecMethod('contactcenter.ui_preferences.get_preferences'); 1165 if (!is_array($preferences)) 1055 1166 { 1056 if ($conn_info['id_type'] == $preferences['personCardEmail'] and !$default_email_found) 1167 $preferences['personCardEmail'] = 1; 1168 $preferences['personCardPhone'] = 2; 1169 } 1170 if ($contact['connections']) 1171 { 1172 $default_email_found = false; 1173 $default_phone_found = false; 1174 foreach($contact['connections'] as $conn_info) 1057 1175 { 1058 if ($conn_info[' connection_is_default'])1176 if ($conn_info['id_type'] == $preferences['personCardEmail'] and !$default_email_found) 1059 1177 { 1060 $default_email_found = true; 1178 if ($conn_info['connection_is_default']) 1179 { 1180 $default_email_found = true; 1181 } 1182 $final[3][$i][4] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; 1061 1183 } 1062 $final[3][$i][4] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; 1063 } 1064 else if ($conn_info['id_type'] == $preferences['personCardPhone'] and !$default_phone_found) 1065 { 1066 if ($conn_info['connection_is_default']) 1184 else if ($conn_info['id_type'] == $preferences['personCardPhone'] and !$default_phone_found) 1067 1185 { 1068 $default_phone_found = true; 1186 if ($conn_info['connection_is_default']) 1187 { 1188 $default_phone_found = true; 1189 } 1190 1191 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) { 1192 $conn_info['connection_value'] = "<a title=\"".lang("Call Extension")."\" href=\"#\" onclick=\"connectVoip('".$conn_info['connection_value']."', 'com')\">".$conn_info['connection_value']."</a>"; 1069 1193 } 1070 $final[3][$i][3] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; 1194 1195 $final[3][$i][3] = $conn_info['connection_value'] ? $conn_info['connection_value'] : 'none'; 1196 } 1071 1197 } 1072 1198 } 1199 1200 if (!$final[3][$i][3]) 1201 { 1202 $final[3][$i][3] = 'none'; 1203 } 1204 1205 if (!$final[3][$i][4]) 1206 { 1207 $final[3][$i][4] = 'none'; 1208 } 1209 1210 $final[3][$i][5] = $contact['alias']?$contact['alias']:'none'; 1211 $final[3][$i][6] = $ids[$i]; 1212 1213 // If contact is a public list, then load the forwarding addresses. 1214 if($contact['account_type'][0] == 'l') 1215 $final[3][$i][7] = array(); 1216 1217 $final[4][$i] = $contact['photo'] ? 1 : 0; 1218 $i++; 1219 1073 1220 } 1074 1075 if (!$final[3][$i][3]) 1221 else 1076 1222 { 1077 $final[3][$i][3] = 'none';1223 // coloca mensagem de erro no vetor que retorna para o browser 1078 1224 } 1079 1080 if (!$final[3][$i][4]) 1081 { 1082 $final[3][$i][4] = 'none'; 1083 } 1084 1085 $final[3][$i][5] = $contact['alias']?$contact['alias']:'none'; 1086 $final[3][$i][6] = $ids[$i]; 1087 1088 // If contact is a public list, then load the forwarding addresses. 1089 if($contact['account_type'][0] == 'l') 1090 $final[3][$i][7] = array(); 1091 1092 $final[4][$i] = $contact['photo'] ? 1 : 0; 1093 $i++; 1094 } 1095 $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 1225 } 1226 $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 1096 1227 $final[5] = '<span class="link" onclick="'.$lnk_compose; 1097 1098 1228 1229 1099 1230 $this->page_info['actual_letter'] = $letter; 1100 1231 $this->page_info['actual_page'] = $page; 1101 1102 $this->save_session(); 1232 1233 $this->save_session(); 1234 1103 1235 echo serialize($final); 1104 1236 return; 1105 1237 } 1106 1238 1107 1239 $this->page_info['actual_letter'] = $letter; 1108 1240 $this->page_info['actual_page'] = $page; 1109 1241 1110 1242 $this->save_session(); 1111 1243 1112 1244 $final[0] = 0; 1113 1245 $final[1] = $this -> typeContact; 1114 1246 echo serialize($final); 1115 1247 } 1116 1248 1117 1249 /*! 1118 1250 1119 1251 @function get_group_data 1120 1252 @abstract Returns all the information of a given Group 1121 1253 @author Nilton Emilio Buhrer Neto 1122 1254 1123 1255 @param (integer) $id The id to get information 1124 1125 */ 1256 1257 */ 1126 1258 function get_group_data($id) 1127 1259 { … … 1129 1261 $fields = $this->bo->catalog->get_fields(true); 1130 1262 $data = $this->bo->catalog->get_single_entry($id,$fields); 1131 1132 if($id) { 1263 1264 if($id) { 1133 1265 // get All Contacts by group. 1134 $data['contact_in_list'] = $this->bo->catalog->get_contacts_by_group($id); 1135 } 1136 1266 $data['contact_in_list'] = $this->bo->catalog->get_contacts_by_group($id); 1267 } 1268 1137 1269 $boGroup = CreateObject('contactcenter.bo_group'); 1138 1139 $all_contacts = $boGroup->get_all_contacts(); 1140 1141 $contact_options = ""; 1142 if(count($all_contacts)) { 1143 foreach($all_contacts as $idx => $contact) { 1144 $contact_options .= "<OPTION value='".$contact['id_connection']."'>".$contact['names_ordered']." (".$contact['connection_value'].")</OPTION>"; 1145 } 1146 } 1147 $data['contact_list'] = $contact_options; 1148 $data['result'] = 'ok'; 1149 echo serialize($data); 1150 } 1151 1270 1271 $data['contact_list'] = $boGroup->get_all_contacts(); 1272 1273 $data['result'] = 'ok'; 1274 echo serialize($data); 1275 } 1276 1152 1277 /*! 1153 1278 1154 1279 @function get_full_data 1155 1280 @abstract Returns all the information of a given Entry 1156 1281 @author Raphael Derosso Pereira 1157 1282 1158 1283 @param (integer) $id The id to get information 1159 1284 1160 1285 */ 1161 1286 function get_full_data($id) 1162 1287 { 1163 1288 $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 1164 $this->bo->catalog = CreateObject('contactcenter.bo_people_catalog'); 1289 $this->bo->catalog = CreateObject('contactcenter.bo_people_catalog'); 1165 1290 $fields = $this->bo->catalog->get_fields(true); 1166 1291 $fields['photo'] = false; … … 1195 1320 } 1196 1321 $datecount = 0; 1197 1322 1198 1323 $data['result'] = 'ok'; 1199 1324 $data['cc_full_add_contact_id'] = $id; … … 1237 1362 1238 1363 /* Relations */ 1239 1364 1240 1365 echo serialize($data); 1241 1366 } … … 1274 1399 return; 1275 1400 } 1276 1401 1277 1402 echo 0; 1278 1403 } 1279 1404 1280 1405 /*! 1281 1406 1282 1407 @function quick_add 1283 1408 @abstract Adds a new Contact using the Quick Add interface 1284 1409 @author Raphael Derosso Pereira 1285 1410 1286 1411 @param string $sdata Serialized data 1287 1412 */ 1288 1413 function quick_add($sdata) 1289 1414 { 1290 1415 1291 1416 $sdata = str_replace('\\"', '"', $sdata); 1292 1417 $new_array = unserialize($sdata); 1293 1418 $tdata = array(); 1294 1419 1295 1420 foreach($new_array as $tmp) 1296 1421 $tdata[] = $tmp; 1297 1422 1298 1423 if (!$tdata) 1299 1424 { … … 1302 1427 'status' => 'abort' 1303 1428 )); 1304 1429 1305 1430 return; 1306 1431 } 1307 1308 // verifica se email j áexiste!1432 1433 // verifica se email jï¿œ existe! 1309 1434 $boGroup = CreateObject('contactcenter.bo_group'); 1310 1435 $contact = $boGroup->verify_contact($tdata[4]); 1311 1436 1312 1437 if($contact) 1313 { 1438 { 1314 1439 $str_contact = "\r\n - ".implode("\r\n - ",$contact); 1315 1440 1316 1441 echo serialize(array( 1317 1442 'msg' => lang('Problems on adding your Contact. The email "%1" already exists in: %2',$tdata[4], $str_contact), 1318 1443 'status' => 'alreadyExists' 1319 1444 )); 1320 1321 return; 1445 1446 return; 1322 1447 } 1323 1448 … … 1335 1460 1336 1461 if ($boPeople ->quick_add($data)) 1337 { 1462 { 1338 1463 $this->page_info['changed'] = true; 1339 1464 1340 1465 echo serialize(array( 1341 1466 'msg' => lang('Entry added with success!'), … … 1351 1476 } 1352 1477 1353 $this->save_session(); 1354 1478 $this->save_session(); 1479 1355 1480 } 1356 1481 1357 1482 /*! 1358 1483 1359 1484 @function add_group 1360 1485 @abstract Adds a new Group using the Add Group interface 1361 1486 @author Nilton Emilio Buhrer Neto 1362 1487 1363 1488 @param string $sdata Serialized data 1364 1489 */ … … 1368 1493 $tdata = unserialize($sdata); 1369 1494 $new_tdata = array(); 1370 1495 1371 1496 if (!$tdata) 1372 1497 { … … 1375 1500 'status' => 'abort' 1376 1501 )); 1377 1502 1378 1503 return; 1379 1504 } 1380 1505 1381 1506 foreach($tdata as $tmp) 1382 1507 $new_tdata[] = $tmp; 1383 1384 $data['title'] = $new_tdata[0]; 1508 1509 $data['title'] = $new_tdata[0]; 1385 1510 $data['contact_in_list'] = $new_tdata[1]; 1386 1511 $data['id_group'] = $new_tdata[2]; 1387 1512 1388 1513 $boGroup = CreateObject('contactcenter.bo_group_manager'); 1389 1514 $id = $boGroup -> add_group($data); 1390 1515 1391 1516 if ($id) 1392 1517 { 1393 1518 $this->page_info['changed'] = true; 1394 1519 1395 1520 echo serialize(array( 1396 1521 'msg' => lang('Entry added with success!'), … … 1410 1535 1411 1536 /*! 1412 1537 1413 1538 @function remove_group 1414 1539 @abstract Removes a group if the user has the right to do it 1415 @author Nilton Emilio Buhrer Neto 1540 @author Nilton Emilio Buhrer Neto 1416 1541 @param (integer) $id The id to be removed 1417 1542 1418 1543 */ 1419 1544 function remove_group($id) 1420 { 1421 $soGroup = CreateObject('contactcenter.so_group'); 1545 { 1546 $soGroup = CreateObject('contactcenter.so_group'); 1422 1547 $data = array ('id_group' => $id); 1423 1548 if($soGroup -> delete($data)) { … … 1425 1550 'msg' => lang('Removed Entry ID '.$id.'!'), 1426 1551 'status' => 'ok' 1427 )); 1552 )); 1428 1553 } 1429 1554 else { … … 1434 1559 } 1435 1560 1436 $this->save_session(); 1561 $this->save_session(); 1437 1562 } 1438 1563 1439 1564 1440 1565 function remove_all_entries (){ 1441 1566 1442 1567 $error = false; 1443 1568 $this->all_entries = $this->bo->catalog->get_all_entries_ids(); … … 1447 1572 if(!$result) { 1448 1573 $error = true; 1449 break; 1574 break; 1450 1575 } 1451 1576 } … … 1456 1581 'status' => 'ok' 1457 1582 )); 1458 } 1583 } 1459 1584 else { 1460 1585 echo serialize(array( … … 1468 1593 1469 1594 /*! 1470 1595 1471 1596 @function remove_entry 1472 1597 @abstract Removes an entry if the user has the right to do it 1473 1598 @author Raphael Derosso Pereira 1474 1599 1475 1600 @param (integer) $id The id to be removed 1476 1601 1477 1602 */ 1478 1603 function remove_entry ($id) … … 1483 1608 return; 1484 1609 } 1485 1610 1486 1611 $this->page_info['changed'] = true; 1487 1612 $result = $this->bo->catalog->remove_single_entry($id); 1488 1613 1489 1614 if ($result) 1490 1615 { … … 1493 1618 unset($this->page_info['actual_entries'][$pos]); 1494 1619 } 1495 1620 1496 1621 $temp = false; 1497 1622 reset($this->page_info['actual_entries']); … … 1500 1625 $temp[] = $t; 1501 1626 } 1502 1627 1503 1628 $this->page_info['actual_entries'] = $temp; 1504 1629 … … 1515 1640 )); 1516 1641 } 1517 1642 1518 1643 $this->save_session(); 1519 1644 } 1520 1645 1521 1646 1522 1647 /*! 1523 1648 1524 1649 @function post_full_add 1525 1650 @abstract Saves all the information altered/entered in the Full Add … … 1530 1655 function post_full_add() 1531 1656 { 1532 $data = $_POST['data']; 1533 // Exceptions!!! utf8 special chars. 1534 $data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data); 1535 $data = unserialize(str_replace('\\"', '"', $data)); 1657 $data = unserialize(str_replace('\\"', '"', $_POST['data'])); 1536 1658 $this -> bo -> catalog = CreateObject('contactcenter.bo_people_catalog'); 1659 1660 // echo str_replace('\\"', '"', $_POST['data']); 1537 1661 1538 1662 if (!is_array($data)) … … 1558 1682 'status' => 'fatal' 1559 1683 )); 1560 1684 1561 1685 return; 1562 1686 } … … 1572 1696 $id_photo = '_new_'; 1573 1697 } 1574 1575 /* 1576 * Process Photo, if available 1698 1699 /* 1700 * Process Photo, if available 1577 1701 */ 1578 1702 $sleep_count = 0; … … 1591 1715 } 1592 1716 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n')); 1593 1717 1594 1718 if (isset($this->page_info['photos'][$id_photo])) 1595 1719 { … … 1608 1732 $this->save_session(); 1609 1733 } 1610 1734 1611 1735 /* 1612 1736 * Arrange Date so it gets inserted correctly 1613 1737 */ 1614 1738 1615 1739 $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 1616 1740 1617 1741 $j = 0; 1618 1742 for ($i = 0; $i < 5; $i+=2) … … 1647 1771 continue; 1648 1772 } 1649 1773 1650 1774 switch($field) 1651 1775 { … … 1659 1783 /* Do Nothing. This is just to make sure no invalid field is passed */ 1660 1784 break; 1661 1785 1662 1786 case 'id_status': 1663 1787 case 'id_prefix': … … 1668 1792 } 1669 1793 break; 1670 1794 1671 1795 case 'birthdate_0': 1672 1796 case 'birthdate_1': 1673 1797 case 'birthdate_2': 1674 1798 1675 1799 switch($date[$datecount]['digit']) 1676 1800 { … … 1694 1818 break; 1695 1819 } 1696 1820 1697 1821 if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2])) 1698 1822 { … … 1703 1827 return; 1704 1828 } 1705 1829 1706 1830 $data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1]; 1707 1831 break; … … 1726 1850 { 1727 1851 $index = 'address'.$type; 1728 1852 1729 1853 $id_state = $this->bo->catalog->add_state($state_info); 1730 1854 $data['addresses'][$index]['id_state'] = $id_state; … … 1744 1868 { 1745 1869 $index = 'address'.$type; 1746 1870 1747 1871 $id_city = $this->bo->catalog->add_city($city_info); 1748 1872 $data['addresses'][$index]['id_city'] = $id_city; … … 1785 1909 ); 1786 1910 } 1787 1911 1788 1912 eval($code); 1789 1913 … … 1801 1925 1802 1926 /*! 1803 1927 1804 1928 @function post_photo 1805 1929 @abstract Wrapper to post a photo without reload a page. … … 1811 1935 //print_r($_FILES); 1812 1936 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'y')); 1813 1937 1814 1938 if (!is_array($_FILES) and is_array(!$_FILES['cc_pd_photo'])) 1815 1939 { 1816 1940 $this->page_info['photos'][$id]['status'] = 'no_upload'; 1817 1941 $this->page_info['photos'][$id]['msg'] = lang('No Photos uploaded to Server.'); 1818 1942 1819 1943 $this->save_session(); 1820 1944 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); … … 1826 1950 $this->page_info['photos'][$id]['status'] = 'no_GD_lib'; 1827 1951 $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.'); 1828 1952 1829 1953 $this->save_session(); 1830 1954 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); … … 1852 1976 return; 1853 1977 } 1854 1978 1855 1979 switch($_FILES['cc_pd_photo']['type']) 1856 1980 { … … 1882 2006 1883 2007 default: 1884 2008 1885 2009 $this->page_info['photos'][$id]['status'] = 'invalid_image'; 1886 2010 $this->page_info['photos'][$id]['msg'] = lang('The file must be an JPEG, PNG or GIF Image.'); … … 1895 2019 $this->page_info['photos'][$id]['status'] = 'invalid_file'; 1896 2020 $this->page_info['photos'][$id]['msg'] = lang('Couldn\'t open Image. It may be corrupted or internal library doesn\'t support this format.'); 1897 2021 1898 2022 $this->save_session(); 1899 2023 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 1900 2024 return; 1901 2025 } 1902 2026 1903 2027 $img_size = getimagesize($_FILES['cc_pd_photo']['tmp_name']); 1904 2028 $dst_img = imagecreatetruecolor(60, 80); 1905 2029 1906 2030 if (!imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, 60, 80, $img_size[0], $img_size[1])) 1907 2031 { 1908 2032 $this->page_info['photos'][$id]['status'] = 'invalid_file'; 1909 2033 $this->page_info['photos'][$id]['msg'] = lang('Couldn\'t open Image. It may be corrupted or internal library doesn\'t support this format.'); 1910 2034 1911 2035 $this->save_session(); 1912 2036 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 1913 2037 return; 1914 2038 } 1915 2039 1916 2040 ob_start(); 1917 2041 imagepng($dst_img); … … 1923 2047 1924 2048 $this->save_session(); 1925 2049 1926 2050 $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('ok', 'y')); 1927 2051 … … 1944 2068 $fields = $this->bo->catalog->get_fields(false); 1945 2069 $fields['photo'] = true; 1946 2070 1947 2071 $contact = $this->bo->catalog->get_single_entry($id, $fields); 1948 2072 … … 1953 2077 return; 1954 2078 } 1955 2079 1956 2080 header('Content-type: image/jpeg'); 1957 2081 $photo = imagecreatefromstring ($contact['photo']); … … 1965 2089 return; 1966 2090 } 1967 2091 1968 2092 /*! 1969 2093 1970 2094 @function get_states 1971 2095 @abstract Echos a serialized array containing all the states for the given country … … 1989 2113 return; 1990 2114 } 1991 2115 1992 2116 $result = array( 1993 2117 'msg' => lang('States Successfully retrieved!'), 1994 2118 'status' => 'ok' 1995 2119 ); 1996 2120 1997 2121 foreach ($states as $state_info) 1998 2122 { … … 2033 2157 return; 2034 2158 } 2035 2159 2036 2160 $result = array( 2037 2161 'msg' => lang('Cities Successfully retrieved!'), 2038 2162 'status' => 'ok' 2039 2163 ); 2040 2164 2041 2165 foreach ($cities as $city_info) 2042 2166 { 2043 2167 $result['data'][$city_info['id_city']] = $city_info['name']; 2044 2168 } 2045 2169 2046 2170 echo serialize($result); 2047 2171 } … … 2049 2173 2050 2174 /*! 2051 2175 2052 2176 @function search 2053 2177 @abstract Echos a serialized array containing the IDs 2054 2178 of the entries that matches the search argument 2055 2179 @author Raphael Derosso Pereira 2180 @author Mï¿œrio Cï¿œsar Kolling (external catalogs) 2056 2181 2057 2182 @param string $str_data A serialized array with two informations: … … 2065 2190 { 2066 2191 $data = unserialize($str_data); 2192 // It's an external catalog? 2193 $external = $this->bo->is_external($this->page_info['actual_catalog']); 2067 2194 2068 2195 if (!is_array($data) || !$data['search_for'] || !is_array($data['fields'])) 2069 2196 { 2070 echo serialize(array( 2071 'msg' => lang('Invalid parameters'), 2072 'status' => 'abort' 2073 )); 2074 2075 return; 2197 //echo serialize(array( 2198 // 'msg' => lang('Invalid parameters'), 2199 // 'status' => 'abort' 2200 //)); 2201 2202 return array('error' => lang('Invalid parameters')); 2203 } 2204 2205 /* 2206 * TODO: look into the database to discover the database's encoding and convert the search_for field accordingly 2207 */ 2208 // Support search parameters with accentuation 2209 if ($this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 2210 $this->page_info['actual_catalog']['class'] != 'bo_group_manager') 2211 { 2212 2213 $data['search_for'] = utf8_encode($data['search_for']); 2076 2214 } 2077 2215 … … 2094 2232 if (!is_array($names)) 2095 2233 { 2096 echo serialize(array( 2097 'msg' => lang('Invalid Search Parameter'), 2098 'status' => 'abort' 2099 )); 2100 2101 return; 2102 } 2103 2234 //echo serialize(array( 2235 // 'msg' => lang('Invalid Search Parameter'), 2236 // 'status' => 'abort' 2237 //)); 2238 2239 return array('error' => lang('Invalid Search Parameter')); 2240 } 2241 2242 if (!$external && $this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 2243 $this->page_info['actual_catalog']['class'] != 'bo_group_manager') 2244 { 2245 /* 2246 * Restrict the returned contacts search to objectClass = phpgwAccount, 2247 * must have attibute phpgwAccountStatus, phpgwAccountVisible != -1 and 2248 * objectClass = inetOrgPerson 2249 */ 2250 $rules = array( 2251 0 => array( 2252 'field' => 'contact.object_class', 2253 'type' => '=', 2254 'value' => 'phpgwAccount' 2255 ), 2256 1 => array( 2257 'field' => 'contact.account_status', 2258 'type' => 'iLIKE', 2259 'value' => '%' 2260 ), 2261 2 => array( 2262 'field' => 'contact.account_visible', 2263 'type' => '!=', 2264 'value' => '-1' 2265 ), 2266 3 => array( 2267 'field' => 'contact.object_class', 2268 'type' => '=', 2269 'value' => 'inetOrgPerson' 2270 ) 2271 ); 2272 } 2273 2104 2274 foreach ($names as $name) 2105 2275 { … … 2114 2284 } 2115 2285 } 2116 2117 /* 2118 $catalog = $this->bo->get_branch_by_level($this->bo->catalog_level[0]); 2119 2120 if ($catalog['class'] === 'bo_people_catalog') 2121 { 2122 array_push($rules, array( 2123 'field' => 'contact.id_owner', 2124 'type' => '=', 2125 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 2126 )); 2127 } 2128 */ 2129 2130 $ids = $this->bo->find(array($data['fields']['id'], $data['fields']['search']), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC')); 2286 2287 if ($external || $this->page_info['actual_catalog']['class'] == 'bo_people_catalog' || 2288 $this->page_info['actual_catalog']['class'] == 'bo_group_manager') 2289 { 2290 // Get only this attributes: dn, cn for external catalogs, 2291 // used to restrict the attributes used in filters 2292 $ids = $this->bo->find(array($data['fields']['id'], $data['fields']['search']), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC')); 2293 } 2294 else 2295 { 2296 // Get only this attributes: dn, cn, phpgwAccountType, objectClass, phpgwAccountStatus, phpghAccountVisible 2297 // for non-external catalogs, used to restrict the attributes used in filters 2298 $ids = $this->bo->find(array( 2299 $data['fields']['id'], 2300 $data['fields']['search'], 2301 'contact.object_class', 2302 'contact.account_status', 2303 'contact.account_visible' 2304 ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC')); 2305 } 2131 2306 2132 2307 if (!is_array($ids) || !count($ids)) 2133 2308 { 2134 echo serialize(array( 2135 'msg' => lang('No Entries Found!'), 2136 'status' => 'empty' 2137 )); 2138 2139 return; 2309 //echo serialize(array( 2310 // 'msg' => lang('No Entries Found!'), 2311 // 'status' => 'empty' 2312 //)); 2313 2314 $this->last_search_ids = null; 2315 $this->save_session(); 2316 return null; 2140 2317 } 2141 2318 … … 2145 2322 foreach ($ids as $e_info) 2146 2323 { 2324 //$ids_f[] = "base64::" . base64_encode($e_info[$id_field]); 2147 2325 $ids_f[] = $e_info[$id_field]; 2148 2326 } 2149 2150 echo serialize(array( 2151 'data' => $ids_f, 2152 'msg' => lang('Found %1 Entries', count($ids)), 2153 'status' => 'ok' 2154 )); 2327 2328 //error_log("ids_f serializados: " . serialize($ids_f) . "\n", 3, '/var/www/teste.log'); 2329 2330 //return serialize($ids_f); 2331 return $ids_f; 2332 2333 //echo serialize(array( 2334 // 'data' => $ids_f, 2335 // 'msg' => lang('Found %1 Entries', count($ids)), 2336 // 'status' => 'ok' 2337 //)); 2155 2338 } 2156 2339 … … 2162 2345 @author Raphael Derosso Pereira 2163 2346 2164 @param array str_data A serialized array containing the ID's of the entries 2347 @param array str_data A serialized array containing the ID's of the entries 2165 2348 to be taken, the fields to be taken and the rules to be used on the 2166 2349 retrieval: … … 2175 2358 { 2176 2359 $data = unserialize($str_data); 2177 2360 2178 2361 if (!is_array($data) or !count($data) or !count($data['fields']) or !count($data['ids'])) 2179 2362 { … … 2185 2368 2186 2369 $entries = $this->bo->catalog->get_multiple_entries($data['ids'], $data['fields']); 2187 2370 2188 2371 if (!is_array($entries) or !count($entries)) 2189 2372 { … … 2204 2387 2205 2388 @function get_all_entries 2206 @abstract Returns the specified fields for all catalog's entries 2389 @abstract Returns the specified fields for all catalog's entries 2207 2390 in the default CC UI format 2208 2391 @author Raphael Derosso Pereira 2209 2392 2210 @params array str_data A serialized array containing the fields to 2393 @params array str_data A serialized array containing the fields to 2211 2394 be grabbed, the maximum number of entries to be returned and a 2212 2395 boolean specifying if the calls refers to a new grab or to an … … 2217 2400 { 2218 2401 $data = unserialize($str_data); 2219 2220 if (!is_array($data) or 2221 !count($data) or 2222 !count($data['fields']) or 2402 2403 if (!is_array($data) or 2404 !count($data) or 2405 !count($data['fields']) or 2223 2406 !$data['maxlength'] or 2224 2407 (!$data['new'] and !$data['offset'])) … … 2246 2429 $data['offset'] = 0; 2247 2430 } 2248 2431 2249 2432 if ($data['maxlength'] != -1) 2250 2433 { … … 2257 2440 2258 2441 $prefs = ExecMethod('contactcenter.ui_preferences.get_preferences'); 2259 2442 2260 2443 $jsCode = array(); 2261 2444 $count = 0; … … 2267 2450 } 2268 2451 2269 if($this-> typeContact == 'groups') { 2270 2452 if($this-> typeContact == 'groups') { 2453 2271 2454 foreach ($each as $field => $value) { 2272 2455 2273 2456 if ($field === 'title') { 2274 2457 $optionName = '\\"'.$value.'\\"'; 2275 2458 2276 2459 } 2277 2460 else if ($field === 'short_name') { 2278 2461 2279 2462 $jsCode[] = '_this.entries.options[_this.entries.options.length] = new Option("'.$optionName.' ('.$value.')", "'.$count.'");'; 2280 $count++; 2281 } 2463 $count++; 2464 } 2282 2465 } 2283 2466 } 2284 2285 else { 2467 2468 else { 2286 2469 foreach ($each as $field => $value) { 2287 2470 if ($field === 'names_ordered') { … … 2291 2474 } 2292 2475 else if ($field === 'connections') { 2293 2476 2294 2477 foreach ($value as $connection) { 2295 2478 if ($connection['id_type'] == $prefs['personCardEmail']) { … … 2304 2487 2305 2488 $jsCodeFinal = implode("\n", $jsCode); 2306 2489 2307 2490 $nEntries = count($result); 2308 2491 2309 2492 if (!$nEntries) 2310 2493 { … … 2324 2507 ); 2325 2508 } 2326 2509 2327 2510 /*********************************************************************\ 2328 2511 * Auxiliar Methods * … … 2330 2513 2331 2514 /*! 2332 2515 2333 2516 @function save_session 2334 2517 @abstract Saves the data on the session 2335 2518 @author Raphael Derosso Pereira 2336 2519 2337 2520 */ 2338 2521 function save_session() … … 2340 2523 $GLOBALS['phpgw']->session->appsession('ui_data.page_info','contactcenter',$this->page_info); 2341 2524 $GLOBALS['phpgw']->session->appsession('ui_data.all_entries','contactcenter',$this->all_entries); 2525 $GLOBALS['phpgw']->session->appsession('ui_data.last_search_ids','contactcenter',$this->last_search_ids); 2342 2526 } 2343 2527 2344 2528 /*! 2345 2529 2346 2530 @function convert_tree 2347 2531 @abstract Converts the tree array in the BO format to a JS tree array compatible 2348 2532 with the one available in eGW 2349 2533 @author Raphael Derosso Pereira 2350 2534 2351 2535 @param (array) $tree The tree in the BO format 2352 2536 @param (string) $name The tree name … … 2382 2566 'caption' => $value['name'] 2383 2567 ); 2384 2568 2385 2569 switch($value['type']) 2386 2570 { … … 2405 2589 $this->bo->catalog->src_info = $ldap->srcs[1]; 2406 2590 } 2407 2408 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 2591 2592 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 2409 2593 $dn=$this->bo->catalog->src_info['dn']; 2410 2594 $justThese = array("givenname","givenname","sn","telephonenumber","mail"); 2411 $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 2412 $info = ldap_get_entries($ds, $sr); 2595 $sr = ldap_read($ds,$id, "objectClass=*",$justThese); 2596 $info = ldap_get_entries($ds, $sr); 2413 2597 for($z = 0; $z < 5; $z++) { 2414 $participant = $info[0][$justThese[$z]]; 2598 $participant = $info[0][$justThese[$z]]; 2415 2599 array_push($array_participants, $participant); 2416 2600 } … … 2418 2602 ldap_close($ds); 2419 2603 echo serialize($array_participants); 2420 } 2421 2422 function get_catalog_participants_list($id) 2604 } 2605 2606 function get_catalog_participants_list($id) 2423 2607 { 2424 2425 $fields = $this->bo->catalog->get_fields(false); 2608 2609 $fields = $this->bo->catalog->get_fields(false); 2426 2610 $fields['names_ordered'] = true; 2427 $fields['mail_forwarding_address'] = true; 2428 $contact = $this->bo->catalog->get_single_entry($id,$fields); 2429 2611 $fields['mail_forwarding_address'] = true; 2612 $contact = $this->bo->catalog->get_single_entry($id,$fields); 2613 2430 2614 $array_participants = array(); 2431 2615 $array_emails = array(); 2432 2616 2433 2617 $filter = null; 2434 for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) { 2618 for($z = 0; $z < $contact['mail_forwarding_address']['count']; $z++) { 2435 2619 if(strstr($contact['mail_forwarding_address'][$z],'@')) { 2436 2620 $filter.="(mail=".$contact['mail_forwarding_address'][$z].")"; 2437 2621 $array_emails[$contact['mail_forwarding_address'][$z]] = "<font color=black>".$contact['mail_forwarding_address'][$z]."</font>"; 2438 } 2439 else 2622 } 2623 else 2440 2624 $array_participants[$z] = "<font color=red>".$contact['mail_forwarding_address'][$z]."</font>"; 2441 } 2442 2625 } 2626 2443 2627 if($filter) { 2444 $filter = "(|".$filter.")"; 2628 $filter = "(|".$filter.")"; 2445 2629 if(!$this->bo->catalog->src_info) { 2446 2630 $ldap = CreateObject('contactcenter.bo_ldap_manager'); 2447 2631 $this->bo->catalog->src_info = $ldap->srcs[1]; 2448 2632 } 2449 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 2633 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], true); 2450 2634 $dn=$this->bo->catalog->src_info['dn']; 2451 2635 $justThese = array("cn","mail"); 2452 $sr = ldap_search($ds,$dn, $filter,$justThese); 2453 $info = ldap_get_entries($ds, $sr); 2636 $sr = ldap_search($ds,$dn, $filter,$justThese); 2637 $info = ldap_get_entries($ds, $sr); 2454 2638 for($z = 0; $z < $info['count']; $z++) { 2455 2639 $participant = '<font color=\'DARKBLUE\'> "'.$info[$z]['cn'][0].'" <'.$info[$z]['mail'][0].'></font><br>'; 2456 $array_emails[$info[$z]['mail'][0]] = null; 2457 array_push($array_participants, $participant); 2458 } 2459 2640 $array_emails[$info[$z]['mail'][0]] = null; 2641 array_push($array_participants, $participant); 2642 } 2643 2460 2644 foreach($array_emails as $index => $email) 2461 if($email) 2462 array_push($array_participants, " ".$email."<br>"); 2463 2645 if($email) 2646 array_push($array_participants, " ".$email."<br>"); 2647 2464 2648 ldap_close($ds); 2465 2649 } 2466 2650 sort($array_participants); 2467 $innerHTML = ''; 2651 $innerHTML = ''; 2468 2652 foreach($array_participants as $index => $participant){ 2469 2653 $innerHTML .= $participant; 2470 2654 } 2471 $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 2655 $return = array('size' => count($array_participants), 'names_ordered'=> $contact['names_ordered'], 'inner_html' => $innerHTML); 2472 2656 echo serialize($return); 2473 } 2474 2657 } 2658 2475 2659 function export_contacts($typeExport){ 2476 2660 … … 2483 2667 2484 2668 2485 // Essa itera ção transforma uma esturuta com contatos redundantes e separados por email ou tel.2669 // Essa iteraᅵᅵo transforma uma esturuta com contatos redundantes e separados por email ou tel. 2486 2670 // em outra com apenas 1 elemento pra cada contato 2487 2671 $i=0; … … 2494 2678 $all_contacts[$i]['phone']=$object['connection_value']; 2495 2679 } 2496 2680 2497 2681 switch($typeExport) { 2498 2682 2499 2683 case 'outlook_en': 2500 2684 $streamBuffer = "Name;E-mail Address;Notes;Mobile Phone;Pager;Company;". 2501 "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 2685 "Job Title;Home Phone;Home Fax;Business Phone;Business Fax\r\n"; 2502 2686 foreach($all_contacts as $index => $object){ 2503 2687 $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;\r\n"; 2504 2688 } 2505 2689 break; 2506 2690 2507 2691 case 'outlook_pt-BR': 2508 $streamBuffer = "Nome;End. de email;Endere ço residencial;".2509 "Cidade do endere ço residencial;CEP do endereço residencial;".2510 "Estado;Pa ís/região do endereço residencial;Telefone residencial;".2511 "Rua do endere ço comercial;Cidade do endereço comercial;".2512 "CEP do endere ço comercial;Estado do endereço comercial;".2513 "Pa ís/região do endereço comercial;Telefone comercial;Empresa;Cargo\r\n";2692 $streamBuffer = "Nome;End. de email;Endereï¿œo residencial;". 2693 "Cidade do endereï¿œo residencial;CEP do endereï¿œo residencial;". 2694 "Estado;Paï¿œs/regiï¿œo do endereï¿œo residencial;Telefone residencial;". 2695 "Rua do endereï¿œo comercial;Cidade do endereï¿œo comercial;". 2696 "CEP do endereï¿œo comercial;Estado do endereï¿œo comercial;". 2697 "Paï¿œs/regiï¿œo do endereï¿œo comercial;Telefone comercial;Empresa;Cargo\r\n"; 2514 2698 foreach($all_contacts as $index => $object){ 2515 2699 $streamBuffer.= $object['name'].";".$object['email'].";;;;;;".$object['phone'].";;;;;;;;\r\n"; 2516 2700 } 2517 2701 break; 2518 2702 2519 2703 case 'outlook2000_pt-BR': 2520 2704 $streamBuffer = "\"Tratamento\",\"Nome\",\"Segundo Nome\",\"Sobrenome\",\"Sufixo\",". 2521 "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endere ço comercial\",\"Rua do endereço comercial 2\",".2522 "\"Rua do endere ço comercial 3\",\"Cidade do endereço comercial\",\"Estado do endereço comercial\",".2523 "\"CEP do endere ço comercial\",\"País do endereço comercial\",\"Endereço residencial\",\"Rua residencial 2\",".2524 "\"Rua residencial 3\",\"Cidade do endere ço residencial\",\"Estado\",\"CEP do endereço residencial\",\"País do endereço residencial\",".2525 "\"Outro endere ço\",\"Outro endereço 2\",\"Outro endereço 3\",\"Cidade\",\"Estado\",\"CEP\",\"País\",".2705 "\"Empresa\",\"Departamento\",\"Cargo\",\"Rua do endereï¿œo comercial\",\"Rua do endereï¿œo comercial 2\",". 2706 "\"Rua do endereï¿œo comercial 3\",\"Cidade do endereï¿œo comercial\",\"Estado do endereï¿œo comercial\",". 2707 "\"CEP do endereï¿œo comercial\",\"Paï¿œs do endereï¿œo comercial\",\"Endereï¿œo residencial\",\"Rua residencial 2\",". 2708 "\"Rua residencial 3\",\"Cidade do endereï¿œo residencial\",\"Estado\",\"CEP do endereï¿œo residencial\",\"Paï¿œs do endereï¿œo residencial\",". 2709 "\"Outro endereï¿œo\",\"Outro endereï¿œo 2\",\"Outro endereï¿œo 3\",\"Cidade\",\"Estado\",\"CEP\",\"Paï¿œs\",". 2526 2710 "\"Telefone do assistente\",\"Fax comercial\",\"Telefone comercial\",\"Telefone comercial 2\",\"Retorno de chamada\",". 2527 2711 "\"Telefone do carro\",\"Telefone principal da empresa\",\"Fax residencial\",\"Telefone residencial\",". 2528 2712 "\"Telefone residencial 2\",\"ISDN\",\"Telefone celular\",\"Outro fax\",\"Outro telefone\",\"Pager\",\"Telefone principal\",". 2529 "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Anivers ário\",\"Anotações\",\"Caixa postal\",\"Categorias\",".2530 "\"C ódigo da empresa\",\"Código do governo\",\"Cônjuge\",\"Conta\",\"Endereço de correio eletrônico\",".2531 "\"Nome de exibi ção do correio eletr.\",\"Endereço de correio eletrônico 2\",".2532 "\"Nome de exibi ção do correio eletr.2\",\"Endereço de correio eletrônico 3\",".2533 "\"Nome de exibi ção do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",".2534 "\"Filhos\",\"Hobby\",\"Idioma\",\"Indica ção\",\"Informações para cobrança\",\"Iniciais\",\"Local\",".2535 "\"Nome do assistente\",\"Nome do gerenciador\",\"P ágina da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",".2536 "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profiss ão\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretório\",".2713 "\"Radiofone\",\"Telefone TTY/TDD\",\"Telex\",\"Aniversï¿œrio\",\"Anotaᅵᅵes\",\"Caixa postal\",\"Categorias\",". 2714 "\"Cï¿œdigo da empresa\",\"Cï¿œdigo do governo\",\"Cï¿œnjuge\",\"Conta\",\"Endereï¿œo de correio eletrï¿œnico\",". 2715 "\"Nome de exibiᅵᅵo do correio eletr.\",\"Endereï¿œo de correio eletrï¿œnico 2\",". 2716 "\"Nome de exibiᅵᅵo do correio eletr.2\",\"Endereï¿œo de correio eletrï¿œnico 3\",". 2717 "\"Nome de exibiᅵᅵo do correio eletr.3\",\"Datas especiais\",\"Disponibilidade da Internet\",". 2718 "\"Filhos\",\"Hobby\",\"Idioma\",\"Indicaᅵᅵo\",\"Informaᅵᅵes para cobranï¿œa\",\"Iniciais\",\"Local\",". 2719 "\"Nome do assistente\",\"Nome do gerenciador\",\"Pï¿œgina da Web\",\"Palavras-chave\",\"Particular\",\"Personalizado 1\",\"Personalizado 2\",". 2720 "\"Personalizado 3\",\"Personalizado 4\",\"Prioridade\",\"Profissï¿œo\",\"Quilometragem\",\"Sala\",\"Sensibilidade\",\"Servidor de diretï¿œrio\",". 2537 2721 "\"Sexo\"\r\n"; 2538 2722 foreach($all_contacts as $index => $object){ … … 2540 2724 } 2541 2725 break; 2542 2726 2543 2727 case 'outlook2000_en': 2544 2728 $streamBuffer = "Title,First Name,Middle Name,Last Name,Suffix,Company,Department,Job Title,". … … 2556 2740 } 2557 2741 break; 2558 2742 2559 2743 case 'thunderbird': 2560 $streamBuffer = "\n"; 2744 $streamBuffer = "\n"; 2561 2745 foreach($all_contacts as $index => $object){ 2562 2746 $streamBuffer.= ",,".$object['name'].",,".$object['email'].",,".$object['phone'].",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"; 2563 2747 } 2564 2748 break; 2565 2566 case 'expresso':2749 2750 default: 2567 2751 $streamBuffer = "Nome,Email,Telefone\r\n"; 2568 2752 foreach($all_contacts as $index => $object){ … … 2570 2754 } 2571 2755 break; 2572 2756 2573 2757 } 2574 2758 … … 2578 2762 if(!$f) 2579 2763 echo null; 2580 2764 2581 2765 fputs($f,$streamBuffer); 2582 2766 fclose($f); … … 2585 2769 } 2586 2770 2587 // Get the csv field and put into array, from php.net2588 function parse_line($input_text, $delimiter = ',', $text_qualifier = '"') {2589 $text = trim($input_text);2590 if(is_string($delimiter) && is_string($text_qualifier)) {2591 $re_d = '\x' . dechex(ord($delimiter)); //format for regexp2592 $re_tq = '\x' . dechex(ord($text_qualifier)); //format for regexp2593 2594 $fields = array();2595 $field_num = 0;2596 while(strlen($text) > 0) {2597 if($text{0} == $text_qualifier) {2598 preg_match('/^' . $re_tq . '((?:[^' . $re_tq . ']|(?<=\x5c)' . $re_tq . ')*)' . $re_tq . $re_d . '?(.*)$/', $text, $matches);2599 2600 $value = str_replace('\\' . $text_qualifier, $text_qualifier, $matches[1]);2601 $text = trim($matches[2]);2602 2603 $fields[$field_num++] = $value;2604 } else {2605 preg_match('/^([^' . $re_d . ']*)' . $re_d . '?(.*)$/', $text, $matches);2606 2607 $value = $matches[1];2608 $text = trim($matches[2]);2609 2610 $fields[$field_num++] = $value;2611 }2612 }2613 return $fields;2614 } else2615 return false;2616 }2617 2771 2618 2772 function import_contacts($typeImport){ 2619 2773 2620 if($file = $_SESSION['contactcenter']['importCSV']) { 2621 unset($_SESSION['contactcenter']['importCSV']); 2774 $delim = ($typeImport == 'outlook' ? ';' : ','); 2775 2776 if($file = $_SESSION['contactcenter']['importCSV']) { 2777 unset($_SESSION['contactcenter']['importCSV']); 2622 2778 $len = filesize($file); 2623 2779 $count = 0; 2624 2780 $return = array('error' => false, '_new' => 0, '_existing' => 0, '_failure' => 0); 2625 2781 $handle = @fopen($file, "r") or die(serialize($return['error'] = true)); 2626 2627 $input_header = fgets($handle);2628 if ($typeImport == 'outlook')2629 $delim = ';';2630 else if ($typeImport == 'auto')2631 $delim = strstr($input_header,',') ? ',' : ';';2632 else2633 $delim = ',';2634 $csv_header = $this->parse_line($input_header,$delim);2635 $firstContact = fgets($handle);2636 preg_match("/\"(.+)\"[,;]/sU",$firstContact,$matches); // yahoo csv2637 rewind($handle);2638 2639 2782 $header = @fgetcsv($handle, $len, $delim) or die(serialize($return['error'] = true)); 2640 2783 if(count($header) < 2 || count($header) > 100) { … … 2644 2787 return; 2645 2788 } 2646 2647 if ($matches[0][strlen($matches[0])-1] == ';') 2648 $delim = ';'; 2649 2650 $boGroup = CreateObject('contactcenter.bo_group'); 2651 $boPeople = CreateObject('contactcenter.bo_people_catalog'); 2789 2790 $boGroup = CreateObject('contactcenter.bo_group'); 2791 $boPeople = CreateObject('contactcenter.bo_people_catalog'); 2792 2652 2793 switch($typeImport){ 2653 2794 case 'outlook2000': … … 2666 2807 $phone_pos=7; 2667 2808 break; 2668 case 'expresso':2809 default: 2669 2810 $name_pos=0; 2670 2811 $email_pos=1; 2671 2812 $phone_pos=2; 2672 break; 2673 default: 2674 foreach($csv_header as $index => $fieldName) 2675 { 2676 switch($fieldName){ 2677 case 'Name': 2678 case 'Nome': 2679 case 'First Name': 2680 $name_pos = $index; 2681 break; 2682 case 'E-mail': 2683 case 'Email': 2684 case 'E-mail Address': 2685 case 'Endereço de correio eletrônico': 2686 case 'End. de email': 2687 $email_pos = $index; 2688 break; 2689 case 'Home Phone': 2690 case 'Phone': 2691 case 'Telefone': 2692 case 'Telefone principal': 2693 case 'Telefone comercial': 2694 $phone_pos = $index; 2695 break; 2696 } 2697 } 2698 break; 2699 } 2700 2813 } 2701 2814 2702 2815 while (($data = fgetcsv($handle, $len, $delim))) { 2816 2703 2817 foreach ($header as $key=>$heading) 2704 2818 $row[$heading]=(isset($data[$key])) ? $data[$key] : ''; 2705 2819 2706 2820 $sdata = array(); 2707 2821 $full_name = trim($row[$header[$name_pos]]); … … 2717 2831 $sdata['connections']['default_phone']['connection_name'] = lang('Main'); 2718 2832 $sdata['connections']['default_phone']['connection_value'] = $phone; 2719 2720 // verifica se email j áexiste!2833 2834 // verifica se email jï¿œ existe! 2721 2835 $contact = $boGroup->verify_contact($email); 2722 2836 2723 $line_iteration = $return['_failure'] + $return['_existing'] + $return['_new'];2724 2837 if($contact){ 2725 2838 $return['_existing']++; 2726 } 2839 } 2727 2840 else if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 2728 2841 $return['_failure']++; 2729 $return['_failure_status'] .= "Line: " . ($line_iteration + 2) . ", Invalid E-Mail address: " . $email ."<br>";2730 2842 } 2731 else if (!$sdata['given_names'] || !$email || !$boPeople ->quick_add($sdata)){ 2732 $return['_failure']++; 2733 $return['_failure_status'] .= "Line: " . ($line_iteration + 2) . ", Invalid Name: " . $sdata['given_names'] ."<br>"; 2843 else if (!$sdata['given_names'] || !$email || !$boPeople ->quick_add($sdata)){ 2844 $return['_failure']++; 2734 2845 } 2735 2846 else 2736 2847 $return['_new']++; 2737 } 2848 } 2738 2849 fclose($handle); 2739 2850 unlink($file); … … 2749 2860 $new = null; 2750 2861 $code = null; 2751 2862 2752 2863 if ($parent === '0') 2753 2864 { … … 2755 2866 $code .= $name.".add(new dNode({id:'0', caption: '".lang('Catalogues')."'}),'none');\n"; 2756 2867 } 2757 2868 2758 2869 foreach ($tree as $id => $value) 2759 2870 { … … 2761 2872 2762 2873 switch ($value['type']) 2763 { 2874 { 2764 2875 case 'unknown': 2765 $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"; 2876 $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"; 2766 2877 break; 2767 2878 2768 2879 case 'catalog_group': 2769 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}'}),'$parent');\n"; 2880 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}'}),'$parent');\n"; 2770 2881 $code .= $this->convert_tree($value['sub_branch'],$name,$iconDir,$parent.'.'.$id); 2771 2882 break; … … 2776 2887 $code .= $this->convert_tree($value['sub_branch'],$name,$iconDir,$parent.'.'.$id); 2777 2888 break; 2778 2889 2779 2890 case 'catalog': 2780 2891 $code .= $name.".add(new dNode({id: '{$parent}.{$id}', caption: '{$value['name']}', onClick: 'setCatalog(\\'{$parent}.{$id}\\')'}),'$parent');\n"; 2781 2782 } 2783 } 2784 2892 2893 } 2894 } 2895 2785 2896 return $code; 2786 2897 } -
trunk/contactcenter/index.php
r2 r284 22 22 ); 23 23 include('../header.inc.php'); 24 $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['telephone_number'] = $GLOBALS['phpgw_info']['user']['telephonenumber']; 25 $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['voip_enabled'] = true; 24 26 25 27 $obj = CreateObject('contactcenter.ui_data'); 26 28 $obj->index(); 29 27 30 28 31 $GLOBALS['phpgw']->common->phpgw_footer(); -
trunk/contactcenter/js/cc.js
r258 r284 57 57 var CC_full_add_const = false; 58 58 var CC_full_add_photo = false; 59 59 60 60 var CC_last_height = window.innerHeight; 61 61 var CC_last_width = window.innerWidth; … … 90 90 photo_input = photo_frame.contentDocument.createElement('input'); 91 91 } 92 92 93 93 photo_frame.id = 'cc_photo_frame'; 94 94 photo_frame.style.position = 'absolute'; … … 96 96 photo_frame.style.top = '600px'; 97 97 photo_frame.style.left = '0px'; 98 98 99 99 photo_form.id = 'cc_photo_form'; 100 100 photo_form.method = 'POST'; 101 101 photo_form.enctype = 'multipart/form-data'; 102 102 103 103 photo_input.id = 'cc_photo_input'; 104 104 photo_input.type = 'file'; 105 105 106 106 if (is_ie) 107 107 { … … 113 113 } 114 114 photo_form.appendChild(photo_input); 115 115 116 116 } 117 117 … … 121 121 var obj = Element(id); 122 122 var max = obj.options.length; 123 123 124 124 if (option == undefined) 125 125 { … … 161 161 function openFullAdd(){ 162 162 // Build the FullAdd Window. 163 if(!fullAddWin && !is_ie) 163 if(!fullAddWin && !is_ie) 164 164 __f(); 165 165 … … 168 168 fullAddWin.open(); 169 169 tabs._showTab('cc_contact_tab_0'); 170 Element("cc_conn_type_1").checked = false; 170 Element("cc_conn_type_1").checked = false; 171 171 Element("cc_conn_type_2").checked = false; 172 172 Element("cc_conn_type_sel").disabled = true; … … 189 189 function editGroup(id){ 190 190 populateEditGroup(id); 191 ccAddGroup.window.open(); 191 ccAddGroup.window.open(); 192 192 } 193 193 /* … … 199 199 { 200 200 CC_full_add_const = false; 201 201 202 202 setTimeout('populateFullAddConstAsync()', 10); 203 203 } … … 207 207 var handler = function(responseText) 208 208 { 209 //Element('cc_debug').innerHTML = responseText; 209 //Element('cc_debug').innerHTML = responseText; 210 210 var data = unserialize(responseText); 211 211 var i = 1; 212 212 var j; 213 213 214 214 if (typeof(data) != 'object') 215 215 { … … 217 217 return; 218 218 } 219 219 220 220 /* Populate Prefixes */ 221 221 for (j in data[0]) … … 224 224 i++; 225 225 } 226 226 227 227 /* Populate Suffixes */ 228 228 i = 1; … … 246 246 { 247 247 Element('cc_addr_countries').options[i] = new Option(data[3][j], j); 248 248 249 249 if (j == 'BR' || j == 'br') 250 250 { 251 251 CC_br_index = i; 252 252 } 253 253 254 254 i++; 255 255 } 256 256 257 257 /* Populate Connection Types */ 258 258 i = 1; … … 262 262 i++; 263 263 } 264 264 265 265 /* Populate Relations Types */ 266 266 i = 0; … … 270 270 i++; 271 271 } 272 272 273 273 CC_full_add_const = true; 274 274 … … 305 305 { 306 306 var handler = function(responseText) 307 { 308 var data = unserialize(responseText); 309 Element('group_id').value = data['id_group']; 310 var options_contact_list = Element('contact_list'); 311 if(data['contact_list']) { 312 options_contact_list.innerHTML = data['contact_list']; 307 { 308 var data = unserialize(responseText); 309 Element('group_id').value = data['id_group']; 310 311 if(data['contact_list']) { 312 for(i = 0; i < data['contact_list'].length; i++) { 313 option = document.createElement('option'); 314 option.value = data['contact_list'][i]['id_connection']; 315 option.text = data['contact_list'][i]['names_ordered']+' ('+data['contact_list'][i]['connection_value']+')'; 316 Element('contact_list').options[Element('contact_list').options.length] = option; 317 } 313 318 } 314 319 315 320 if(data['id_group']) { 316 317 if(data['contact_in_list']) { 318 for(i = 0; i < data['contact_in_list'].length; i++) { 321 322 if(data['contact_in_list']) { 323 for(i = 0; i < data['contact_in_list'].length; i++) { 319 324 option = document.createElement('option'); 320 325 option.value = data['contact_in_list'][i]['id_connection']; 321 option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')'; 326 option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')'; 322 327 Element('contact_in_list').options[Element('contact_in_list').options.length] = option; 323 328 } 324 } 325 329 } 330 326 331 Element('title').value = data['title']; 327 332 } 328 333 329 334 if (typeof(data) != 'object' || data['result'] != 'ok') 330 335 { … … 333 338 } 334 339 }; 335 340 336 341 id = typeof(id) == 'undefined' ? id = 0 : id; 337 338 ccAddGroup.clear(true); 342 343 ccAddGroup.clear(true); 339 344 Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); 340 345 } … … 371 376 return false; 372 377 } 373 378 374 379 /* First thing: Send Photo */ 375 380 if (Element('cc_pd_select_photo').value != '' && !is_ie) … … 389 394 frame = old_frame; 390 395 } 391 396 392 397 frame.id = 'cc_photo_frame'; 393 398 frame.style.visibility = 'hidden'; … … 398 403 399 404 form = frame.contentDocument.createElement('form'); 400 405 401 406 var id_contact = Element('cc_full_add_contact_id').value; 402 407 form.id = 'cc_form_photo'; … … 404 409 form.enctype = 'multipart/form-data'; 405 410 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 : ''); 406 411 407 412 var input_clone = Element('cc_pd_select_photo').cloneNode(false); 408 413 form.appendChild(input_clone); 409 414 410 415 frame.contentDocument.body.appendChild(form); 411 416 form.submit(); … … 461 466 var empty = true; 462 467 var replacer = '__##AND##__'; 463 468 464 469 data['commercialAnd'] = replacer; 465 470 466 471 if (Element('cc_full_add_contact_id').value != '' && Element('cc_full_add_contact_id').value != 'null') 467 472 { … … 472 477 /* Status: Full Added */ 473 478 data['id_status'] = CC_STATUS_FULL_ADD; 474 479 475 480 /* Personal Data */ 476 481 data['alias'] = replaceComAnd(Element('cc_pd_alias').value, replacer); … … 510 515 data['connections'] = new Array(); 511 516 } 512 517 513 518 for (var i in CC_contact_full_info['connections'][type]) 514 519 { … … 522 527 data['connections']['connection'+connNumber] = new Array(5); 523 528 } 524 529 525 530 data['connections']['connection'+connNumber]['id_connection'] = CC_contact_full_info['connections'][type][i]['id']; 526 531 data['connections']['connection'+connNumber]['id_typeof_connection'] = type; … … 531 536 data['connections']['connection'+connNumber]['connection_is_default'] = 'TRUE'; 532 537 } 533 else 538 else 534 539 data['connections']['connection'+connNumber]['connection_is_default'] = 'FALSE'; 535 540 } 536 541 537 542 // data['connections']['connection'+connNumber].length = 5; 538 543 539 544 empty = false; 540 545 connNumber++; … … 543 548 544 549 } 545 550 546 551 if (!empty) 547 552 { … … 550 555 } 551 556 } 552 557 553 558 if (CC_contact_full_info['removed_conns']) 554 559 { 555 560 empty = false; 556 561 557 562 if (typeof(data['connections']) != 'object') 558 563 { … … 589 594 for (var i in CC_contact_full_info['connections'][type]){ 590 595 if((CC_contact_full_info['connections'][type][i]['value'].length < 4) || 591 (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 592 showMessage('Endere ço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido');596 (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ 597 showMessage('Endereï¿œo para conexï¿œo de ' + CC_contact_full_info['connections'][type][i]['name'] + ', nï¿œo ï¿œ vï¿œlido'); 593 598 return false; 594 599 } … … 596 601 var _options_default = Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default"); 597 602 if(_options_default.value == '-1') { 598 alert(" É necessário escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrão!");603 alert("ï¿œ necessï¿œrio escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrï¿œo!"); 599 604 return false; 600 605 } 601 606 } 602 607 603 608 } 604 609 … … 609 614 610 615 /********* Personal Data Functions *********/ 611 /* 616 /* 612 617 * data[0] => cc_pd_select_photo 613 618 * data[1] => cc_pd_alias … … 657 662 { 658 663 Element('cc_addr_types').selectedIndex = 0; 659 664 660 665 Element('cc_addr_countries').selectedIndex = 0; 661 666 Element('cc_addr_countries').disabled = true; 662 667 663 668 Element('cc_addr_states').selectedIndex = 0; 664 669 Element('cc_addr_states').disabled = true; … … 711 716 var type = Element('cc_addr_types'); 712 717 var oldSelected = type.value; 713 718 714 719 saveAddressFields(); 715 720 716 721 if (oldSelected == '_NONE_') 717 722 { … … 719 724 return true; 720 725 } 721 726 722 727 CC_addr_last_selected = type.selectedIndex; 723 728 724 729 Element('cc_addr_countries').disabled = false; 725 730 726 731 var data = CC_contact_full_info['addresses']; 727 732 var addrIndex = 'address'+Element('cc_addr_types').value; 728 729 if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') 733 734 if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') 730 735 { 731 736 resetAddressFields(); … … 736 741 return true; 737 742 } 738 743 739 744 var addrTypeID = Element('cc_addr_types').value; 740 745 741 746 data = CC_contact_full_info['addresses'][addrIndex]; 742 747 743 748 Element('cc_addr_id').value = data['id_address'] ? data['id_address'] : ''; 744 749 Element('cc_addr_1').value = data['address1'] ? data['address1'] : ''; … … 762 767 states.selectedIndex = 0; 763 768 clearSelectBox(states, 4); 764 updateAddrCities(); 769 updateAddrCities(); 765 770 return; 766 771 } … … 777 782 { 778 783 var data = unserialize(responseText); 779 784 780 785 clearSelectBox(states, 1); 781 786 782 787 if (typeof(data) != 'object') 783 788 { 784 789 showMessage(Element('cc_msg_err_contacting_server').value); 785 790 786 791 return; 787 792 } … … 790 795 { 791 796 states.disabled = true; 792 cities.disabled = true; 797 cities.disabled = true; 793 798 states.selectedIndex = 0; 794 799 cities.selectedIndex = 0; … … 830 835 } 831 836 }; 832 837 833 838 Connector.newRequest('populateStates', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_states&country='+Element('cc_addr_countries').value, 'GET', handler); 834 839 } … … 858 863 newState.disabled = false; 859 864 updateAddrNewStateOnMouseOut(); 860 865 861 866 cities.disabled = false; 862 867 clearSelectBox(cities, 3); … … 869 874 case '_NOSTATE_': 870 875 clearSelectBox(cities, 3); 871 876 872 877 cities.disabled = false; 873 878 cities.selectedIndex = 0; 874 879 875 880 requestStr = 'country='+Element('cc_addr_countries').value; 876 881 break; 877 882 878 883 default: 879 884 requestStr = 'country='+Element('cc_addr_countries').value+'&state='+states.value; … … 890 895 { 891 896 var cities = Element('cc_addr_cities'); 892 897 893 898 var handler = function (responseText) 894 899 { 895 900 var data = unserialize(responseText); 896 901 897 902 clearSelectBox(cities, 1); 898 903 899 904 if (typeof(data) != 'object') 900 905 { 901 906 showMessage(Element('cc_msg_err_contacting_server').value); 902 907 903 908 return; 904 909 } … … 945 950 } 946 951 }; 947 952 948 953 Connector.newRequest('populateCities', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cities&'+requestStr, 'GET', handler); 949 954 } … … 951 956 function updateAddrNewStateOnMouseOver () 952 957 { 953 if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) 958 if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) 954 959 { 955 960 Element('cc_addr_states_new').value = ''; … … 959 964 function updateAddrNewStateOnMouseOut () 960 965 { 961 if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) 966 if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) 962 967 { 963 968 Element('cc_addr_states_new').value = Element('cc_msg_type_state').value; … … 979 984 return; 980 985 } 981 986 982 987 Element('cc_addr_1').readonly = false; 983 988 Element('cc_addr_1').disabled = false; … … 1009 1014 1010 1015 //resetAddrFillingFields(); 1011 1016 1012 1017 return; 1013 1018 … … 1017 1022 newCity.disabled = false; 1018 1023 updateAddrNewCityOnMouseOut(); 1019 1024 1020 1025 break; 1021 1026 … … 1031 1036 function updateAddrNewCityOnMouseOver () 1032 1037 { 1033 if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) 1038 if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) 1034 1039 { 1035 1040 Element('cc_addr_cities_new').value = ''; … … 1039 1044 function updateAddrNewCityOnMouseOut () 1040 1045 { 1041 if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) 1046 if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) 1042 1047 { 1043 1048 Element('cc_addr_cities_new').value = Element('cc_msg_type_city').value; … … 1053 1058 return true; 1054 1059 } 1055 1056 var addrFields = new Array('cc_addr_1', 1057 'cc_addr_2', 1058 'cc_addr_complement', 1060 1061 var addrFields = new Array('cc_addr_1', 1062 'cc_addr_2', 1063 'cc_addr_complement', 1059 1064 'cc_addr_other', 1060 'cc_addr_postal_code', 1065 'cc_addr_postal_code', 1061 1066 'cc_addr_po_box', 1062 1067 'cc_addr_countries', … … 1065 1070 1066 1071 var empty = true; 1067 1072 1068 1073 for (var i = 0; i < 8; i++) 1069 1074 { … … 1074 1079 } 1075 1080 } 1076 1081 1077 1082 if (empty) 1078 1083 { … … 1103 1108 default: 1104 1109 addrInfo['id_country'] = Element('cc_addr_countries').value; 1105 1110 1106 1111 } 1107 1112 … … 1117 1122 default: 1118 1123 addrInfo['id_state'] = Element('cc_addr_states').value; 1119 1124 1120 1125 } 1121 1126 … … 1130 1135 default: 1131 1136 addrInfo['id_city'] = Element('cc_addr_cities').value; 1132 1133 } 1137 1138 } 1134 1139 1135 1140 addrInfo['id_typeof_address'] = Element('cc_addr_types').options[lastIndex].value; … … 1144 1149 CC_contact_full_info['addresses']['address'+Element('cc_addr_types').options[lastIndex].value] = addrInfo; 1145 1150 1146 if (Element('cc_addr_cities').value == '_NEW_' && 1151 if (Element('cc_addr_cities').value == '_NEW_' && 1147 1152 Element('cc_msg_type_city').value != Element('cc_addr_cities_new').value && 1148 1153 Element('cc_addr_cities_new').value != '') 1149 1154 { 1150 1155 var addrRootInfo = CC_contact_full_info['addresses']['new_cities']; 1151 1156 1152 1157 if (!addrRootInfo) 1153 1158 { 1154 1159 addrRootInfo = new Array(); 1155 1160 } 1156 1161 1157 1162 var i = addrRootInfo.length; 1158 1163 addrRootInfo[addrInfo['id_typeof_address']] = new Array(); … … 1163 1168 } 1164 1169 1165 if (Element('cc_addr_states').value == '_NEW_' && 1166 Element('cc_msg_type_state').value != Element('cc_addr_states_new').value && 1170 if (Element('cc_addr_states').value == '_NEW_' && 1171 Element('cc_msg_type_state').value != Element('cc_addr_states_new').value && 1167 1172 Element('cc_addr_states_new').value != '') 1168 1173 { 1169 1174 var addrRootInfo = CC_contact_full_info['addresses']['new_states']; 1170 1175 1171 1176 if (!addrRootInfo) 1172 1177 { 1173 1178 addrRootInfo = new Array(); 1174 1179 } 1175 1180 1176 1181 var i = addrRootInfo.length; 1177 1182 addrRootInfo[addrInfo['id_typeof_address']] = new Array(); … … 1203 1208 for(idx_conn; idx_conn < cc_conn_default.options.length; idx_conn++) 1204 1209 if(cc_conn_default.options[idx_conn].value == _label) 1205 break; 1206 1210 break; 1211 1207 1212 if(idx_conn == cc_conn_default.options.length) 1208 1213 cc_conn_default.options[idx_conn] = new Option (_label,_label, false,false); 1209 1214 1210 1215 if (!document.all) 1211 1216 { 1212 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>'+ 1213 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 1214 '<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>' + 1215 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" type="text"> ' + 1216 '<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>'; 1217 if (Element("cc_conn_type_1").checked) 1218 { 1219 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>'+ 1220 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 1221 '<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>' + 1222 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="100" type="text"> ' + 1223 '<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>'; 1224 } 1225 else if (Element("cc_conn_type_2").checked) 1226 { 1227 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>'+ 1228 //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ 1229 '<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>' + 1230 '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="50" type="text"> ' + 1231 '<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>'; 1232 } 1217 1233 } 1218 1234 else … … 1238 1254 img.align = 'top'; 1239 1255 img.onclick = function(e){ removeConnField(remove_id);}; 1240 1256 1241 1257 for (var i = 0; i < 3; i++) 1242 1258 { … … 1249 1265 1250 1266 inputs[1].id = 'cc_conn_name_'+CC_conn_count; 1251 inputs[1].type = 'hidden'; 1267 inputs[1].type = 'hidden'; 1252 1268 1253 1269 inputs[2].id = 'cc_conn_value_'+CC_conn_count; … … 1278 1294 || typeof(CC_contact_full_info['connections'][CC_conn_last_selected]) == 'undefined' 1279 1295 || typeof(CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]) == 'undefined'); 1280 1281 if(_emptyLine) { 1282 1296 1297 if(_emptyLine) { 1298 1283 1299 if(Element("cc_conn_type_sel").value == '-1'){ 1284 return false; 1285 } 1286 1300 return false; 1301 } 1302 1287 1303 for(k = 0; k < CC_conn_count; k++) { 1288 1304 if(Element("cc_conn_name_"+k) && Element("cc_conn_name_"+k).value != "" && Element("cc_conn_name_"+k).value == Element("cc_conn_type_sel").value) { 1289 alert('Voc ê jápossui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!');1290 Element("cc_conn_type_sel").options.selectedIndex = 0; 1305 alert('Vocï¿œ jï¿œ possui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!'); 1306 Element("cc_conn_type_sel").options.selectedIndex = 0; 1291 1307 return false; 1292 1308 } 1293 1309 } 1294 } 1310 } 1295 1311 if (!document.all) 1296 1312 { … … 1319 1335 1320 1336 function connRemoveLine(id) 1321 { 1337 { 1322 1338 var p = Element(id).parentNode; 1323 1339 var cc_conn_default = Element("cc_phone_default").style.display == '' ? Element("cc_phone_default") : Element("cc_email_default"); … … 1358 1374 } 1359 1375 } 1360 1376 1361 1377 CC_conn_count = 0; 1362 1378 } … … 1380 1396 function updateConnFields() 1381 1397 { 1382 1398 1383 1399 var connID; 1384 1400 var i; … … 1389 1405 var cc_conn_is_default = ''; 1390 1406 var selected_index = ''; 1391 1407 1392 1408 cc_conn_type_sel.disabled = false; 1393 1409 div_cc_conn_is_default.style.display = ""; 1394 1410 1395 1411 for(var i = 0;i < cc_conn_type_sel.options.length; i++) 1396 cc_conn_type_sel.options[i--] = null; 1397 1412 cc_conn_type_sel.options[i--] = null; 1413 1398 1414 if(Element('cc_conn_type_1').checked) { 1399 var lang_new_email = Element('cc_msg_new_email').value; 1400 var lang_main = Element('cc_msg_main').value; 1401 var lang_alternative = Element('cc_msg_alternative').value; 1402 cc_conn_type_sel[0] = new Option(lang_new_email,'-1'); 1403 cc_conn_type_sel[1] = new Option(lang_main,lang_main); 1404 cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative); 1415 cc_conn_type_sel[0] = new Option('Novo Email...','-1'); 1416 cc_conn_type_sel[1] = new Option('Principal','Principal'); 1417 cc_conn_type_sel[2] = new Option('Alternativo','Alternativo'); 1405 1418 connID = 1; 1406 1419 selected_index = cc_email_default.options.selectedIndex; … … 1409 1422 } 1410 1423 1411 var lang_select_email = Element('cc_msg_select_email').value;1412 cc_email_default.options[0] = new Option(lang_select_email,'-1'); 1424 cc_email_default.options[0] = new Option('Selecionar Email...','-1'); 1425 1413 1426 cc_phone_default.style.display = 'none'; 1414 cc_email_default.style.display = ''; 1427 cc_email_default.style.display = ''; 1415 1428 cc_conn_is_default = cc_email_default; 1416 1429 } 1417 1430 else if(Element('cc_conn_type_2').checked) { 1418 var lang_new_telephone = Element('cc_msg_new_phone').value; 1419 var lang_home = Element('cc_msg_home').value; 1420 var lang_cellphone = Element('cc_msg_cellphone').value; 1421 var lang_work = Element('cc_msg_work').value; 1422 var lang_fax = Element('cc_msg_fax').value; 1423 var lang_pager = Element('cc_msg_pager').value; 1424 cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1'); 1425 cc_conn_type_sel[1] = new Option(lang_home,lang_home); 1426 cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone); 1427 cc_conn_type_sel[3] = new Option(lang_work,lang_work); 1428 cc_conn_type_sel[4] = new Option(lang_fax,lang_fax); 1429 cc_conn_type_sel[5] = new Option(lang_pager,lang_pager); 1430 1431 cc_conn_type_sel[0] = new Option('Novo Telefone...','-1'); 1432 cc_conn_type_sel[1] = new Option('Residencial','Residencial'); 1433 cc_conn_type_sel[2] = new Option('Celular','Celular'); 1434 cc_conn_type_sel[3] = new Option('Comercial','Comercial'); 1435 cc_conn_type_sel[4] = new Option('Fax','Fax'); 1436 cc_conn_type_sel[5] = new Option('Pager','Pager'); 1431 1437 connID = 2; 1432 1438 selected_index = cc_phone_default.options.selectedIndex; … … 1435 1441 } 1436 1442 1437 var lang_choose_phone = Element('cc_msg_choose_phone').value; 1438 cc_phone_default.options[0] = new Option(lang_choose_phone,'-1'); 1443 cc_phone_default.options[0] = new Option('Selecionar Telefone...','-1'); 1439 1444 cc_email_default.style.display = 'none'; 1440 1445 cc_phone_default.style.display = ''; 1441 1446 cc_conn_is_default = cc_phone_default; 1442 1447 } 1443 1448 1444 1449 Element("cc_conn_type_sel").options.selectedIndex = 0; 1445 1450 /* First save the data */ … … 1447 1452 1448 1453 CC_conn_last_selected = connID; 1449 1454 1450 1455 clearConn(); 1451 1456 1452 1457 if (connID == '_NONE_') 1453 1458 { cc_conn_is_default.disabled = true; 1454 1459 return; 1455 1460 } 1456 1461 1457 1462 /* If no data already available, return */ 1458 1463 if (!CC_contact_full_info['connections']) … … 1478 1483 } 1479 1484 } 1480 } 1485 } 1481 1486 if(cc_conn_is_default.options.length > selected_index) 1482 1487 cc_conn_is_default.options.selectedIndex = (selected_index == "-1" ? 0 : selected_index); … … 1499 1504 CC_contact_full_info['connections'][CC_conn_last_selected] = new Array(); 1500 1505 } 1501 else 1506 else 1502 1507 { 1503 1508 delete CC_contact_full_info['connections'][CC_conn_last_selected]; … … 1511 1516 var subNodes = nodes[i].childNodes; 1512 1517 var found = false; 1513 1518 1514 1519 for (var j = 0; j < subNodes.length; j++) 1515 1520 { 1516 if (subNodes[j].childNodes.length > 0 && 1521 if (subNodes[j].childNodes.length > 0 && 1517 1522 subNodes[j].childNodes[0].id) 1518 1523 { … … 1522 1527 CC_contact_full_info['connections'][CC_conn_last_selected][k] = new Array(); 1523 1528 } 1524 1529 1525 1530 if (subNodes[j].childNodes[0].id.indexOf('cc_conn_name') != -1) 1526 1531 { … … 1542 1547 else 1543 1548 { 1544 CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; 1549 CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; 1545 1550 } 1546 1551 } … … 1553 1558 } 1554 1559 } 1555 1560 1556 1561 if (found) 1557 1562 { … … 1570 1575 delete CC_contact_full_info['connections'][CC_conn_last_selected]; 1571 1576 } 1572 1577 1573 1578 } 1574 1579 … … 1596 1601 var number = randomString().toLowerCase(); 1597 1602 var result = ''; 1598 1603 1599 1604 if(!is_ie) 1600 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);1605 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); 1601 1606 else 1602 result = prompt("Essa opera ção removerá TODOS os seus contatos pessoais, e NÃO PODERÁ ser desfeita. Digite o seguinte código de confirmação: "+number,"");1607 result = prompt("Essa operaᅵᅵo removerï¿œ TODOS os seus contatos pessoais, e Nï¿œO PODERï¿œ ser desfeita. Digite o seguinte cï¿œdigo de confirmaᅵᅵo: "+number,""); 1603 1608 1604 1609 if(result) { … … 1606 1611 Connector.newRequest('removeAllEntries', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_all_entries', 'GET', handler); 1607 1612 else 1608 alert('C ódigo Incorreto');1609 } 1613 alert('Cï¿œdigo Incorreto'); 1614 } 1610 1615 } 1611 1616 … … 1618 1623 return; 1619 1624 } 1620 1625 1621 1626 var handler = function (responseText) 1622 1627 { … … 1628 1633 return; 1629 1634 } 1630 1635 1631 1636 if (data['status'] != 'ok') 1632 1637 { … … 1634 1639 return; 1635 1640 } 1636 1641 1637 1642 setTimeout('updateCards()',80);; 1638 1643 }; 1639 1644 1640 1645 typeArg = (type == 'groups' ? 'group' : 'entry'); 1641 1646 1642 1647 Connector.newRequest('removeEntry', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_'+typeArg+'&remove=' + id, 'GET', handler); 1643 1648 } … … 1662 1667 var w_height = 0; 1663 1668 var w_extra = 200; 1664 1669 1665 1670 if (document.body.clientHeight) 1666 1671 { … … 1691 1696 Element('cc_letter_' + i).className = 'letter_box'; 1692 1697 } 1698 } 1699 } 1700 1701 function clearLetterSelection() 1702 { 1703 for (var i = 0; i < 28; i++) 1704 { 1705 Element('cc_letter_' + i).className = 'letter_box'; 1693 1706 } 1694 1707 } … … 1758 1771 final_page = 1; 1759 1772 } 1760 1773 1761 1774 html_pages += '<a href="javascript:setPages('+npages+', '+ actual_page +', '+ final_page +')">...</a> '; 1762 1775 1763 1776 page = showing_page ? showing_page : actual_page; 1764 1777 } 1765 1778 1766 1779 for (; page <= npages; page++) 1767 1780 { … … 1823 1836 Element('cc_panel_arrow_last').style.cursor = 'hand'; 1824 1837 } 1825 1838 1826 1839 Element('cc_panel_pages').innerHTML = html_pages; 1827 1840 } … … 1829 1842 function populateCards(data, type) 1830 1843 { 1831 if (data[3].length >= 100 ) 1832 { 1833 alert("Critério de pesquisa muito abrangente, achados " + data[3].length + " resultados"); 1834 for (i = 0; i < (Math.sqrt(data[3].length)-1); i++) 1835 for (j = 0; j < 3; j++) 1836 document.getElementById("cc_card:"+j+":"+i).innerHTML = ''; 1837 return false; 1838 } 1839 1844 1840 1845 if(type == 'groups') 1841 1846 return populateGroupsInCards(data); 1842 1847 1843 1848 var pos = 0; 1844 1849 var ncards = data[3].length; 1845 1850 1846 1851 if (typeof(data[3]) == 'object' && ncards > 0) 1847 1852 { … … 1851 1856 { 1852 1857 id = 'cc_card:'+j+':'+i; 1853 1858 1854 1859 for (var k = 0; k < data[2].length; k++) 1855 1860 { … … 1858 1863 Element(id).style.display = 'none'; 1859 1864 continue; 1860 } 1861 1865 } 1866 1862 1867 if(data[3][pos][k] != 'none') 1863 1868 { … … 1875 1880 } 1876 1881 break; 1877 1882 1878 1883 case 'cc_mail': 1879 1880 1884 if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) 1881 1885 { … … 1885 1889 else 1886 1890 { 1887 Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>'; 1891 Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>'; 1888 1892 } 1889 1893 break; 1890 1894 1891 1895 case 'cc_phone': 1892 1896 if (data[3][pos][k].length > 20) … … 1919 1923 Element(id+':cc_photo').src = '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo' + (data[4][pos] != 0 ? '&id='+data[3][pos][k] : ''); 1920 1924 if(ccTree.catalog_perms == 1) 1921 Element(id+':cc_icon_data').innerHTML = '<span title=" '+Element('cc_msg_copy_to_catalog').value+'" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccQuickAddContact.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/address-conduit-16.png" align="center"></span>';1925 Element(id+':cc_icon_data').innerHTML = '<span title="Copiar para o Catï¿œlogo Pessoal" id="' + id + ':ccQuickAdd" onmouseout="window.status=\'\';" onclick="ccQuickAddContact.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/address-conduit-16.png" align="center"></span>'; 1922 1926 break; 1923 1927 1924 1928 case 'cc_forwarding_address': 1925 1929 var contacts = data[3][pos][k]; 1926 1930 1927 1931 if( !contacts) 1928 1932 break; 1929 1933 1930 1934 Element(id+':cc_icon_group').innerHTML = '<span title="'+Element('cc_participants').value+'" onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value + '\');return true;" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/people-mini.png" align="center"> </span>'; 1935 break; 1936 1937 case 'cc_empNumber': 1938 if (data[3][pos][k].length > 20) 1939 { 1940 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 1941 Element(id+':'+data[2][k]).title = data[3][pos][k]; 1942 } 1943 else 1944 { 1945 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); 1946 } 1947 Element(id+':cc_empNumber').innerHTML = data[3][pos][k]; 1948 break; 1949 1950 //Para tratar tamanho do campo "departamento" do empregado 1951 case 'cc_department': 1952 if (data[3][pos][k].length > 15) 1953 { 1954 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); 1955 Element(id+':'+data[2][k]).title = data[3][pos][k]; 1956 } 1957 else 1958 { 1959 Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); 1960 } 1961 Element(id+':cc_department').innerHTML = data[3][pos][k]; 1931 1962 break; 1932 1963 … … 1939 1970 else 1940 1971 { 1972 if (Element(id+':'+data[2][k]) == null) alert('ï¿œ nulovgdfv'); 1941 1973 Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 1942 1974 } … … 1944 1976 } 1945 1977 } 1946 1978 1947 1979 if (--ncards == 0) 1948 1980 { … … 1950 1982 i = CC_max_cards[1]; 1951 1983 } 1952 1984 1953 1985 pos++; 1954 1986 } … … 1958 1990 1959 1991 function populateGroupsInCards(data) 1960 { 1992 { 1961 1993 var pos = 0; 1962 var contacts = data[5]; 1994 var contacts = data[5]; 1963 1995 var ncards = data[3].length; 1964 1996 1965 1997 if (typeof(data[3]) == 'object' && ncards > 0) 1966 1998 { … … 1970 2002 { 1971 2003 id = 'cc_card:'+j+':'+i; 1972 2004 1973 2005 for (var k = 0; k < data[2].length; k++) 1974 2006 { 1975 2007 1976 2008 if(data[3][pos][k] != 'none') 1977 { 1978 2009 { 2010 1979 2011 switch (data[2][k]) 1980 { 2012 { 1981 2013 case 'cc_title': 1982 2014 if (data[3][pos][k].length > 50) … … 1990 2022 } 1991 2023 break; 1992 2024 1993 2025 case 'cc_short_name': 1994 2026 if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) … … 2002 2034 } 2003 2035 break; 2004 2036 2005 2037 case 'cc_contacts': 2006 2038 … … 2011 2043 var email = ""; 2012 2044 2013 for (var d = 0; d < contacts.length; d++) { 2045 for (var d = 0; d < contacts.length; d++) { 2014 2046 contact += contacts[d]['names_ordered']+ ","; 2015 2047 email += contacts[d]['connection_value']+","; 2016 2048 } 2017 2049 2018 2050 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>'; 2019 2051 2020 2052 break; 2021 2053 2022 2054 case 'cc_id': 2023 2055 var id_contact = data[3][pos][k]; 2024 2056 Element(id+':'+data[2][k]).value = data[3][pos][k]; 2025 2057 2026 2058 break; 2027 2059 2028 2060 } 2029 2061 } 2030 2062 } 2031 2063 2032 2064 if (--ncards == 0) 2033 2065 { … … 2035 2067 i = CC_max_cards[1]; 2036 2068 } 2037 2069 2038 2070 pos++; 2039 2071 } … … 2064 2096 }; 2065 2097 2066 Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); 2098 Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); 2067 2099 } 2068 2100 … … 2070 2102 { 2071 2103 var coord = new Array(); 2072 2104 2073 2105 //Element('cc_card_space').innerHTML = ''; 2074 2106 //return; … … 2077 2109 //card_space_width = parseInt(is_ie ? document.body.offsetWidth : window.innerWidth) - parseInt(Element('cc_left').offsetWidth) - parseInt(CC_card_extra) - 40; 2078 2110 card_space_height = parseInt(Element('cc_card_space').offsetHeight) - parseInt(CC_card_extra); 2079 2111 2080 2112 card_width = CC_card_image_width + CC_card_extra; 2081 2113 card_height = CC_card_image_height + CC_card_extra; … … 2083 2115 ncols = parseInt(card_space_width / card_width); 2084 2116 nlines = parseInt(card_space_height / card_height); 2085 2117 2086 2118 coord[0] = ncols; 2087 2119 //coord[1] = nlines; … … 2097 2129 { 2098 2130 if(type != 'groups') { 2099 2131 2100 2132 html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 2101 2133 '<div style="border: 0px solid #999; position: relative;">' + 2102 '<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);">' + 2134 '<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);">' + 2103 2135 ( ccTree.catalog_perms == 1 ? 2104 2136 '<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>':'') + … … 2106 2138 '<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">' + 2107 2139 '<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">' : '') + 2108 '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2140 '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + 2109 2141 '<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>' + 2110 '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px" valign="bottom" id="' + id + ':cc_icon_group"> </span>'+ 2111 '<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>' + 2112 '<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>' + 2113 '<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>' + 2114 '<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>' + 2115 '<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>' + 2142 '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px" valign="bottom" id="' + id + ':cc_icon_group"> </span>'+ 2143 //Para exibir a matricula do empregado nos cartoes 2144 '<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>' + 2145 '<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>' + 2146 '<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>' + 2147 //Para exibir o setor/lotacao do empregado nos cartoes 2148 '<span id="' + id + ':cc_department" style="position: absolute; top: 70px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2149 '<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>' + 2150 '<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>' + 2151 '<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>' + 2116 2152 '<input id="' + id + ':cc_id" type="hidden">' + 2117 2153 '</div>' + '</td>'; 2118 2154 2119 2155 } else { 2120 2156 html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 2121 '<div style="border: 0px solid #999; position: relative;">' + 2157 '<div style="border: 0px solid #999; position: relative;">' + 2122 2158 '<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);">' + 2123 2159 '<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">' + 2124 '<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">' + 2160 '<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">' + 2125 2161 '<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>' + 2126 2162 '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + … … 2129 2165 '</div>' + '</td>'; 2130 2166 } 2131 2167 2132 2168 2133 2169 return html_card; … … 2141 2177 else 2142 2178 bg = "this.style.background=\'#EEEEEE\'"; 2143 2179 2144 2180 if(type != 'groups') { 2145 2146 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;">' + 2147 '<span valign="bottom" id="' + id + ':cc_icon_group"> </span><span id="' + id + ':cc_name"></span></td>' + 2181 2182 html_card = '<tr style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE">' + 2183 //Para exibir a matricula do empregado na tabela 2184 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_empNumber"></span></td>' + 2185 '<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>' + 2148 2186 '<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>' + 2149 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + 2187 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + 2188 //Para exibir o setor/lotacao do empregado na tabela 2189 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_department"></span></td>' + 2190 // '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' + 2191 '<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>' + 2150 2192 ( ccTree.catalog_perms == 1 ? 2151 2193 '<td align="left"><span valign="bottom" id="' + id + ':cc_icon_data"></span></td>':'') + … … 2156 2198 '<img title="'+Element('cc_msg_card_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);" src="templates/default/images/cc_x.png">' : '') + 2157 2199 '<input id="' + id + ':cc_id" type="hidden">'+ 2158 '<input type="hidden" id="' + id + ':cc_photo">' + 2159 '<span id="' + id + ':cc_title" style="display:none"></span>' + 2160 '<span id="' + id + ':cc_alias" style="display:none"></span>' + 2200 '<input type="hidden" id="' + id + ':cc_photo">' + 2201 '<span id="' + id + ':cc_title" style="display:none"></span>' + 2202 '<span id="' + id + ':cc_alias" style="display:none"></span>' + 2203 // Esse campo ï¿œ necessï¿œrio se o contato possui dados no campo cc_company 2204 '<span id="' + id + ':cc_company" style="display:none"></span>' + 2161 2205 '</td></tr>'; 2162 2206 } … … 2170 2214 ' | '+ 2171 2215 '<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">' + 2172 '<input id="' + id + ':cc_id" type="hidden">'+ 2216 '<input id="' + id + ':cc_id" type="hidden">'+ 2173 2217 '</td></tr>'; 2174 2218 } … … 2180 2224 { 2181 2225 var pos; 2182 2226 2183 2227 html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1"><table width="100%" border="0" cellpadding="0" cellspacing="3">'; 2184 2228 2185 2229 if (ncards > 0) 2186 2230 { … … 2202 2246 if((ccTree.catalog_perms & 2) && type != 'groups') 2203 2247 html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 2204 } 2248 } 2205 2249 else if (CC_max_cards != 0) 2206 2250 { … … 2222 2266 html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1">'; 2223 2267 html_cards += '<table border="0" cellpadding="0" cellspacing="' + CC_card_extra + '">'; 2224 2268 2225 2269 if (ncards > 0) 2226 2270 { … … 2241 2285 if((ccTree.catalog_perms & 2) && type != 'groups') 2242 2286 html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 2243 } 2287 } 2244 2288 else if (CC_max_cards != 0) 2245 2289 { … … 2278 2322 else if(CC_visual == 'table') 2279 2323 drawTable(0); 2280 2324 2281 2325 setPages(0,0); 2282 2326 return; … … 2288 2332 data = unserialize(responseText); 2289 2333 if (data[0] == '0') 2290 { 2291 Element('cc_type_contact').value = data[1]; 2334 { 2335 Element('cc_type_contact').value = data[1]; 2292 2336 CC_npages = 0; 2293 2337 CC_actual_page = 1; … … 2301 2345 else 2302 2346 Element('cc_type_contact').value = data[10]; 2303 2304 // Element('cc_debug').innerHTML = responseText; 2305 2347 2348 // Element('cc_debug').innerHTML = responseText; 2349 2306 2350 if (typeof(data) != 'object') 2307 2351 { … … 2309 2353 return; 2310 2354 } 2311 2355 2312 2356 if (typeof(data[3]) == 'object') 2313 2357 { 2314 2358 CC_npages = parseInt(data[0]); 2315 CC_actual_page = parseInt(data[1]); 2359 CC_actual_page = parseInt(data[1]); 2316 2360 if(CC_visual == 'cards') 2317 2361 drawCards(data[3].length, data[10]); … … 2321 2365 populateCards(data, data[10]); 2322 2366 setPages(data[0], data[1]); 2323 2367 2368 } 2369 else if (data['error']) 2370 { 2371 showMessage(data['error']); 2324 2372 } 2325 2373 else … … 2332 2380 var info = "letter="+letter+"&page="+CC_actual_page+"&ids="+ids; 2333 2381 Connector.newRequest('showCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler, info); 2382 } 2383 2384 2385 function clearCards() 2386 { 2387 clearLetterSelection(); 2388 setHeightSpace(); 2389 setMaxCards(getMaxCards()); 2390 2391 if(CC_visual == 'cards') 2392 drawCards(0); 2393 else if(CC_visual == 'table') 2394 drawTable(0); 2395 2396 setPages(0,0); 2397 return; 2334 2398 } 2335 2399 … … 2342 2406 var table_h = Element('cc_panel_table'); 2343 2407 var cards_h = Element('cc_panel_cards'); 2344 2408 2345 2409 switch (type) 2346 2410 { … … 2355 2419 break; 2356 2420 } 2357 2421 2358 2422 CC_visual = type; 2359 2423 showCards(getActualLetter(), getActualPage()); 2360 2424 } 2361 2425 2362 function ccSearchUpdate(ids)2426 /*function ccSearchUpdate(ids) 2363 2427 { 2364 2428 Element('cc_panel_letters').style.display = 'none'; 2365 2429 Element('cc_panel_search').style.display = 'inline'; 2366 2430 2367 2431 if(CC_visual == 'cards') 2368 2432 drawCards(0); … … 2375 2439 return; 2376 2440 } 2377 2441 2378 2442 var sIds = serialize(ids); 2379 2443 … … 2383 2447 } 2384 2448 showCards('search', '1', sIds); 2449 } 2450 */ 2451 2452 function ccSearchUpdate() 2453 { 2454 Element('cc_panel_letters').style.display = 'none'; 2455 Element('cc_panel_search').style.display = 'inline'; 2456 2457 if(CC_visual == 'cards') 2458 drawCards(0); 2459 else if(CC_visual == 'table') 2460 drawTable(0); 2461 2462 if (CC_actual_letter != 'search') 2463 { 2464 CC_last_letter = CC_actual_letter; 2465 } 2466 //showCards('search', '1', sIds); 2385 2467 } 2386 2468 … … 2399 2481 Element('cc_panel_search').style.display = 'none'; 2400 2482 Element('cc_panel_letters').style.display = 'inline'; 2401 showCards(CC_last_letter, '1'); 2483 clearCards(); 2484 //showCards(CC_last_letter, '1'); 2402 2485 } 2403 2486 … … 2424 2507 data[3] = Element('cc_qa_phone').value; 2425 2508 data[4] = Element('cc_qa_email').value; 2509 2510 return data; 2511 } 2512 2513 function sendQuickAdd () 2514 { 2515 var data = getQuickAdd(); 2516 2517 var str = serialize(data); 2518 2519 if (!str) 2520 { 2521 return false; 2522 } 2523 2524 var handler = function (responseText) 2525 { 2526 setTimeout('updateCards()',100);; 2527 } 2528 2529 resetQuickAdd(); 2530 2531 Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str)); 2532 } 2533 2426 2534 2427 return data; 2428 } 2429 2430 function sendQuickAdd () 2431 { 2432 var data = getQuickAdd(); 2433 2434 var str = serialize(data); 2435 2436 if (!str) 2437 { 2438 return false; 2439 } 2440 2441 var handler = function (responseText) 2442 { 2443 setTimeout('updateCards()',100);; 2444 } 2445 2446 resetQuickAdd(); 2447 2448 Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str)); 2449 } 2535 function connectVoip (phoneUser, typePhone){ 2536 var handler_voip = function (responseText){ 2537 if(!responseText) { 2538 alert("Erro conectando servidor VoIP."); 2539 } 2540 else{ 2541 data = unserialize(responseText); 2542 alert("Requisitando chamada para o ramal: "+data); 2543 } 2544 } 2545 Connector.newRequest('voip', "../../expressoMail1_2/controller.php?action=expressoMail1_2.functions.callVoipconnect&to="+phoneUser+"&typePhone="+typePhone, 'POST', handler_voip); 2546 } -
trunk/contactcenter/js/ccAddGroup.js
r118 r284 158 158 159 159 if(!this.title.value) { 160 alert( Element('cc_msg_fill_field_name').value);160 alert('Preencha o campo obrigatório "Nome Completo"'); 161 161 this.title.focus(); 162 162 return false; … … 164 164 165 165 if(! contacts.length) { 166 alert( Element('cc_msg_add_contact_to_group').value);166 alert('Você não adicionou nenhum contato para esse grupo'); 167 167 return false; 168 168 } -
trunk/contactcenter/js/ccIEContacts.js
r270 r284 3 3 this.el; 4 4 this.wWidth = 395; 5 this.wHeight = 2 55;5 this.wHeight = 240; 6 6 } 7 7 … … 16 16 } 17 17 } 18 19 cIEContacts.prototype.showFailures = function(data){20 if (data == 'undefined')21 return;22 if (data){23 var lang_clean = Element('cc_msg_clean').value;24 var info_box = document.getElementById('s_info2');25 info_box.innerHTML = data;26 info_box.style.visibility = '';27 var cleanButton = document.createElement('input');28 cleanButton.type='button';29 cleanButton.value=lang_clean;30 cleanButton.onclick= function() { ccIEContacts.cleanInfo() };31 info_box.appendChild(cleanButton);32 }33 }34 35 cIEContacts.prototype.cleanInfo = function(){36 var info_box = document.getElementById('s_info2');37 info_box.innerHTML = '';38 }39 18 40 19 cIEContacts.prototype.showList = function(){ … … 58 37 this.el.id = 'cc_rectIEContacts'; 59 38 document.body.appendChild(this.el); 60 61 var lang_import_contacts = Element('cc_msg_import_contacts').value;62 var lang_close_win = Element('cc_msg_close_win').value63 var lang_export_contacts = Element('cc_msg_export_contacts').value;64 var lang_expresso_info_csv = Element('cc_msg_expresso_info_csv').value;65 var lang_expresso_default = Element('cc_msg_expresso_default').value;66 var lang_choose_contacts_file = Element('cc_msg_choose_contacts_file').value;67 var lang_msg_choose_type = Element('cc_msg_choose_file_type').value;68 var lang_msg_expresso_info_csv = Element('cc_msg_expresso_info_csv').value;69 var lang_msg_export_csv = Element('cc_msg_export_csv').value;;70 var lang_msg_automatic = Element('cc_msg_automatic').value;71 var lang_moz_tb = Element('cc_msg_moz_thunderbird').value;72 var lang_outl_pt = Element('cc_msg_outlook_express_pt').value;73 var lang_outl_en = Element('cc_msg_outlook_express_en').value;74 var lang_outl2k_pt = Element('cc_msg_outlook_2k_pt').value;75 var lang_outl2k_en = Element('cc_msg_outlook_2k_en').value;76 var lang_expresso_default_csv = Element('cc_msg_expresso_default_csv').value;77 78 79 39 this.el.innerHTML = 80 40 '<div align="left" id="divAppbox"><table width="100%" border=0>'+ 81 '<tr><td style="border-bottom:1px solid black"><input onclick="javascript:ccIEContacts.changeOptions(this.value)" id="type" type="radio" name="type" value="i" style="border:0" checked> '+lang_import_contacts+82 ' <input onclick="javascript:ccIEContacts.changeOptions(this.value)" id="type" type="radio" name="type" style="border:0" value="e"/> '+lang_export_contacts+'<br></td></tr>'+41 '<tr><td style="border-bottom:1px solid black"><input onclick="javascript:ccIEContacts.changeOptions(this.value)" id="type" type="radio" name="type" value="i" style="border:0" checked>Importar Contatos'+ 42 ' <input onclick="javascript:ccIEContacts.changeOptions(this.value)" id="type" type="radio" name="type" style="border:0" value="e"/>Exportar Contatos<br></td></tr>'+ 83 43 '</table>'+ 84 44 '<table border=0 height="208px" width="100%" id="import_span">'+ 85 45 '<tr><td>'+ 86 '<font color="DARKBLUE" size="2"> '+lang_expresso_info_csv+'</font></td></tr>'+46 '<font color="DARKBLUE" size="2">O Expresso suporta a importação de contatos no formato de arquivo CSV.</font></td></tr>'+ 87 47 '<tr><td height="75px" valign="top">'+ 88 '<form name="formCSV" method="POST" enctype="multipart/form-data">'+ lang_msg_choose_type +89 ' : <select id="typeImport"><option value="auto" selected>'+lang_msg_automatic+'</option>'+90 '<option value="outlook"> '+("Outlook Express")+'</option>'+91 '<option value="outlook2000"> '+("Outlook 2000")+'</option>'+92 '<option value="thunderbird"> '+("Mozilla Thunderbird")+'</option>'+93 '<option value="expresso" >'+lang_expresso_default+'</option></select><br>'+94 '<br> '+lang_choose_contacts_file+'<br><br>'+48 '<form name="formCSV" method="POST" enctype="multipart/form-data">'+ 49 'Selecione o tipo do arquivo: <select id="typeImport">'+ 50 '<option value="outlook">Outlook Express</option>'+ 51 '<option value="outlook2000">Outlook 2000</option>'+ 52 '<option value="thunderbird">Mozilla Thunderbird</option>'+ 53 '<option value="expresso" selected>Expresso (padrão)</option></select><br>'+ 54 '<br>Selecione o arquivo que contém os contatos a serem importados:<br><br>'+ 95 55 '<input id="import_file" type="file" name="import_file">'+ 96 56 '</form></td></tr>'+ 97 57 '<tr><td height="10px" align="center" nowrap><span style="visibility:hidden" id="s_info"></span></td></tr>'+ 98 58 '<tr><td height="10px" align="center"></td></tr>'+ 99 '<tr><td nowrap><center><input id="import_button" type="button" value= '+lang_import_contacts+'onClick="javascript:ccIEContacts.importCSV(this)"> '+100 '<input type="button" value= '+lang_close_win+'onClick="javascript:ccIEContacts.close()"></center></td></tr>'+101 '< tr><td height="10px" align="center" nowrap><span style="visibility:hidden" id="s_info2"></span></td></tr></table>'+59 '<tr><td nowrap><center><input id="import_button" type="button" value="Importar Contatos" onClick="javascript:ccIEContacts.importCSV(this)"> '+ 60 '<input type="button" value="Fechar" onClick="javascript:ccIEContacts.close()"></center></td></tr>'+ 61 '</table>'+ 102 62 '<table border=0 height="208px" width="100%" style="display:none" id="export_span">'+ 103 63 '<tr><td>'+ 104 '<font color="DARKBLUE" size="2">'+ lang_msg_expresso_info_csv+'</font></td></tr>'+ 105 '<tr><td height="85px" valign="top">'+lang_msg_export_csv+'<br><br>'+ 106 '<input style="border:0" id="typeExport_0" name="radio" type="radio" value="expresso" checked/>'+lang_expresso_default_csv+'<br>'+ 107 '<input style="border:0" id="typeExport_1" name="radio" type="radio" value="outlook_pt-BR">'+lang_outl_pt+ '<br>'+ 108 '<input style="border:0" id="typeExport_2" name="radio" type="radio" value="outlook_en">'+lang_outl_en+ '<br>'+ 109 '<input style="border:0" id="typeExport_3" name="radio" type="radio" value="outlook2000_pt-BR">'+lang_outl2k_pt + '<br>'+ 110 '<input style="border:0" id="typeExport_4" name="radio" type="radio" value="outlook2000_en">'+lang_outl2k_en + '<br>'+ 111 '<input style="border:0" id="typeExport_5" name="radio" type="radio" value="thunderbird">'+lang_moz_tb + '<br>'+ 64 '<font color="DARKBLUE" size="2">O Expresso suporta a exportação de contatos no formato de arquivo CSV.</font></td></tr>'+ 65 '<tr><td height="85px" valign="top">'+ 66 'Selecione o tipo do formato que deseja exportar seus contatos:<br><br>'+ 67 '<input style="border:0" id="typeExport_0" name="radio" type="radio" value="expresso" checked/>Exportar como CSV do Expresso (padrão)<br>'+ 68 '<input style="border:0" id="typeExport_1" name="radio" type="radio" value="outlook_pt-BR">Exportar como CSV do Outlook Express (Português)<br>'+ 69 '<input style="border:0" id="typeExport_2" name="radio" type="radio" value="outlook_en">Exportar como CSV do Outlook Express (Inglês)<br>'+ 70 '<input style="border:0" id="typeExport_3" name="radio" type="radio" value="outlook2000_pt-BR">Exportar como CSV do Outlook 2000 (Português)<br>'+ 71 '<input style="border:0" id="typeExport_4" name="radio" type="radio" value="outlook2000_en">Exportar como CSV do Outlook 2000 (Inglês)<br>'+ 72 '<input style="border:0" id="typeExport_5" name="radio" type="radio" value="thunderbird">Exportar como CSV do Mozilla Thunderbird<br>'+ 112 73 '</td></tr>'+ 113 74 '<tr><td align="center"> </td></tr>'+ 114 '<tr><td nowrap><center><input id="export_button" type="button" value= '+lang_export_contacts+ 'onClick="javascript:ccIEContacts.exportCSV(this)"> '+115 '<input type="button" value= '+lang_close_win+ 'onClick="javascript:ccIEContacts.close()"></center></td></tr>'+75 '<tr><td nowrap><center><input id="export_button" type="button" value="Exportar Contatos" onClick="javascript:ccIEContacts.exportCSV(this)"> '+ 76 '<input type="button" value="Fechar" onClick="javascript:ccIEContacts.close()"></center></td></tr>'+ 116 77 '</table></div>'; 117 78 } 118 79 this.showWindow(); 119 80 } 120 81 121 82 cIEContacts.prototype.showWindow = function () 122 83 { 123 84 if(!this.win) { 124 125 85 86 this.win = new dJSWin({ 126 87 id: 'ccIEContacts', 127 88 content_id: this.el.id, … … 130 91 title_color: '#3978d6', 131 92 bg_color: '#eee', 132 title: Element('cc_msg_ie_personal').value,93 title: "Importar / Exportar Contatos Pessoais", 133 94 title_text_color: 'white', 134 95 button_x_img: '../phpgwapi/images/winclose.gif', … … 151 112 var status = ''; 152 113 153 var lang_import_fail = Element('cc_msg_import_fail').value; 154 var lang_importing = Element('cc_msg_importing_contacts').value; 155 var lang_import_finish = Element('cc_msg_import_finished').value; 156 var lang_new = Element('cc_msg_new').value; 157 var lang_failure = Element('cc_msg_failure').value; 158 var lang_exists = Element('cc_msg_exists').value; 159 var lang_show_more_info = Element('cc_msg_show_more_info').value; 160 161 var l_1 = '<font face="Verdana" size="1" color="GREEN">['+args[1]+lang_new+']</font>'; 162 var l_2 = '<font face="Verdana" size="1" color="RED">['+args[2]+lang_failure+']</font>'; 163 var l_3 = '<font face="Verdana" size="1" color="DARKBLUE">['+args[3]+lang_exists+']</font>'; 164 var l_4 = '<br><a font face="Verdana" size="1" href="javascript:ccIEContacts.showFailures(\''+args[4]+'\')">'+lang_show_more_info+'</a>'; 165 var l_error = '<span style="height:15px;background:#cc4444"> <font face="Verdana" size="1" color="WHITE">'+lang_import_fail+ ' </font></span>'; 166 var l_importing = '<span style="height:15px;background:rgb(250, 209, 99)"> <font face="Verdana" size="1" color="DARKBLUE">'+lang_importing + ' </font></span>'; 114 var l_1 = '<font face="Verdana" size="1" color="GREEN">['+args[1]+' novos]</font>'; 115 var l_2 = '<font face="Verdana" size="1" color="RED">['+args[2]+' falharam]</font>'; 116 var l_3 = '<font face="Verdana" size="1" color="DARKBLUE">['+args[3]+' já existiam]</font>'; 117 var l_error = '<span style="height:15px;background:#cc4444"> <font face="Verdana" size="1" color="WHITE">A importação falhou. Verifique o formato do arquivo. </font></span>'; 118 var l_importing = '<span style="height:15px;background:rgb(250, 209, 99)"> <font face="Verdana" size="1" color="DARKBLUE">Importando contatos .... </font></span>'; 167 119 168 120 if(args[0] == 'success') { 169 121 170 for(i = 1; i < 5; i++) {122 for(i = 1; i < 4; i++) { 171 123 status += " "+eval('l_'+i); 172 124 } 173 Element('s_info').innerHTML = ' <font face="Verdana" size="1" color="BLACK"><b> '+lang_import_finish+'</b></font><br> '+status;125 Element('s_info').innerHTML = ' <font face="Verdana" size="1" color="BLACK"><b>A importação foi concluída.</b></font><br> '+status; 174 126 } 175 127 else … … 196 148 cIEContacts.prototype.importCSV = function () 197 149 { 198 var lang_msg_invalid_csv = Element('cc_msg_invalid_csv').value;199 150 var form = document.formCSV; 151 200 152 if ((form.import_file.value.length < 10) || 201 (form.import_file.value.substring(form.import_file.value.length - 4, form.import_file.value.length) .toLowerCase()!= ".csv")){202 alert( lang_msg_invalid_csv);153 (form.import_file.value.substring(form.import_file.value.length - 4, form.import_file.value.length) != ".csv")){ 154 alert('Selecione um arquivo CSV válido para importar seus contatos.'); 203 155 return; 204 156 } … … 218 170 args[2] = data._failure ? data._failure : 0; 219 171 args[3] = data._existing ? data._existing : 0; 220 args[4] = data._failure_status221 222 172 } 223 173 _this.importWriteStatus(args); … … 258 208 259 209 cIEContacts.prototype.exportCSV = function() { 260 var lang_export_error = Element('cc_msg_export_error'); 210 261 211 var handler_export = function(data) { 262 212 if(!data){ 263 alert( lang_export_error);213 alert("Ocorreu um erro durante a exportação."); 264 214 return; 265 215 } -
trunk/contactcenter/js/ccMain.js
r119 r284 1 var last_id = 0; 2 3 function openwindow(url){ 4 var window_features = "scrollbars=yes,resizable=yes,location=no,menubar=no," + 5 "personalbar=no,status=no,titlebar=no,toolbar=no," + 6 "screenX=0,screenY=0,top=0,left=0,width=" + 7 screen.width + ",height=" + screen.height/5*3; 8 9 window.open(url,'', window_features); 1 var last_id = 0; 2 3 function openwindow(url){ 4 var window_features = "scrollbars=yes,resizable=yes,location=no,menubar=no," + 5 "personalbar=no,status=no,titlebar=no,toolbar=no," + 6 "screenX=0,screenY=0,top=0,left=0,width=" + 7 screen.width + ",height=" + screen.height/5*3; 8 9 window.open(url,'', window_features); 10 10 } 11 11 12 12 var Main_pre_load = document.body.onload; 13 13 var ccSearch, ccTree; 14 var Main_load = function () 15 { 14 var Main_load = function () 15 { 16 16 Connector.setProgressBox(Element('cc_loading'), true); 17 Connector.setProgressHolder(Element('cc_loading_inner')); 17 Connector.setProgressHolder(Element('cc_loading_inner')); 18 18 /* Associate the Quick Add Button with the Plugin */ 19 19 20 20 21 21 /* Create the Search Object */ … … 37 37 ccSearch.DOMresult.style.visibility = 'hidden'; 38 38 ccSearch.onSearchFinish = ccSearchUpdate; 39 39 40 40 Connector.setProgressBox(Element('cc_loading'), true); 41 41 Connector.setProgressHolder(Element('cc_loading_inner')); 42 42 43 43 /* Create the Tree Object */ 44 ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); 44 //ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); 45 ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); clearCards();'}); 45 46 46 47 ccTree.Connector = Connector; … … 64 65 var _timeout = ''; 65 66 var menu = function () { 66 67 67 68 if(! this.menuStarted) 68 69 this.menuStarted = true; 69 70 70 71 submenu = []; 71 72 textmenu = []; 72 73 73 74 textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_group"] 74 textmenu[1] = ["cc_quick_add", "cc_full_add", "cc_add_group"]; 75 textmenu[1] = ["cc_quick_add", "cc_full_add", "cc_add_group"]; 75 76 function show(){ 76 77 clearTimeout(_timeout); 77 78 button = document.getElementById("cc_button_new"); 78 79 this.style.top = 19 + findPosY(button) + "px"; 80 this.style.visibility='visible'; 79 80 this.style.top = 19 + findPosY(button) + "px"; 81 this.style.visibility='visible'; 81 82 } 82 83 function hide(){ _timeout = setTimeout("menu.style.visibility='hidden';",200); }; 83 84 84 85 if(document.getElementById) { 85 86 menu = document.getElementById("Layer1"); 86 87 87 88 for (i=0; i< textmenu[0].length; i++) { 88 89 textmenu[0][i] = "<span onclick= 'menu.onmouseout();'>" + document.getElementById(textmenu[0][i]).value + "</span><br>"; 89 submenu[i] = document.createElement("DIV"); 90 submenu[i] = document.createElement("DIV"); 90 91 submenu[i].innerHTML = textmenu[0][i]; 91 92 submenu[i].id = textmenu[1][i]; 92 93 submenu[i].onmouseover = function () {this.style.backgroundColor = 'LIGHTYELLOW';this.style.color = 'DARKBLUE';}; 93 submenu[i].onmouseout = function () { this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';}; 94 submenu[i].onmouseout = function () { this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';}; 94 95 submenu[i].setAttribute("className", "special"); 95 96 submenu[i].setAttribute("class", "special"); 96 submenu[i].style.padding = "5px"; 97 submenu[i].style.padding = "5px"; 97 98 menu.appendChild(submenu[i]); 98 } 99 99 } 100 100 101 menu.onmouseover = show; 101 102 menu.onmouseout = hide; 102 103 } 103 104 104 105 ccQuickAdd.associateAsButton(Element('cc_quick_add')); 105 106 ccAddGroup.associateAsButton(Element('cc_add_group')); 106 107 document.getElementById("cc_full_add").onclick= newContact; 107 108 108 109 109 110 ccQuickAdd.afterSave = function () 110 111 { 111 112 updateCards(); 112 } 113 114 ccAddGroup.load = function () 115 { 116 editGroup(); 117 } 118 113 } 114 115 ccAddGroup.load = function () 116 { 117 editGroup(); 118 } 119 119 120 ccAddGroup.afterSave = function () 120 121 { 121 122 updateCards(); 122 123 } 123 124 124 125 return true; 125 126 } … … 127 128 if (is_ie) 128 129 { 129 130 130 131 document.body.onload = function (e) 131 { 132 Main_pre_load(); 133 Main_load(); 134 132 { 133 Main_pre_load(); 134 Main_load(); 135 135 136 } 136 137 } 137 138 else 138 { 139 Main_load(); 140 141 } 139 { 140 Main_load(); 141 142 } 142 143 143 144 // BEGIN: FUNCTION RESIZE WINDOW … … 156 157 showBar = __showBar; 157 158 hideBar = __hideBar; 158 159 159 160 var _onResize = window.onresize; 160 161 window.onresize = resizeWindow; 161 162 var defaultHeight = 0; 162 163 function setDefaultHeight(){ 163 164 164 165 var bar = Element("toolbar"); 165 166 var offset = 0; 166 if(bar.style.visibility != 'hidden') 167 offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); 167 if(bar.style.visibility != 'hidden') 168 offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); 168 169 169 170 var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; 170 defaultHeight = screenHeight - offset; 171 Element("cc_tree").style.height = defaultHeight - 68; 172 Element("cc_left_main").style.height = defaultHeight - 68; 171 defaultHeight = screenHeight - offset; 172 Element("cc_tree").style.height = defaultHeight - 68; 173 Element("cc_left_main").style.height = defaultHeight - 68; 173 174 } 174 175 … … 176 177 setDefaultHeight(); 177 178 if(Element("divScrollMain")) 178 Element("divScrollMain").style.height = defaultHeight - 108; 179 Element("divScrollMain").style.height = defaultHeight - 108; 179 180 if (!is_ie) 180 181 Element('tableDivAppbox').width = '100%'; … … 184 185 setDefaultHeight(); 185 186 Element('cc_main').style.height = defaultHeight; 186 var lang_warn_firefox = Element('cc_msg_warn_firefox');187 var lang_firefox_msg1 = Element('cc_msg_firefox_half1');188 var lang_firefox_msg2 = Element('cc_msg_firefox_half2');189 var lang_install_now = Element('cc_msg_install_now');190 var lang_install_new_firefox = Element('cc_msg_install_new_firefox');191 var lang_close = Element('cc_msg_close');192 187 function buildWarningMsg(_version) { 193 188 var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth; … … 196 191 "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+ 197 192 (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+ 198 "<font color='RED' size='2'>"+lang_warn_firefox + "("+_version+")</font><BR>"+ 199 "<font color='black' size='2'><p style='text-align:justify'> "+lang_firefox_msg1+ 200 lang_firefox_msg2 + ".</p></font><div style='width:100%' align='center'>"+ 201 "<a title='"+lang_install_now+"' href='http://br.mozdev.org/firefox/download.html' target='_blank'>"+lang_install_new_firefox+ "</a>"+ 193 "<font color='RED' size='2'>Aviso: Versão muito antiga do Firefox ("+_version+")</font><BR>"+ 194 "<font color='black' size='2'><p style='text-align:justify'> Para que essa aplicação funcione <u>corretamente</u> "+ 195 "é necessário atualizar o seu navegador Firefox para uma versão mais nova (versão > 1.5). "+ 196 "Instale agora clicando no link abaixo ou caso queira atualizar mais tarde (não recomendável), clique em Fechar.</p></font><div style='width:100%' align='center'>"+ 197 "<a title='Instalar agora' href='http://br.mozdev.org/firefox/download.html' target='_blank'>Instalar nova versão do Firefox</a>"+ 202 198 " "+ 203 "<a title='"+lang_close+"' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>"+lang_close+"</a></div>"+ 204 199 "<a title='Fechar' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>Fechar</a></div>"+ 205 200 "</DIV>"; 206 201 … … 208 203 209 204 myOpacity = new fx.Opacity('warning_msg', {duration: 600}); 210 document.getElementById("warning_msg").style.visibility = 'hidden'; 205 document.getElementById("warning_msg").style.visibility = 'hidden'; 211 206 myOpacity.now = 0; 212 207 setTimeout("myOpacity.toggle()",3000); -
trunk/contactcenter/js/ccQuickAddContact.js
r118 r284 6 6 } 7 7 8 8 9 9 cQuickAddContact.prototype.showList = function(id){ 10 10 _this = this; 11 11 var handler = function (responseText) { 12 12 var contacts = unserialize(responseText); 13 var title = contacts['names_ordered']; 14 el = document.createElement("DIV"); 15 el.style.visibility = "hidden"; 13 var title = contacts['names_ordered']; 14 el = document.createElement("DIV"); 15 el.style.visibility = "hidden"; 16 16 el.style.position = "absolute"; 17 17 el.style.left = "0px"; … … 21 21 el.style.height = wHeight + 'px'; 22 22 el.className = "div_cc_rectQuickAddContact"; 23 el.id = id+':cc_rectQuickAddContact'; 24 document.body.appendChild(el); 25 el.innerHTML = ""; 23 el.id = id+':cc_rectQuickAddContact'; 24 document.body.appendChild(el); 25 el.innerHTML = ""; 26 26 27 27 var fieldsTop = 10; 28 28 var fieldsSpace = 30; 29 29 fields = new Array(Element('cc_qa_alias').value, Element('cc_qa_given_names').value, Element('cc_qa_family_names').value, Element('cc_qa_phone').value, Element('cc_qa_email').value); 30 30 31 31 for (i=0; i<fields.length; i++) { 32 32 var contact = contacts[i] != null ? contacts[i] : ''; 33 33 el.innerHTML += '<span id="ccQuickAddCT' + i + id + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 5px; width: 100px; text-align: right; border: 0px solid #999;">' + fields[i] + '</span>'; 34 el.innerHTML += '<input id="ccQuickAddCI' + i + id + '" type="text" value="' + contact + '" maxlength="50" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 110px; width: 135px;">'; 34 if (i == 0) 35 { 36 el.innerHTML += '<input id="ccQuickAddCI' + i + id + '" type="text" value="' + contact + '" maxlength="30" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 110px; width: 135px;">'; 37 } 38 else if (i == 4) 39 { 40 el.innerHTML += '<input id="ccQuickAddCI' + i + id + '" type="text" value="' + contact + '" maxlength="100" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 110px; width: 135px;">'; 41 } 42 else 43 { 44 el.innerHTML += '<input id="ccQuickAddCI' + i + id + '" type="text" value="' + contact + '" maxlength="50" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 110px; width: 135px;">'; 45 } 35 46 } 36 47 37 48 el.innerHTML +='<div id="ccQAFuncitons" style="border: 0px solid black; width: 220px; height: 20px">' + 38 '<input title=" ' + Element('cc_qa_save').value + '"type="button" onclick="ccQuickAddContact.send(\'' + id + '\');" value="' + Element('cc_qa_save').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 75px; width: 60px" />' +39 '<input title=" ' + Element('cc_qa_close').value + '" type="button" onclick="ccQuickAddContact.fechar(\'' + id + '\');" value="' + Element('cc_qa_close').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 140px; width: 60px" />' +49 '<input title="ccQASave" type="button" onclick="ccQuickAddContact.send(\'' + id + '\');" value="' + Element('cc_qa_save').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 75px; width: 60px" />' + 50 '<input title="ccQAClear" type="button" onclick="ccQuickAddContact.fechar(\'' + id + '\');" value="' + Element('cc_qa_clear').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 140px; width: 60px" />' + 40 51 '</div>'; 41 52 el.innerHTML += "<br>"; 42 53 43 54 _this.showWindow(el); 44 55 } 45 56 46 57 div = document.getElementById(id+':cc_rectQuickAddContact'); 47 58 48 59 if(div) 49 60 this.showWindow(div); … … 52 63 } 53 64 } 54 65 55 66 cQuickAddContact.prototype.showWindow = function (div) 56 { 67 { 57 68 if(! this.arrayWin[div.id]) { 58 69 59 win = new dJSWin({ 70 win = new dJSWin({ 60 71 id: 'ccQuickAddContact_'+div.id, 61 72 content_id: div.id, … … 64 75 title_color: '#3978d6', 65 76 bg_color: '#eee', 66 title: Element('ccQATitle').value, 77 title: Element('ccQATitle').value, 67 78 title_text_color: 'white', 68 79 button_x_img: Element('cc_phpgw_img_dir').value+'/winclose.gif', 69 80 border: true }); 70 81 71 82 this.arrayWin[div.id] = win; 72 win.draw(); 83 win.draw(); 73 84 } 74 85 else { 75 86 win = this.arrayWin[div.id]; 76 } 87 } 77 88 win.open(); 78 89 } 79 90 80 91 cQuickAddContact.prototype.send = function (id) 81 92 { … … 104 115 return; 105 116 } 106 117 107 118 win.close(); 108 119 … … 121 132 } 122 133 } 123 134 124 135 var sdata = new Array(); 125 136 126 137 for (var f = 0; f < 5; f++){ 127 138 sdata[f] = document.getElementById('ccQuickAddCI' + f + id).value; 128 139 } 129 140 130 141 //Utiliza expressão regular para validar email 131 142 var reEmail = /^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/; … … 136 147 return false; 137 148 } 138 149 139 150 //Utiliza expressão regular para validar telefone 140 151 var rePhone = /^[0-9|(-)| |-]{0,15}$/; 141 152 142 153 if (!rePhone.test(sdata[3])){ 143 154 alert("O número de telefone '" + sdata[3] + "' não é valido! Utilize apenas números.\n" + 144 155 "Parenteses, traços ou espaços em branco podem ser usados como carácter separador."); 145 156 return false; 146 } 147 157 } 158 148 159 var sdata = 'add='+escape(serialize(sdata)); 149 160 150 161 Connector.newRequest('cQuickAdd.Send', CC_url+'quick_add', 'POST', handler, sdata); 151 162 } 152 163 153 164 cQuickAddContact.prototype.fechar = function(id) { 154 165 155 166 div = document.getElementById(id+':cc_rectQuickAddContact'); 156 167 win = this.arrayWin[div.id]; 157 168 win.close(); 158 169 } 159 160 170 171 161 172 /* Build the Object */ 162 173 var ccQuickAddContact ; … … 164 175 165 176 if (is_ie) 166 { 167 document.body.onload = function (e) 168 { 177 { 178 document.body.onload = function (e) 179 { 169 180 cQuickAddContact_pre_load(); 170 181 ccQuickAddContact = new cQuickAddContact(); 171 182 172 183 }; 173 184 } -
trunk/contactcenter/js/cc_search.js
r2 r284 60 60 this.DOMinput.value = params['value'] ? params['value'] : ''; 61 61 this.DOMinput.style.width = params['input_width'] ? params['input_width'] : '200px'; 62 this.DOMinput.onkeypress = function (e) { 62 this.DOMinput.onkeypress = function (e) { 63 63 if (is_ie) 64 64 { … … 86 86 if (params['progress_color']) 87 87 this.DOMprogHold.style.color = params['progress_color']; 88 88 89 89 this.DOMresult.style.position = 'absolute'; 90 90 this.DOMresult.style.top = params['progress_top'] ? params['progress_top'] : '0px'; … … 96 96 this.DOMresult.style.color = params['progress_color']; 97 97 98 this.DOMholder.appendChild(this.DOMdiv); 98 this.DOMholder.appendChild(this.DOMdiv); 99 99 this.DOMdiv.appendChild(this.DOMfields); 100 100 this.DOMdiv.appendChild(this.DOMinput); … … 104 104 this.DOMdiv.appendChild(this.DOMresult); 105 105 } 106 106 107 107 ccSearchClass.prototype.go = function() 108 108 { 109 109 var data = new Array(); 110 110 111 111 this.DOMresult.innerHTML = ''; 112 112 113 113 //TODO: Make Generic! 114 114 var type = Element('cc_type_contact').value; 115 115 116 116 data['fields'] = new Array(); 117 117 118 118 if (type == 'groups') { 119 data['fields']['id'] = 'group.id_group'; 119 data['fields']['id'] = 'group.id_group'; 120 120 data['fields']['search'] = 'group.title'; 121 } 122 else { 123 data['fields']['id'] = 'contact.id_contact'; 124 data['fields']['search'] = 'contact.names_ordered'; 125 } 126 121 } 122 else { 123 data['fields']['id'] = 'contact.id_contact'; 124 data['fields']['search'] = 'contact.names_ordered'; 125 } 126 127 127 data['search_for'] = this.DOMinput.value; 128 128 //data['recursive'] = this.recursive.checked ? true : false; 129 129 // Exige que a consulta por nome seja feita com no mínimo 4 caracteres 130 var search_for = data['search_for'].split(' '); 131 var greaterThan4 = false; 132 133 for (i = 0; i < search_for.length; i++) 134 { 135 if (search_for[i].length >= 4) 136 { 137 greaterThan4 = true; 138 } 139 } 140 141 if (!greaterThan4){ 142 alert("Favor fazer a consulta com pelo menos 4 caracteres!"); 143 return; 144 } 145 130 146 var _this = this; 131 147 148 var handler = function (responseText) 149 { 150 var data = new Array(); 151 data = unserialize(responseText); 152 153 ccSearchUpdate(); 154 155 letter = 'search'; 156 157 if ( letter != CC_actual_letter ) 158 { 159 CC_actual_page = '1'; 160 } 161 else 162 { 163 CC_actual_page = parseInt(data[1]); 164 } 165 166 CC_actual_letter = letter; 167 168 if (CC_max_cards[0] == 0) 169 { 170 171 if(CC_visual == 'cards') 172 drawCards(0); 173 else if(CC_visual == 'table') 174 drawTable(0); 175 176 setPages(0,0); 177 return; 178 } 179 180 if (data[0] == '0') 181 { 182 Element('cc_type_contact').value = data[1]; 183 CC_npages = 0; 184 CC_actual_page = 1; 185 if(CC_visual == 'cards') 186 drawCards(0); 187 else if(CC_visual == 'table') 188 drawTable(0); 189 setPages(0,0); 190 return; 191 } 192 else 193 { 194 Element('cc_type_contact').value = data[10]; 195 } 196 197 // Element('cc_debug').innerHTML = responseText; 198 199 if (typeof(data) != 'object') 200 { 201 showMessage(Element('cc_msg_err_contacting_server').value); 202 return; 203 } 204 205 if (typeof(data[3]) == 'object') 206 { 207 CC_npages = parseInt(data[0]); 208 CC_actual_page = parseInt(data[1]); 209 if(CC_visual == 'cards') 210 drawCards(data[3].length, data[10]); 211 else if(CC_visual == 'table') 212 drawTable(data[3].length, data[10]); 213 resizeWindow(); 214 populateCards(data, data[10]); 215 setPages(data[0], data[1]); 216 } 217 else if (data['error']) 218 { 219 showMessage(data['error']); 220 } 221 else 222 { 223 showMessage(Element('cc_msg_err_contacting_server').value); 224 return; 225 } 226 227 228 }; 229 230 231 /* 132 232 var handler = function (responseText) 133 233 { 134 234 Element('cc_debug').innerHTML = responseText; 135 235 136 236 var data = unserialize(responseText); 137 237 138 238 if (!data || !data['status']) 139 239 { … … 147 247 _this.DOMresult.innerHTML = data['msg']; 148 248 setTimeout(function(){_this.DOMresult.innerHTML = '';}, 1000); 149 249 150 250 if (_this.onSearchFinish) 151 251 { … … 163 263 } 164 264 165 //showMessage(data['msg']); 265 // Mostra a mensagem se a busca retornar mais de 300 resultados. 266 if (data['data'].length > 300) 267 { 268 269 TODO: Usar o esquema de tradução do expresso para este alert 270 271 alert("Mais de 300 resultados foram retornados!\n" + 272 "Favor refinar sua busca."); 273 } 166 274 167 275 if (_this.onSearchFinish) … … 170 278 } 171 279 }; 172 173 this.Connector.newRequest('search', CC_url+'search&data='+serialize(data), 'GET', handler); 280 */ 281 var info = "letter="+'search'+"&page="+'1'+"&data="+serialize(data); 282 this.Connector.newRequest('get_cards_data', CC_url+'get_cards_data', 'POST', handler, info); 174 283 } -
trunk/contactcenter/js/cc_tree.js
r56 r284 20 20 throw('dFTree lib must be loaded!'); 21 21 } 22 22 23 23 function ccCatalogTree(params) 24 24 { … … 29 29 30 30 var _tree = this; 31 31 32 32 /* This is the property that holds the Tree Object */ 33 33 this.name = params['name']; … … 39 39 this.Connector = params['connector']; 40 40 41 /* Build the Inicial Tree */ 41 /* Build the Inicial Tree */ 42 42 //this._getActualLevel(); 43 43 setTimeout(function(){ _tree._updateTree('0', true);}, 100); … … 57 57 return; 58 58 } 59 59 60 60 if (data['status'] != 'ok') 61 61 { … … 66 66 67 67 _this.catalog_perms = parseInt(data['perms']); 68 68 69 69 if (_this.afterSetCatalog) 70 70 { … … 75 75 Connector.newRequest(this.name+'catalog', CC_url+'set_catalog&catalog='+catalog, 'GET', handler); 76 76 } 77 77 78 78 ccCatalogTree.prototype.setCatalogSearch = function (catalog) { 79 79 80 80 var _this = this; 81 81 var handler = function (responseText) … … 89 89 return; 90 90 } 91 91 92 92 if (data['status'] != 'ok') 93 93 { … … 100 100 101 101 this.afterSetCatalog = ccEmailWin.search.go(); 102 102 103 103 }; 104 104 105 105 Connector.newRequest(this.name+'catalog', CC_url+'set_catalog&catalog='+catalog, 'GET', handler); 106 106 } 107 108 107 108 109 109 ccCatalogTree.prototype.select = function(level, search) 110 110 { 111 if (!search) { 111 if (!search) { 112 112 this.tree.openTo(level); 113 113 this.tree.getNodeById(level)._select(); 114 114 115 115 if (level != this.actualLevel) 116 116 { … … 129 129 * Methods For Internal Use * 130 130 \*************************************************************************/ 131 131 132 132 ccCatalogTree.prototype._waitForTree = function(level, rlevel) 133 133 { … … 142 142 return; 143 143 } 144 144 145 145 setTimeout(this.name+'._waitForTree(\''+level+'\', '+rlevel+')', 100); 146 146 } … … 176 176 _this.tree.getNodeById(_this.actualLevel)._select(); 177 177 _this.setCatalog(_this.actualLevel); 178 _this.expandTree(); 179 180 } 181 }; 182 178 } 179 }; 180 183 181 Connector.newRequest(this.name+'actual', CC_url+'get_actual_catalog', 'GET', handler); 184 182 } 185 183 186 ccCatalogTree.prototype.expandTree = function() {187 for (i=0; i < this.tree._aNodes.length; i++)188 this._expandSubTree(this.tree._aNodes[i]);189 }190 191 ccCatalogTree.prototype._expandSubTree = function(node) {192 if ( node._children == '' ) {193 return;194 }195 if (node._children != '') {196 for (i = 0; i <= node._children.length; i++) {197 if ( node._io == false )198 node.changeState();199 this._expandSubTree(node._children[i]);200 }201 }202 }203 204 205 184 ccCatalogTree.prototype._updateTree = function(level, open) 206 185 { … … 222 201 { 223 202 showMessage(data['msg']); 224 return; 203 if (data['status'] != 'error') 204 { 205 return; 206 } 225 207 } 226 208 227 209 treeData = data['data']; 228 210 229 211 var timeout = 10; 230 212 var limit = 0; … … 261 243 timeout += 5; 262 244 } 263 245 264 246 _this.treeAvailable = true; 265 247 … … 271 253 } 272 254 }; 255 273 256 Connector.newRequest(this.name+'update', CC_url+'get_catalog_tree&level='+level, 'GET', handler); 274 257 } -
trunk/contactcenter/setup/setup.inc.php
r203 r284 37 37 $setup_info['contactcenter']['hooks'][] = 'preferences'; 38 38 $setup_info['contactcenter']['hooks'][] = 'config_validate'; 39 39 40 40 /* ContactCenter Tables */ 41 41 $setup_info['contactcenter']['tables'][] = 'phpgw_cc_status'; … … 69 69 $setup_info['contactcenter']['tables'][] = 'phpgw_cc_contact_company'; 70 70 $setup_info['contactcenter']['tables'][] = 'phpgw_cc_contact_grps'; 71 71 72 72 $setup_info['contactcenter']['tables'][] = 'phpgw_cc_groups'; 73 73 74 74 /* Dependencies for this app to work */ 75 75 $setup_info['contactcenter']['depends'][] = array( -
trunk/contactcenter/setup/tables_update.inc.php
r203 r284 56 56 return $GLOBALS['setup_info']['contactcenter']['currentver']; 57 57 } 58 $test[] = '1.0.005';59 function contactcenter_upgrade1_0_005() {60 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.14';61 return $GLOBALS['setup_info']['contactcenter']['currentver'];62 }63 $test[] = '1.14';64 function contactcenter_upgrade1_14() {65 $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_connections ALTER COLUMN connection_value TYPE varchar(100)");66 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.150';67 return $GLOBALS['setup_info']['contactcenter']['currentver'];68 }69 $test[] = '1.15';70 function contactcenter_upgrade1_15() {71 $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN last_status char(1) DEFAULT 'N'::bpchar");72 $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN last_update int8 DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision)");73 $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN category character varying(20)");74 75 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.20';76 return $GLOBALS['setup_info']['contactcenter']['currentver'];77 }78 79 58 ?> -
trunk/contactcenter/templates/default/full_add.tpl
r118 r284 13 13 <input id="cc_contact_personal" type="hidden" value="{cc_contact_personal}"> 14 14 <input id="cc_contact_addrs" type="hidden" value="{cc_contact_addrs}"> 15 <input id="cc_contact_conns" type="hidden" value=" {emails_telephones}">15 <input id="cc_contact_conns" type="hidden" value="E-mails e Telefones"> 16 16 <input id="cc_pd_full_name" name="{cc_pd_full_name}" type="hidden"> 17 17 <input id="cc_pd_sex" name="{cc_pd_sex}" type="hidden"> … … 36 36 <tr class="row_on"> 37 37 <td align="right">{cc_pd_alias}:</td> 38 <td align="left" colspan="2"><input id="cc_pd_alias" name="{cc_pd_alias}" type="text" style="width:175px;z-index:-1" value="" maxlength=" "></td>38 <td align="left" colspan="2"><input id="cc_pd_alias" name="{cc_pd_alias}" type="text" style="width:175px;z-index:-1" value="" maxlength="30"></td> 39 39 </tr> 40 40 <tr style="display:none" class="row_off"> … … 139 139 <tbody> 140 140 <tr class="th" width="100%" align="center" height="10px"> 141 <td width="60px" noWrap><input type="radio" name="cc_conn_type" id="cc_conn_type_1" value="Email" onclick="javascript:updateConnFields();"> {email}</td>142 <td width="60px" noWrap><input type="radio" name="cc_conn_type" id="cc_conn_type_2" value="Telefone" onclick="javascript:updateConnFields();"> {telephone}</td>143 <td width="*" align="left"><select style="width:160px" id="cc_conn_type_sel" onchange="javascript:connAddNewLine();"><option value="-1"> {choose_email_telephone}</option></select></td>144 </tr> 145 <tr class="row_off"> 141 <td width="60px" noWrap><input type="radio" name="cc_conn_type" id="cc_conn_type_1" value="Email" onclick="javascript:updateConnFields();">E-mail</td> 142 <td width="60px" noWrap><input type="radio" name="cc_conn_type" id="cc_conn_type_2" value="Telefone" onclick="javascript:updateConnFields();">Telefone</td> 143 <td width="*" align="left"><select style="width:160px" id="cc_conn_type_sel" onchange="javascript:connAddNewLine();"><option value="-1">Escolha 'Email' ou 'Telefone'</option></select></td> 144 </tr> 145 <tr class="row_off"> 146 146 <td valign="top" colspan="4" width="100%" style="border: 0px solid black" cellpadding="0" cellspacing="0"> 147 147 <table align="left" width="100%" style="border: 0px solid black"> 148 148 <tbody id="cc_conn"> 149 149 <!-- Code inside here is inserted dynamically --> 150 </tbody> 150 </tbody> 151 151 </table> 152 152 </td> … … 159 159 </tbody> 160 160 </table> 161 <div style="z-index:10000;position: absolute;display:none; top: 170px; left: 78px;" id="div_cc_conn_is_default"> {cc_default} <select id="cc_email_default" name="cc_email_default" disabled style="display:none"></select><select id="cc_phone_default" name="cc_phone_default" disabled style="display:none"></select></div>161 <div style="z-index:10000;position: absolute;display:none; top: 170px; left: 78px;" id="div_cc_conn_is_default">É padrão: <select id="cc_email_default" name="cc_email_default" disabled style="display:none"></select><select id="cc_phone_default" name="cc_phone_default" disabled style="display:none"></select></div> 162 162 </div> 163 163 <!-- _BOTTOM BUTTONS --> 164 <div align="center" id="cc_contact_tab_buttons" style="position: absolute; visibility: hidden; top: 250px; left: 0px; width: 498px; height: 32px; border: 0px solid black"> 164 <div align="center" id="cc_contact_tab_buttons" style="position: absolute; visibility: hidden; top: 250px; left: 0px; width: 498px; height: 32px; border: 0px solid black"> 165 165 <table class="row_off" align="center" width="498px" cellpadding="2" cellspacing="0" border="0"> 166 166 <tr> … … 177 177 <!-- 178 178 // Overloading some methods for fix cursor problem in Firefox. 179 if(!is_ie) { 180 dJSWin.prototype.close = function() { 179 if(!is_ie) { 180 dJSWin.prototype.close = function() { 181 181 dJSWin.state = 0; 182 182 dd.elements[this.title.id].hide(); 183 Element("divScrollMain").style.overflow = 'auto'; 183 Element("divScrollMain").style.overflow = 'auto'; 184 184 } 185 185 dJSWin.prototype.open = function() { … … 190 190 Element("divScrollMain").style.overflow = 'hidden'; 191 191 } 192 } 193 192 } 193 194 194 var fullAdd_onload = document.body.onload; 195 195 var tabs; 196 196 var fullAddWin; 197 var photo_frame, photo_form, photo_input; 197 var photo_frame, photo_form, photo_input; 198 198 199 199 __f = function(e) 200 200 { 201 201 202 202 tabs = new dTabsManager({'id': 'cc_contact_tab', 'width': '500px'}); 203 204 tabs.addTab({'id': 'cc_contact_tab_0', 205 'name': Element('cc_contact_personal').value, 206 'selectedClass': 'tab_box_active', 203 204 tabs.addTab({'id': 'cc_contact_tab_0', 205 'name': Element('cc_contact_personal').value, 206 'selectedClass': 'tab_box_active', 207 207 'unselectedClass': 'tab_box'}); 208 209 tabs.addTab({'id': 'cc_contact_tab_2', 210 'name': Element('cc_contact_conns').value, 211 'selectedClass': 'tab_box_active', 208 209 tabs.addTab({'id': 'cc_contact_tab_2', 210 'name': Element('cc_contact_conns').value, 211 'selectedClass': 'tab_box_active', 212 212 'unselectedClass': 'tab_box'}); 213 213 214 tabs.addTab({'id': 'cc_contact_tab_1', 215 'name': Element('cc_contact_addrs').value, 216 'selectedClass': 'tab_box_active', 217 'unselectedClass': 'tab_box'}); 214 tabs.addTab({'id': 'cc_contact_tab_1', 215 'name': Element('cc_contact_addrs').value, 216 'selectedClass': 'tab_box_active', 217 'unselectedClass': 'tab_box'}); 218 218 219 219 fullAddWin = new dJSWin({'id': 'cc_full_add', … … 229 229 'border': true}); 230 230 231 fullAddWin.draw(); 232 231 fullAddWin.draw(); 232 233 233 if (is_ie) 234 234 { … … 242 242 { 243 243 Element('cc_pd_select_photo_t').style.display='none'; 244 Element('cc_pd_select_photo_b').style.display='none'; 245 } 246 244 Element('cc_pd_select_photo_b').style.display='none'; 245 } 246 247 247 }; 248 248 249 249 if (is_ie) // || is_moz1_6) 250 250 { 251 251 252 252 document.body.onload = function(e) { setTimeout('__f()', 10); fullAdd_onload ? setTimeout('fullAdd_onload()'): false;}; 253 253 } … … 270 270 271 271 272 <!-- RELATIONS 272 <!-- RELATIONS 273 273 <div id="cc_contact_tab_3" class="row_off div_cc_contact_tab"> 274 274 <table align="center" width="500px" height="100%" cellpadding="2" cellspacing="0" border="0"> -
trunk/contactcenter/templates/default/index.tpl
r270 r284 1 1 <link rel="stylesheet" type="text/css" href="{cc_css}"> 2 <style> 2 <style> 3 3 .special{ 4 4 cursor:pointer; 5 5 cursor:hand; 6 position:relative; 7 top:0px; 6 position:relative; 7 top:0px; 8 8 left:0px; 9 color: #006699; 9 color: #006699; 10 10 background-color:#DCDCDC; 11 11 } … … 15 15 <input id="cc_msg_no_cards" type="hidden" value="{cc_msg_no_cards}"> 16 16 <input id="cc_msg_err_no_room" type="hidden" value="{cc_msg_err_no_room}"> 17 17 18 <input id="cc_root_dir" type="hidden" value="{cc_root_dir}"> 18 19 <input id="cc_msg_card_new" type="hidden" value="{cc_msg_card_new}"> … … 24 25 <input id="cc_msg_card_remove_confirm" type="hidden" value="{cc_msg_card_remove_confirm}"> 25 26 <input id="cc_send_mail" type="hidden" value="{cc_send_mail}"> 26 <input id="cc_msg_group_edit" type="hidden" value="{cc_msg_group_edit}"> 27 <input id="cc_msg_group_edit" type="hidden" value="{cc_msg_group_edit}"> 27 28 <input id="cc_msg_group_remove" type="hidden" value="{cc_msg_group_remove}"> 28 29 <input id="cc_msg_group_remove_confirm" type="hidden" value="{cc_msg_group_remove_confirm}"> 29 30 <input id="cc_panel_search_text" type="hidden" value="{cc_panel_search}" style="cursor: pointer; cursor: hand;" onclick="javascript:ccSearch()" /> 30 <input id="cc_msg_close_win" type="hidden" value="{cc_msg_close_win}">31 <input id="cc_msg_import_contacts" type="hidden" value="{cc_msg_import_contacts}">32 <input id="cc_msg_export_contacts" type="hidden" value="{cc_msg_export_contacts}">33 <input id="cc_msg_expresso_info_csv" type="hidden" value="{cc_msg_expresso_info_csv}">34 <input id="cc_msg_choose_file_type" type="hidden" value="{cc_msg_choose_file_type}">35 <input id="cc_msg_outlook_express" type="hidden" value="{cc_msg_outlook_express}">36 <input id="cc_msg_outlook2k" type="hidden" value="{cc_msg_outlook2k}">37 <input id="cc_msg_expresso_default" type="hidden" value="{cc_msg_expresso_default}">38 <input id="cc_msg_choose_contacts_file" type="hidden" value="{cc_msg_choose_contacts_file}">39 <input id="cc_msg_close" type="hidden" value="{cc_msg_close}">40 <input id="cc_msg_ie_personal" type="hidden" value="{cc_msg_ie_personal}">41 <input id="cc_msg_import_fail" type="hidden" value="{cc_msg_import_fail}">42 <input id="cc_msg_export_csv" type="hidden" value="{cc_msg_export_csv}">43 <input id="cc_msg_automatic" type="hidden" value="{cc_msg_automatic}">44 <input id="cc_msg_importing_contacts" type="hidden" value="{cc_msg_importing_contacts}">45 <input id="cc_msg_import_finished" type="hidden" value="{cc_msg_import_finished}">46 <input id="cc_msg_invalid_csv" type="hidden" value="{cc_msg_invalid_csv}">47 <input id="cc_msg_new" type="hidden" value="{cc_msg_new}">48 <input id="cc_msg_failure" type="hidden" value="{cc_msg_failure}">49 <input id="cc_msg_exists" type="hidden" value="{cc_msg_exists}">50 <input id="cc_msg_show_more_info" type="hidden" value="{cc_msg_show_more_info}">51 <input id="cc_msg_clean" type="hidden" value="{cc_msg_clean}">52 <input id="cc_msg_choose_valid_csv" type="hidden" value="{cc_msg_choose_valid_csv}">53 <input id="cc_msg_export_error" type="hidden" value="{cc_msg_export_error}">54 <input id="cc_msg_new_email" type="hidden" value="{cc_msg_new_email}">55 <input id="cc_msg_main" type="hidden" value="{cc_msg_main}">56 <input id="cc_msg_alternative" type="hidden" value="{cc_msg_alternative}">57 <input id="cc_msg_select_email" type="hidden" value="{cc_msg_select_email}">58 <input id="cc_msg_new_phone" type="hidden" value="{cc_msg_new_phone}">59 <input id="cc_msg_home" type="hidden" value="{cc_msg_home}">60 <input id="cc_msg_cellphone" type="hidden" value="{cc_msg_cellphone}">61 <input id="cc_msg_work" type="hidden" value="{cc_msg_work}">62 <input id="cc_msg_fax" type="hidden" value="{cc_msg_fax}">63 <input id="cc_msg_pager" type="hidden" value="{cc_msg_pager}">64 <input id="cc_msg_choose_phone" type="hidden" value="{cc_msg_choose_phone}">65 <input id="cc_msg_warn_firefox" type="hidden" value="{cc_msg_warn_firefox}">66 <input id="cc_msg_firefox_half1" type="hidden" value="{cc_msg_firefox_half1}">67 <input id="cc_msg_firefox_half2" type="hidden" value="{cc_msg_firefox_half2}">68 <input id="cc_msg_click_close" type="hidden" value="{cc_msg_click_close}">69 <input id="cc_msg_install_now" type="hidden" value="{cc_msg_install_now}">70 <input id="cc_msg_install_new_firefox" type="hidden" value="{cc_msg_install_new_firefox}">71 <input id="cc_msg_outlook_express_pt" type="hidden" value="{cc_msg_outlook_express_pt}">72 <input id="cc_msg_outlook_express_en" type="hidden" value="{cc_msg_outlook_express_en}">73 <input id="cc_msg_outlook_2k_pt" type="hidden" value="{cc_msg_outlook_2k_pt}">74 <input id="cc_msg_outlook_2k_en" type="hidden" value="{cc_msg_outlook_2k_en}">75 <input id="cc_msg_moz_thunderbird" type="hidden" value="{cc_msg_moz_thunderbird}">76 <input id="cc_msg_expresso_default_csv" type="hidden" value="{cc_msg_expresso_default_csv}">77 <input id="cc_msg_copy_to_catalog" type="hidden" value="{cc_msg_copy_to_catalog}">78 <input id="cc_msg_fill_field_name" type="hidden" value="{cc_msg_fill_field_name}">79 <input id="cc_msg_add_contact_to_group" type="hidden" value="{cc_msg_add_contact_to_group}">80 81 82 31 <!-- END JS MESSAGES --> 83 32 <input id="cc_type_contact" type="hidden"> 84 33 <input id="cc_participants" type="hidden" value="{cc_participants}"> 85 34 86 35 <input id="cc_qa_alias" type="hidden" value="{cc_qa_alias}"> 87 36 <input id="cc_qa_given_names" type="hidden" value="{cc_qa_given_names}"> … … 89 38 <input id="cc_qa_phone" type="hidden" value="{cc_qa_phone}"> 90 39 <input id="cc_qa_email" type="hidden" value="{cc_qa_email}"> 91 40 92 41 <input id="cc_qa_save" type="hidden" value="{cc_qa_save}"> 93 <input id="cc_qa_cl ose" type="hidden" value="{cc_qa_close}">94 42 <input id="cc_qa_clear" type="hidden" value="{cc_qa_clear}"> 43 95 44 <input id="cc_empty" type="hidden" value="{cc_empty}"> 96 45 <!-- VIEW CARDS --> … … 104 53 </tr> 105 54 <tr> 106 <td width="150px" height="100%" align="left" valign="top"> 55 <td width="150px" height="100%" align="left" valign="top"> 107 56 <div id="cc_tree" style="overflow:auto;position:relative; width: 150px;border: 0px solid #999;"></div> 108 57 </td> … … 126 75 </tr>--> 127 76 <tr align="left"> 128 <td align="left"> 129 <input id="cc_button_new" onMouseOver="if(!menuStarted) menu();menu.onmouseover()" onMouseOut="menu.onmouseout()" value=" {cc_btn_new}" type="button">77 <td align="left"> 78 <input id="cc_button_new" onMouseOver="if(!menuStarted) menu();menu.onmouseover()" onMouseOut="menu.onmouseout()" value="Novo ..." type="button"> 130 79 <div id="cc_panel_search_call" style="display: inline"></div> 131 80 <div id="cc_panel_table" style="display: none; text-align: right"> … … 133 82 </div> 134 83 <div id="cc_panel_cards" style="display: inline; text-align: right"> 135 <input type="button" value="{cc_panel_cards}" class="tab_box" style="cursor: pointer; cursor: hand;" onclick="javascript: ccChangeVisualization('cards')" /> 84 <input type="button" value="{cc_panel_cards}" class="tab_box" style="cursor: pointer; cursor: hand;" onclick="javascript: ccChangeVisualization('cards')" /> 136 85 </div> 137 86 </td> 138 87 <td align="right"> 139 <input id="cc_button_tools" value=" {cc_btn_import_export}" type="button" onclick="javascript:ccIEContacts.showList()">88 <input id="cc_button_tools" value="Importar | Exportar" type="button" onclick="javascript:ccIEContacts.showList()"> 140 89 </td> 141 90 </tr> … … 223 172 <td align="left" valign="middle"><span id="cc_panel_arrow_last"><img src="templates/default/images/last-grey.png" border="0" alt="{cc_panel_last_page}" hspace="2" /></span></td> 224 173 </tr> 225 </table> 174 </table> 226 175 </td> 227 176 </tr> … … 230 179 </tr> 231 180 <!-- ___END PANEL --> 232 <!-- __CARDS --> 181 <!-- __CARDS --> 233 182 <tr> 234 183 <td style="border: 0px solid #666;" id="cc_card_space" width="100%" height="auto" valign="top" align="center" colspan="4"></td> 235 </tr> 184 </tr> 236 185 <!-- __END CARDS --> 237 186 </table> … … 248 197 <script type="text/javascript" src="js/ccIEContacts.js"></script> 249 198 <script type="text/javascript" src="js/ccMain.js"></script> 250 <!-- END BOTTOM DETAILS--> 199 <!-- END BOTTOM DETAILS-->
Note: See TracChangeset
for help on using the changeset viewer.