[2] | 1 | /******************************************************************************\ |
---|
| 2 | * eGroupWare - Contacts Center * |
---|
| 3 | * http://www.egroupware.org * |
---|
| 4 | * Written by: * |
---|
| 5 | * - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> * |
---|
| 6 | * - Jonas Goes <jqhcb@users.sourceforge.net> * |
---|
| 7 | * sponsored by Thyamad - http://www.thyamad.com * |
---|
| 8 | * ------------------------------------------------------------------------- * |
---|
| 9 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 10 | * under the terms of the GNU General Public License as published by the * |
---|
| 11 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 12 | * option) any later version. * |
---|
| 13 | \******************************************************************************/ |
---|
| 14 | |
---|
| 15 | /***********************************************\ |
---|
| 16 | * TODO * |
---|
| 17 | \***********************************************/ |
---|
| 18 | |
---|
| 19 | /* |
---|
| 20 | * function setHeightSpace () |
---|
| 21 | * |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | /***********************************************\ |
---|
| 25 | * CONSTANTS * |
---|
| 26 | \***********************************************/ |
---|
| 27 | |
---|
| 28 | var CC_STATUS_FULL_ADD = 2; |
---|
| 29 | var CC_STATUS_QUICK_ADD = 1; |
---|
| 30 | |
---|
| 31 | var CC_card_image_width = 245; |
---|
| 32 | var CC_card_image_height = 130; |
---|
| 33 | var CC_card_extra = 16; |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | /***********************************************\ |
---|
| 37 | * GLOBALS VARIABLES * |
---|
| 38 | \***********************************************/ |
---|
| 39 | |
---|
[1496] | 40 | var owners = new Array(); |
---|
| 41 | var flag_compartilhado = false; |
---|
| 42 | var qtd_compartilhado = 0; |
---|
| 43 | |
---|
[2] | 44 | var CC_visual = 'table'; |
---|
| 45 | /* Cards Variables */ |
---|
| 46 | var CC_actual_letter = 'a'; |
---|
| 47 | var CC_last_letter = 'a'; |
---|
| 48 | var CC_actual_page = 1; |
---|
| 49 | var CC_npages = 0; |
---|
| 50 | var CC_max_cards = new Array(); |
---|
| 51 | var CC_conn_count=0; |
---|
| 52 | |
---|
| 53 | var CC_old_icon_w = 0; |
---|
| 54 | var CC_old_icon_h = 0; |
---|
| 55 | |
---|
| 56 | /* Tabs Variables */ |
---|
| 57 | var CC_last_tab = 0; |
---|
| 58 | |
---|
| 59 | /* Pseudo-Semafores */ |
---|
| 60 | var CC_tree_available = false; |
---|
| 61 | var CC_full_add_const = false; |
---|
| 62 | var CC_full_add_photo = false; |
---|
[1599] | 63 | |
---|
[2] | 64 | var CC_last_height = window.innerHeight; |
---|
| 65 | var CC_last_width = window.innerWidth; |
---|
| 66 | |
---|
| 67 | /* Contact Full Info */ |
---|
| 68 | var CC_contact_full_info; |
---|
| 69 | var CC_br_index; |
---|
| 70 | |
---|
| 71 | /* Addresses Variables */ |
---|
| 72 | var CC_addr_last_selected = 0; |
---|
| 73 | |
---|
| 74 | /* Connections Variables */ |
---|
| 75 | var CC_conn_last_selected = 0; |
---|
| 76 | |
---|
[4498] | 77 | /* Grupos inicialmente selecionados */ |
---|
| 78 | var CC_initial_selected_grps = new Array(); |
---|
| 79 | |
---|
[2] | 80 | /***********************************************\ |
---|
| 81 | * FULL ADD/EDIT FUNCTIONS * |
---|
| 82 | \***********************************************/ |
---|
| 83 | |
---|
| 84 | function createPhotoFrame() |
---|
| 85 | { |
---|
| 86 | photo_frame = document.createElement('iframe'); |
---|
| 87 | document.body.appendChild(photo_frame); |
---|
| 88 | |
---|
| 89 | if (is_ie) |
---|
| 90 | { |
---|
| 91 | photo_form = photo_frame.contentWindow.document.createElement('form'); |
---|
| 92 | photo_input = photo_frame.contentWindow.document.createElement('input'); |
---|
| 93 | } |
---|
| 94 | else |
---|
| 95 | { |
---|
| 96 | photo_form = photo_frame.contentDocument.createElement('form'); |
---|
| 97 | photo_input = photo_frame.contentDocument.createElement('input'); |
---|
| 98 | } |
---|
[1599] | 99 | |
---|
[2] | 100 | photo_frame.id = 'cc_photo_frame'; |
---|
| 101 | photo_frame.style.position = 'absolute'; |
---|
| 102 | //photo_frame.style.visibility = 'hidden'; |
---|
| 103 | photo_frame.style.top = '600px'; |
---|
| 104 | photo_frame.style.left = '0px'; |
---|
[1599] | 105 | |
---|
[2] | 106 | photo_form.id = 'cc_photo_form'; |
---|
| 107 | photo_form.method = 'POST'; |
---|
| 108 | photo_form.enctype = 'multipart/form-data'; |
---|
[1599] | 109 | |
---|
[2] | 110 | photo_input.id = 'cc_photo_input'; |
---|
| 111 | photo_input.type = 'file'; |
---|
[1599] | 112 | |
---|
[2] | 113 | if (is_ie) |
---|
| 114 | { |
---|
| 115 | photo_frame.contentWindow.document.body.appendChild(photo_form); |
---|
| 116 | } |
---|
| 117 | else |
---|
| 118 | { |
---|
| 119 | photo_frame.contentDocument.body.appendChild(photo_form); |
---|
| 120 | } |
---|
| 121 | photo_form.appendChild(photo_input); |
---|
[1599] | 122 | |
---|
[2] | 123 | } |
---|
| 124 | |
---|
| 125 | /********* Full Add Auxiliar Functions ****************/ |
---|
| 126 | function selectOption (id, option) |
---|
| 127 | { |
---|
| 128 | var obj = Element(id); |
---|
| 129 | var max = obj.options.length; |
---|
[1599] | 130 | |
---|
[2] | 131 | if (option == undefined) |
---|
| 132 | { |
---|
| 133 | obj.selectedIndex = 0; |
---|
| 134 | } |
---|
| 135 | else |
---|
| 136 | { |
---|
| 137 | for (var i = 0; i < max; i++) |
---|
| 138 | { |
---|
| 139 | if (obj.options[i].value == option) |
---|
| 140 | { |
---|
| 141 | obj.selectedIndex = i; |
---|
| 142 | break; |
---|
| 143 | } |
---|
| 144 | } |
---|
| 145 | } |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | function selectRadio (id, index) |
---|
| 149 | { |
---|
| 150 | var obj = Element(id); |
---|
| 151 | var max = obj.options.length; |
---|
| 152 | for (var i = 0; i < max; i++) |
---|
| 153 | { |
---|
| 154 | i == index ? obj.options[i].checked = true : obj.options[i].checked = false; |
---|
| 155 | } |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | function clearSelectBox(obj, startIndex) |
---|
| 159 | { |
---|
| 160 | var nOptions = obj.options.length; |
---|
| 161 | |
---|
| 162 | for (var i = nOptions - 1; i >= startIndex; i--) |
---|
| 163 | { |
---|
| 164 | obj.removeChild(obj.options[i]); |
---|
| 165 | } |
---|
| 166 | } |
---|
| 167 | /********** Open/Close FullAdd *************/ |
---|
| 168 | function openFullAdd(){ |
---|
| 169 | // Build the FullAdd Window. |
---|
[1599] | 170 | if(!fullAddWin && !is_ie) |
---|
[2] | 171 | __f(); |
---|
| 172 | |
---|
| 173 | resetFullAdd(); |
---|
| 174 | populateFullAddConst(); |
---|
| 175 | fullAddWin.open(); |
---|
| 176 | tabs._showTab('cc_contact_tab_0'); |
---|
[1599] | 177 | Element("cc_conn_type_1").checked = false; |
---|
[2] | 178 | Element("cc_conn_type_2").checked = false; |
---|
| 179 | Element("cc_conn_type_sel").disabled = true; |
---|
| 180 | Element("cc_conn_type_sel").selectedIndex = 0; |
---|
[1496] | 181 | Element("cc_contact_sharing").style.display = 'none'; |
---|
[2] | 182 | } |
---|
| 183 | |
---|
[1496] | 184 | function openFullAddShared(){ |
---|
| 185 | if (flag_compartilhado) |
---|
| 186 | { |
---|
| 187 | if(!fullAddWin && !is_ie) |
---|
| 188 | __f(); |
---|
| 189 | |
---|
| 190 | resetFullAdd(); |
---|
| 191 | populateFullAddConst(); |
---|
| 192 | fullAddWin.open(); |
---|
| 193 | tabs._showTab('cc_contact_tab_0'); |
---|
| 194 | Element("cc_conn_type_1").checked = false; |
---|
| 195 | Element("cc_conn_type_2").checked = false; |
---|
| 196 | Element("cc_conn_type_sel").disabled = true; |
---|
| 197 | Element("cc_conn_type_sel").selectedIndex = 0; |
---|
| 198 | Element("cc_contact_sharing").align = 'center'; |
---|
| 199 | Element("cc_contact_sharing").style.display = 'block'; |
---|
| 200 | Element("cc_contact_shared_types").disabled = true; |
---|
| 201 | populateSharingSelect(); |
---|
| 202 | } else |
---|
| 203 | { |
---|
| 204 | if(qtd_compartilhado != 0) |
---|
| 205 | { |
---|
| 206 | ccTree.select(0.2); |
---|
| 207 | ccTree.setCatalog(0.2); |
---|
| 208 | if(!fullAddWin && !is_ie) |
---|
| 209 | __f(); |
---|
| 210 | resetFullAdd(); |
---|
| 211 | populateFullAddConst(); |
---|
| 212 | fullAddWin.open(); |
---|
| 213 | tabs._showTab('cc_contact_tab_0'); |
---|
| 214 | Element("cc_conn_type_1").checked = false; |
---|
| 215 | Element("cc_conn_type_2").checked = false; |
---|
| 216 | Element("cc_conn_type_sel").disabled = true; |
---|
| 217 | Element("cc_conn_type_sel").selectedIndex = 0; |
---|
| 218 | Element("cc_contact_sharing").aling = 'center'; |
---|
| 219 | Element("cc_contact_sharing").style.display = 'block'; |
---|
| 220 | Element("cc_contact_shared_types").disabled = true; |
---|
| 221 | populateSharingSelect(); |
---|
| 222 | } else |
---|
| 223 | showMessage(Element('cc_msg_err_shared').value); |
---|
| 224 | } |
---|
| 225 | } |
---|
| 226 | |
---|
[2] | 227 | function closeFullAdd(){ |
---|
| 228 | fullAddWin.close(); |
---|
| 229 | } |
---|
[4500] | 230 | /******** Contact details ***********/ |
---|
| 231 | function openContactDetails(id){ |
---|
| 232 | // Build the ContactDetails Window. |
---|
| 233 | if(!contactdetailsWin && !is_ie) |
---|
| 234 | __cdWin(); |
---|
| 235 | |
---|
| 236 | contactdetailsWin.open(); |
---|
| 237 | |
---|
| 238 | populateContactDetails(id); |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | function populateContactDetails(id) |
---|
| 242 | { |
---|
| 243 | var handler = function(responseText) |
---|
| 244 | { |
---|
| 245 | var fieldsDiv = Element('id_cc_contact_details_fields'); |
---|
| 246 | var data = unserialize(responseText); |
---|
| 247 | //alert(responseText); |
---|
| 248 | fieldsDiv.innerHTML = ""; |
---|
| 249 | if (data && data.length > 0) |
---|
| 250 | { |
---|
| 251 | //fieldsDiv.innerHTML = ""; |
---|
| 252 | var table = document.createElement("table"); |
---|
| 253 | table.border=0; |
---|
| 254 | //table.style.borderBottom = '1px solid #999'; |
---|
| 255 | //table.cellSpacing = '0'; |
---|
| 256 | table.width = '480px'; |
---|
| 257 | var attr_name_size = '50%'; |
---|
| 258 | var attr_value_size = '50%'; |
---|
| 259 | for(i = 0; i < data.length; i++) |
---|
| 260 | { |
---|
| 261 | var row = table.insertRow(i); |
---|
| 262 | if ((i % 2) == 0) |
---|
| 263 | row.setAttribute('class', 'row_off'); |
---|
| 264 | else |
---|
| 265 | row.setAttribute('class', 'row_on'); |
---|
| 266 | //row.style.borderBottom = '1px solid #999'; |
---|
| 267 | attr_name = row.insertCell(0); |
---|
| 268 | attr_value = row.insertCell(1); |
---|
| 269 | attr_name.style.width = attr_name_size; |
---|
| 270 | attr_value.style.width = attr_value_size; |
---|
| 271 | attr_name.innerHTML = data[i]['name']; |
---|
| 272 | if (data[i]['type'] == 'text') |
---|
| 273 | attr_value.innerHTML = data[i]['value']; |
---|
| 274 | else |
---|
| 275 | { |
---|
| 276 | var multivalue_div = document.createElement("div"); |
---|
| 277 | multivalue_div.style.overflow = 'auto'; |
---|
| 278 | multivalue_div.style.height = '100px'; |
---|
| 279 | multivalue_div.style.border = '1px solid #999'; |
---|
| 280 | //multivalue_div.style.backgroundColor = 'transparent'; |
---|
| 281 | for (j = 0; j < data[i]['value'].length; j++) |
---|
| 282 | { |
---|
| 283 | multivalue_div.appendChild(document.createTextNode(data[i]['value'][j])); |
---|
| 284 | multivalue_div.appendChild(document.createElement("br")); |
---|
| 285 | } |
---|
| 286 | attr_value.appendChild(multivalue_div); |
---|
| 287 | } |
---|
| 288 | } |
---|
| 289 | fieldsDiv.appendChild(table); |
---|
| 290 | } |
---|
| 291 | else |
---|
| 292 | fieldsDiv.innerHTML = Element('cc_contact_details_no_fields').value; |
---|
| 293 | }; |
---|
| 294 | Connector.newRequest('populateContactDetails', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_contact_details&id=' + id, 'GET', handler); |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | function closeContactDetails(){ |
---|
| 298 | contactdetailsWin.close(); |
---|
| 299 | } |
---|
[2] | 300 | /********** New Contact *************/ |
---|
| 301 | function newContact(){ |
---|
| 302 | openFullAdd(); |
---|
| 303 | } |
---|
[1496] | 304 | function newSharedContact(){ |
---|
| 305 | openFullAddShared(); |
---|
| 306 | } |
---|
[2] | 307 | /************ Edit Contact *************/ |
---|
| 308 | function editContact (id){ |
---|
| 309 | openFullAdd(); |
---|
[503] | 310 | populateFullEdit(id,'bo_people_catalog'); |
---|
[2] | 311 | } |
---|
[503] | 312 | function editSharedContact (id){ |
---|
| 313 | openFullAdd(); |
---|
[752] | 314 | populateFullEdit(id,'bo_shared_people_manager'); |
---|
[503] | 315 | } |
---|
[2] | 316 | /************ Edit Group *************/ |
---|
| 317 | function editGroup(id){ |
---|
[1599] | 318 | populateEditGroup(id); |
---|
| 319 | ccAddGroup.window.open(); |
---|
[2] | 320 | } |
---|
[752] | 321 | |
---|
[1280] | 322 | function editSharedGroup(id,shared){ |
---|
| 323 | populateEditSharedGroup(id, shared); |
---|
[752] | 324 | } |
---|
| 325 | |
---|
[2] | 326 | /* |
---|
| 327 | Updates all the constant fields in the |
---|
| 328 | full add window, like Prefixes, Suffixes, |
---|
[1599] | 329 | Countries and Types |
---|
[2] | 330 | */ |
---|
[1496] | 331 | |
---|
| 332 | function populateSharingSelect() |
---|
| 333 | { |
---|
| 334 | var handler = function(responseText) |
---|
| 335 | { |
---|
[3335] | 336 | var data = unserialize(responseText); |
---|
| 337 | var sharers = Element('cc_contact_shared_types'); |
---|
[1496] | 338 | |
---|
| 339 | if (typeof(data) != 'object') |
---|
[3335] | 340 | { |
---|
| 341 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 342 | fullAddWin.close(); |
---|
| 343 | return; |
---|
| 344 | }else{ |
---|
| 345 | sharers.disabled = false; |
---|
| 346 | j = 1; |
---|
| 347 | for (var i in data) |
---|
[1496] | 348 | { |
---|
[3335] | 349 | sharers.options[j] = new Option(data[i]['cn'], i); |
---|
| 350 | owners[j] = i; |
---|
| 351 | j++; |
---|
[1496] | 352 | } |
---|
[3335] | 353 | return; |
---|
| 354 | } |
---|
[1496] | 355 | }; |
---|
[3335] | 356 | Connector.newRequest('populateSharingSelect', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_list_owners_perms_add', 'POST', handler); |
---|
[1496] | 357 | } |
---|
| 358 | |
---|
[2] | 359 | function populateFullAddConst() |
---|
| 360 | { |
---|
| 361 | CC_full_add_const = false; |
---|
[1599] | 362 | |
---|
[2] | 363 | setTimeout('populateFullAddConstAsync()', 10); |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | function populateFullAddConstAsync() |
---|
| 367 | { |
---|
| 368 | var handler = function(responseText) |
---|
| 369 | { |
---|
[1599] | 370 | //Element('cc_debug').innerHTML = responseText; |
---|
[2] | 371 | var data = unserialize(responseText); |
---|
| 372 | var i = 1; |
---|
| 373 | var j; |
---|
[1599] | 374 | |
---|
[2] | 375 | if (typeof(data) != 'object') |
---|
| 376 | { |
---|
| 377 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 378 | return; |
---|
| 379 | } |
---|
[1599] | 380 | |
---|
[2] | 381 | /* Populate Prefixes */ |
---|
| 382 | for (j in data[0]) |
---|
| 383 | { |
---|
| 384 | Element('cc_pd_prefix').options[i] = new Option(data[0][j], j); |
---|
| 385 | i++; |
---|
| 386 | } |
---|
[1599] | 387 | |
---|
[2] | 388 | /* Populate Suffixes */ |
---|
| 389 | i = 1; |
---|
| 390 | for (j in data[1]) |
---|
| 391 | { |
---|
| 392 | Element('cc_pd_suffix').options[i] = new Option(data[1][j], j); |
---|
| 393 | i++; |
---|
| 394 | } |
---|
| 395 | |
---|
| 396 | /* Populate Addresses Types */ |
---|
| 397 | i = 1; |
---|
| 398 | for (j in data[2]) |
---|
| 399 | { |
---|
| 400 | Element('cc_addr_types').options[i] = new Option(data[2][j], j); |
---|
| 401 | i++; |
---|
| 402 | } |
---|
| 403 | |
---|
| 404 | /* Populate Countries */ |
---|
| 405 | i = 1; |
---|
| 406 | for (j in data[3]) |
---|
| 407 | { |
---|
| 408 | Element('cc_addr_countries').options[i] = new Option(data[3][j], j); |
---|
[1599] | 409 | |
---|
[2] | 410 | if (j == 'BR' || j == 'br') |
---|
| 411 | { |
---|
| 412 | CC_br_index = i; |
---|
| 413 | } |
---|
[1599] | 414 | |
---|
[2] | 415 | i++; |
---|
| 416 | } |
---|
[1599] | 417 | |
---|
[2] | 418 | /* Populate Connection Types */ |
---|
[4498] | 419 | /* |
---|
| 420 | * Código não funcional com o expresso. |
---|
| 421 | */ |
---|
| 422 | /*i = 1; |
---|
[2] | 423 | for (j in data[4]) |
---|
| 424 | { |
---|
| 425 | Element('cc_conn_type').options[i] = new Option(data[4][j], j); |
---|
| 426 | i++; |
---|
[4498] | 427 | }*/ |
---|
| 428 | |
---|
[2] | 429 | /* Populate Relations Types */ |
---|
[4498] | 430 | /* |
---|
| 431 | * Código conflitante com a modificação de seleção de grupos durante |
---|
| 432 | * a criação de um novo contato. Também foi verificado que este código não |
---|
| 433 | * é funcional. |
---|
| 434 | */ |
---|
| 435 | /* |
---|
[2] | 436 | i = 0; |
---|
| 437 | for (j in data[5]) |
---|
| 438 | { |
---|
| 439 | Element('cc_rels_type').options[i] = new Option(data[5][j], j); |
---|
| 440 | i++; |
---|
[4498] | 441 | }*/ |
---|
| 442 | |
---|
| 443 | /* Populate available groups */ |
---|
| 444 | i = 0; |
---|
| 445 | var grupos = data[5]; |
---|
| 446 | for (var grupo in grupos) |
---|
| 447 | { |
---|
| 448 | Element('id_grps_available').options[i] = new Option(grupos[grupo]['title'], grupos[grupo]['id_group']); |
---|
| 449 | i++; |
---|
[2] | 450 | } |
---|
[1599] | 451 | |
---|
[2] | 452 | CC_full_add_const = true; |
---|
| 453 | |
---|
| 454 | }; |
---|
| 455 | |
---|
| 456 | Connector.newRequest('populateFullAddConst', CC_url+'get_contact_full_add_const', 'GET', handler); |
---|
| 457 | } |
---|
| 458 | |
---|
[4498] | 459 | /* |
---|
| 460 | * Função que faz a seleção do grupo. |
---|
| 461 | * Autor: Luiz Carlos Viana Melo - Prognus |
---|
| 462 | */ |
---|
| 463 | function selectGroup() |
---|
| 464 | { |
---|
| 465 | grps_avail = Element('id_grps_available'); |
---|
| 466 | grps_selec = Element('id_grps_selected'); |
---|
| 467 | |
---|
| 468 | for (i = 0; i < grps_avail.length; i++) |
---|
| 469 | { |
---|
| 470 | if (grps_avail.options[i].selected) { |
---|
| 471 | isSelected = false; |
---|
| 472 | |
---|
| 473 | for(var j = 0;j < grps_selec.options.length; j++) { |
---|
| 474 | if(grps_selec.options[j].value === grps_avail.options[i].value){ |
---|
| 475 | isSelected = true; |
---|
| 476 | break; |
---|
| 477 | } |
---|
| 478 | } |
---|
| 479 | |
---|
| 480 | if(!isSelected){ |
---|
| 481 | |
---|
| 482 | option = document.createElement('option'); |
---|
| 483 | option.value = grps_avail.options[i].value; |
---|
| 484 | option.text = grps_avail.options[i].text; |
---|
| 485 | option.selected = false; |
---|
| 486 | grps_selec.options[grps_selec.options.length] = option; |
---|
| 487 | |
---|
| 488 | } |
---|
| 489 | |
---|
| 490 | } |
---|
| 491 | } |
---|
| 492 | |
---|
| 493 | for (j =0; j < grps_avail.options.length; j++) |
---|
| 494 | grps_avail.options[j].selected = false; |
---|
| 495 | } |
---|
| 496 | |
---|
| 497 | /* |
---|
| 498 | * Função que remove um grupo selecionado. |
---|
| 499 | * Autor: Luiz Carlos Viana Melo - Prognus |
---|
| 500 | */ |
---|
| 501 | function deselectGroup() |
---|
| 502 | { |
---|
| 503 | grps_selec = Element('id_grps_selected'); |
---|
| 504 | |
---|
| 505 | for(var i = 0;i < grps_selec.options.length; i++) |
---|
| 506 | if(grps_selec.options[i].selected) |
---|
| 507 | grps_selec.options[i--] = null; |
---|
| 508 | } |
---|
| 509 | |
---|
[503] | 510 | function populateFullEdit (id,catalog) |
---|
[2] | 511 | { |
---|
| 512 | var handler = function(responseText) |
---|
| 513 | { |
---|
| 514 | //Element('cc_debug').innerHTML = responseText; |
---|
| 515 | var data = unserialize(responseText); |
---|
| 516 | |
---|
| 517 | if (typeof(data) != 'object' || data['result'] != 'ok') |
---|
| 518 | { |
---|
| 519 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 520 | return; |
---|
| 521 | } |
---|
| 522 | |
---|
| 523 | resetFullAdd(); |
---|
| 524 | |
---|
| 525 | CC_contact_full_info = data; |
---|
| 526 | Element('cc_full_add_contact_id').value = data['cc_full_add_contact_id']; |
---|
| 527 | populatePersonalData(data['personal']); |
---|
[4498] | 528 | populateContactGroups(data['groups']); |
---|
[2] | 529 | //populateRelations(data['relations']); |
---|
| 530 | }; |
---|
[503] | 531 | Connector.newRequest('populateFullEdit', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_full_data&id=' + id + "&catalog="+catalog, 'GET', handler); |
---|
[2] | 532 | } |
---|
| 533 | |
---|
[4498] | 534 | /* |
---|
| 535 | * Função que preenche a lista de grupos a qual o contato pertence. |
---|
| 536 | * Autor: Luiz Carlos Viana Melo - Prognus |
---|
| 537 | */ |
---|
| 538 | function populateContactGroups(groupsData) |
---|
| 539 | { |
---|
| 540 | groups_selected = Element('id_grps_selected'); |
---|
| 541 | var i = 0; |
---|
| 542 | CC_initial_selected_grps = new Array(); |
---|
| 543 | for (var group in groupsData) |
---|
| 544 | { |
---|
| 545 | var id_group = groupsData[group]['id_group']; |
---|
| 546 | option = document.createElement('option'); |
---|
| 547 | option.value = id_group; |
---|
| 548 | option.text = groupsData[group]['title']; |
---|
| 549 | option.selected = false; |
---|
| 550 | groups_selected.options[i++] = option; |
---|
| 551 | CC_initial_selected_grps[id_group] = new Array(); |
---|
| 552 | CC_initial_selected_grps[id_group]['id_group'] = id_group; |
---|
| 553 | CC_initial_selected_grps[id_group]['title'] = groupsData[group]['title']; |
---|
| 554 | CC_initial_selected_grps[id_group]['short_name'] = groupsData[group]['short_name']; |
---|
| 555 | } |
---|
| 556 | } |
---|
| 557 | |
---|
[2] | 558 | function populateEditGroup (id) |
---|
| 559 | { |
---|
[1280] | 560 | populateEditSharedGroup(id,false); |
---|
| 561 | } |
---|
| 562 | |
---|
| 563 | function populateEditSharedGroup(id,shared) { |
---|
[2] | 564 | var handler = function(responseText) |
---|
[285] | 565 | { |
---|
[294] | 566 | var data = unserialize(responseText); |
---|
| 567 | |
---|
[285] | 568 | Element('group_id').value = data['id_group']; |
---|
[294] | 569 | var options_contact_list = Element('span_contact_list'); |
---|
| 570 | var select_contact_list = '<select id="contact_list" multiple name="contact_list[]" style="width:280px" size="10">'; |
---|
| 571 | select_contact_list += data['contact_list'] + "</select>"; |
---|
| 572 | options_contact_list.innerHTML = select_contact_list; |
---|
[1599] | 573 | |
---|
| 574 | if(data['id_group']) { |
---|
| 575 | Element('title').value = data['title']; |
---|
[285] | 576 | if(data['contact_in_list']) { |
---|
| 577 | for(i = 0; i < data['contact_in_list'].length; i++) { |
---|
[2] | 578 | option = document.createElement('option'); |
---|
| 579 | option.value = data['contact_in_list'][i]['id_connection']; |
---|
[285] | 580 | option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')'; |
---|
[2] | 581 | Element('contact_in_list').options[Element('contact_in_list').options.length] = option; |
---|
[1599] | 582 | } |
---|
| 583 | } |
---|
| 584 | |
---|
| 585 | Element('title').value = data['title']; |
---|
[2] | 586 | } |
---|
[285] | 587 | |
---|
[2] | 588 | if (typeof(data) != 'object' || data['result'] != 'ok') |
---|
| 589 | { |
---|
| 590 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 591 | return; |
---|
| 592 | } |
---|
[3970] | 593 | ccAddGroup.setSelectedSourceLevel(ccTree.actualLevel); |
---|
[4502] | 594 | ccAddGroup.openEditWindow(); |
---|
[2] | 595 | }; |
---|
[285] | 596 | |
---|
[2] | 597 | id = typeof(id) == 'undefined' ? id = 0 : id; |
---|
[285] | 598 | |
---|
[1599] | 599 | ccAddGroup.clear(true); |
---|
[1280] | 600 | if(!shared) |
---|
| 601 | Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); |
---|
| 602 | else |
---|
| 603 | Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id+'&shared_from='+shared, 'GET', handler); |
---|
[2] | 604 | } |
---|
| 605 | |
---|
| 606 | |
---|
[1599] | 607 | |
---|
[2] | 608 | function resetFullAdd() |
---|
| 609 | { |
---|
[4498] | 610 | /* Groups */ |
---|
| 611 | gprs_selected = Element('id_grps_selected'); |
---|
| 612 | for (j =0; j < gprs_selected.options.length; j++) { |
---|
| 613 | gprs_selected.options[j].selected = false; |
---|
| 614 | gprs_selected.options[j--] = null; |
---|
| 615 | } |
---|
[2] | 616 | /* Clear information container */ |
---|
| 617 | CC_contact_full_info = new Array(); |
---|
| 618 | |
---|
| 619 | /* Clear Fields */ |
---|
| 620 | Element('cc_full_add_form_personal').reset(); |
---|
| 621 | Element('cc_full_add_form_addrs').reset(); |
---|
[1517] | 622 | if(Element('cc_contact_type').value=='advanced') |
---|
| 623 | Element('cc_full_add_form_corporative').reset(); |
---|
[2] | 624 | /* Personal Data */ |
---|
| 625 | Element('cc_full_add_contact_id').value = null; |
---|
| 626 | Element('cc_pd_photo').src = 'templates/default/images/photo.png'; |
---|
| 627 | |
---|
| 628 | /* Addresses */ |
---|
| 629 | resetAddressFields(); |
---|
| 630 | |
---|
| 631 | /* Connections */ |
---|
| 632 | CC_conn_last_selected = '_NONE_'; |
---|
| 633 | Element("cc_phone_default").options.selectedIndex = '-1'; |
---|
| 634 | Element("cc_email_default").options.selectedIndex = '-1'; |
---|
| 635 | Element("div_cc_conn_is_default").style.display = 'none'; |
---|
| 636 | clearConn(); |
---|
| 637 | } |
---|
| 638 | |
---|
| 639 | function postFullAdd() |
---|
| 640 | { |
---|
| 641 | if (!checkFullAdd()) |
---|
| 642 | { |
---|
| 643 | return false; |
---|
| 644 | } |
---|
[1599] | 645 | |
---|
[2] | 646 | /* First thing: Send Photo */ |
---|
| 647 | if (Element('cc_pd_select_photo').value != '' && !is_ie) |
---|
| 648 | { |
---|
| 649 | var nodes; |
---|
| 650 | var form, frame, old_frame; |
---|
| 651 | |
---|
| 652 | CC_full_add_photo = false; |
---|
| 653 | |
---|
| 654 | old_frame = Element('cc_photo_frame'); |
---|
| 655 | if (!old_frame) |
---|
| 656 | { |
---|
| 657 | frame = document.createElement('iframe'); |
---|
| 658 | } |
---|
| 659 | else |
---|
| 660 | { |
---|
| 661 | frame = old_frame; |
---|
| 662 | } |
---|
[1599] | 663 | |
---|
[2] | 664 | frame.id = 'cc_photo_frame'; |
---|
| 665 | frame.style.visibility = 'hidden'; |
---|
| 666 | frame.style.top = '0px'; |
---|
| 667 | frame.style.left = '0'; |
---|
| 668 | frame.style.position = 'absolute'; |
---|
| 669 | document.body.appendChild(frame); |
---|
| 670 | |
---|
| 671 | form = frame.contentDocument.createElement('form'); |
---|
[1599] | 672 | |
---|
[2] | 673 | var id_contact = Element('cc_full_add_contact_id').value; |
---|
| 674 | form.id = 'cc_form_photo'; |
---|
| 675 | form.method = 'POST'; |
---|
| 676 | form.enctype = 'multipart/form-data'; |
---|
| 677 | 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 : ''); |
---|
[1599] | 678 | |
---|
[2] | 679 | var input_clone = Element('cc_pd_select_photo').cloneNode(false); |
---|
| 680 | form.appendChild(input_clone); |
---|
[1599] | 681 | |
---|
[2] | 682 | frame.contentDocument.body.appendChild(form); |
---|
| 683 | form.submit(); |
---|
| 684 | |
---|
| 685 | CC_full_add_photo = true; |
---|
| 686 | } |
---|
| 687 | else if (Element('cc_pd_select_photo_t').value != '' && is_ie) |
---|
| 688 | { |
---|
| 689 | CC_full_add_photo = false; |
---|
| 690 | |
---|
| 691 | var frame = Element('cc_photo_frame'); |
---|
| 692 | var form = frame.contentWindow.document.all['cc_photo_form']; |
---|
| 693 | var id_contact = Element('cc_full_add_contact_id').value; |
---|
| 694 | 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 : ''); |
---|
| 695 | |
---|
| 696 | form.submit(); |
---|
| 697 | |
---|
| 698 | setTimeout('Element(\'cc_photo_frame\').src = \'cc_photo_frame.html\'', 1000); |
---|
| 699 | CC_full_add_photo = true; |
---|
| 700 | } |
---|
[1496] | 701 | if (Element('cc_contact_sharing').style.display == 'none') |
---|
[1599] | 702 | setTimeout('postFullAddInfo()', 100); |
---|
[1496] | 703 | else |
---|
| 704 | setTimeout('postFullAddInfoShared()', 100); |
---|
[2] | 705 | } |
---|
| 706 | |
---|
| 707 | function postFullAddInfo() |
---|
| 708 | { |
---|
| 709 | var handler = function (responseText) |
---|
| 710 | { |
---|
| 711 | var data = unserialize(responseText); |
---|
| 712 | |
---|
| 713 | if (typeof(data) != 'object') |
---|
| 714 | { |
---|
| 715 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 716 | return; |
---|
| 717 | } |
---|
| 718 | |
---|
| 719 | if (data['status'] != 'ok') |
---|
| 720 | { |
---|
| 721 | showMessage(data['msg']); |
---|
| 722 | return; |
---|
| 723 | } |
---|
| 724 | |
---|
| 725 | fullAddWin.close(); |
---|
| 726 | updateCards(); |
---|
| 727 | }; |
---|
[1599] | 728 | |
---|
[2] | 729 | Connector.newRequest('postFullAddInfo', CC_url+'post_full_add', 'POST', handler, getFullAddData()); |
---|
| 730 | } |
---|
| 731 | |
---|
[1496] | 732 | function postFullAddInfoShared() |
---|
| 733 | { |
---|
| 734 | var handler = function (responseText) |
---|
| 735 | { |
---|
| 736 | var data = unserialize(responseText); |
---|
| 737 | if (typeof(data) != 'object') |
---|
| 738 | { |
---|
| 739 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 740 | return; |
---|
| 741 | } |
---|
| 742 | |
---|
| 743 | if (data['status'] != 'ok') |
---|
| 744 | { |
---|
| 745 | showMessage(data['msg']); |
---|
| 746 | return; |
---|
| 747 | } |
---|
| 748 | |
---|
| 749 | fullAddWin.close(); |
---|
| 750 | updateCards(); |
---|
| 751 | }; |
---|
| 752 | Connector.newRequest('postFullAddInfoShared', CC_url+'post_full_add_shared', 'POST', handler, getFullAddData()); |
---|
| 753 | } |
---|
| 754 | |
---|
[2] | 755 | function getFullAddData() |
---|
| 756 | { |
---|
| 757 | var data = new Array(); |
---|
| 758 | var empty = true; |
---|
| 759 | var replacer = '__##AND##__'; |
---|
[1496] | 760 | |
---|
[2] | 761 | data['commercialAnd'] = replacer; |
---|
[1599] | 762 | |
---|
[2] | 763 | if (Element('cc_full_add_contact_id').value != '' && Element('cc_full_add_contact_id').value != 'null') |
---|
| 764 | { |
---|
| 765 | data['id_contact'] = replaceComAnd(Element('cc_full_add_contact_id').value, replacer); |
---|
| 766 | data.length++; |
---|
| 767 | } |
---|
[1599] | 768 | |
---|
[1496] | 769 | /* Owner do contato (Para o caso de adicao de contato compartilhado) */ |
---|
| 770 | if (Element('cc_contact_sharing').style.display == 'block') |
---|
| 771 | { |
---|
| 772 | var index = Element('cc_contact_shared_types').selectedIndex; |
---|
[1599] | 773 | data['owner'] = replaceComAnd(owners[index], replacer); |
---|
[1496] | 774 | data.length++; |
---|
| 775 | } |
---|
[1599] | 776 | |
---|
[2] | 777 | /* Status: Full Added */ |
---|
| 778 | data['id_status'] = CC_STATUS_FULL_ADD; |
---|
[1599] | 779 | |
---|
[2] | 780 | /* Personal Data */ |
---|
| 781 | data['alias'] = replaceComAnd(Element('cc_pd_alias').value, replacer); |
---|
| 782 | data['id_prefix'] = replaceComAnd(Element('cc_pd_prefix').value, replacer); |
---|
| 783 | data['given_names'] = replaceComAnd(Element('cc_pd_given_names').value, replacer); |
---|
| 784 | data['family_names'] = replaceComAnd(Element('cc_pd_family_names').value, replacer); |
---|
| 785 | data['names_ordered'] = replaceComAnd(data['given_names']+" "+data['family_names'], replacer); |
---|
| 786 | data['id_suffix'] = replaceComAnd(Element('cc_pd_suffix').value, replacer);; |
---|
| 787 | data['birthdate_0'] = replaceComAnd(Element('cc_pd_birthdate_0').value, replacer); |
---|
| 788 | data['birthdate_1'] = replaceComAnd(Element('cc_pd_birthdate_1').value, replacer); |
---|
| 789 | data['birthdate_2'] = replaceComAnd(Element('cc_pd_birthdate_2').value, replacer); |
---|
| 790 | // data['sex'] = Element('cc_pd_sex').value == 1 ? 'M' : Element('cc_pd_sex').value == 2 ? 'F' : null; |
---|
| 791 | data['pgp_key'] = replaceComAnd(Element('cc_pd_gpg_finger_print').value, replacer); |
---|
| 792 | data['notes'] = replaceComAnd(Element('cc_pd_notes').value, replacer); |
---|
| 793 | |
---|
| 794 | data.length += 14; |
---|
[1517] | 795 | //corporative |
---|
[3315] | 796 | |
---|
| 797 | if (document.getElementById('cc_contact_type').value == 'advanced') { |
---|
| 798 | data['corporate_name'] = replaceComAnd(document.getElementById('cc_name_corporate').value, replacer); |
---|
| 799 | data['job_title'] = replaceComAnd(document.getElementById('cc_job_title').value, replacer); |
---|
| 800 | data['department'] = replaceComAnd(document.getElementById('cc_department').value, replacer); |
---|
| 801 | data['web_page'] = replaceComAnd(document.getElementById('cc_web_page').value, replacer); |
---|
[1517] | 802 | data.length += 18; |
---|
| 803 | } |
---|
[2] | 804 | |
---|
| 805 | /* Addresses */ |
---|
| 806 | saveAddressFields(); |
---|
| 807 | data['addresses'] = CC_contact_full_info['addresses']; |
---|
| 808 | |
---|
| 809 | /* Connection */ |
---|
| 810 | saveConnFields(); |
---|
| 811 | |
---|
| 812 | if (CC_contact_full_info['connections']) |
---|
| 813 | { |
---|
| 814 | var connNumber = 0; |
---|
| 815 | for (var type in CC_contact_full_info['connections']) |
---|
| 816 | { |
---|
| 817 | if (type == 'length') |
---|
| 818 | { |
---|
| 819 | continue; |
---|
| 820 | } |
---|
| 821 | |
---|
| 822 | if (typeof(data['connections']) != 'object') |
---|
| 823 | { |
---|
| 824 | data['connections'] = new Array(); |
---|
| 825 | } |
---|
[1599] | 826 | |
---|
[2] | 827 | for (var i in CC_contact_full_info['connections'][type]) |
---|
| 828 | { |
---|
| 829 | if (i == 'length') |
---|
| 830 | { |
---|
| 831 | continue; |
---|
| 832 | } |
---|
| 833 | |
---|
| 834 | if (typeof(data['connections']['connection'+connNumber]) != 'object') |
---|
| 835 | { |
---|
| 836 | data['connections']['connection'+connNumber] = new Array(5); |
---|
| 837 | } |
---|
[1599] | 838 | |
---|
[2] | 839 | data['connections']['connection'+connNumber]['id_connection'] = CC_contact_full_info['connections'][type][i]['id']; |
---|
| 840 | data['connections']['connection'+connNumber]['id_typeof_connection'] = type; |
---|
| 841 | data['connections']['connection'+connNumber]['connection_name'] = CC_contact_full_info['connections'][type][i]['name']; |
---|
| 842 | data['connections']['connection'+connNumber]['connection_value'] = CC_contact_full_info['connections'][type][i]['value']; |
---|
| 843 | if(Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default").value) { |
---|
| 844 | if(Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default").value == CC_contact_full_info['connections'][type][i]['name']){ |
---|
| 845 | data['connections']['connection'+connNumber]['connection_is_default'] = 'TRUE'; |
---|
| 846 | } |
---|
[1599] | 847 | else |
---|
[2] | 848 | data['connections']['connection'+connNumber]['connection_is_default'] = 'FALSE'; |
---|
| 849 | } |
---|
| 850 | |
---|
| 851 | // data['connections']['connection'+connNumber].length = 5; |
---|
[1599] | 852 | |
---|
[2] | 853 | empty = false; |
---|
| 854 | connNumber++; |
---|
| 855 | data['connections'].length++; |
---|
| 856 | } |
---|
| 857 | |
---|
| 858 | } |
---|
[1599] | 859 | |
---|
[2] | 860 | if (!empty) |
---|
| 861 | { |
---|
| 862 | data.length++; |
---|
| 863 | empty = true; |
---|
| 864 | } |
---|
| 865 | } |
---|
[1599] | 866 | |
---|
[2] | 867 | if (CC_contact_full_info['removed_conns']) |
---|
| 868 | { |
---|
| 869 | empty = false; |
---|
[1599] | 870 | |
---|
[2] | 871 | if (typeof(data['connections']) != 'object') |
---|
| 872 | { |
---|
| 873 | data['connections'] = new Array(); |
---|
| 874 | data.length++; |
---|
| 875 | } |
---|
| 876 | |
---|
| 877 | data['connections']['removed_conns'] = CC_contact_full_info['removed_conns']; |
---|
| 878 | data['connections'].length++; |
---|
| 879 | } |
---|
| 880 | |
---|
[4498] | 881 | data['groups'] = getAddedRemovedGroups(); |
---|
| 882 | |
---|
[1496] | 883 | var serial = serialize(data); |
---|
[2] | 884 | return 'data=' + escape(serialize(data)); |
---|
| 885 | } |
---|
| 886 | |
---|
[4498] | 887 | /* |
---|
| 888 | * Função que retorna os grupos que foram anteriormente selecionados, adicionados ou removidos pelo |
---|
| 889 | * usuário. O formato retornado é um array contendo: |
---|
[4502] | 890 | * ['previous_selected'] { |
---|
| 891 | * [id_group] { |
---|
| 892 | * 'id_group' => o ID do grupo |
---|
| 893 | * 'title' => o título do grupo |
---|
| 894 | * } |
---|
[4498] | 895 | * ['added'] { |
---|
| 896 | * [id_group] { |
---|
| 897 | * 'id_group' => o ID do grupo |
---|
| 898 | * 'title' => o título do grupo |
---|
| 899 | * } |
---|
| 900 | * }, |
---|
| 901 | * ['removed'] { |
---|
| 902 | * [id_group] { |
---|
| 903 | * 'id_group' => o ID do grupo |
---|
| 904 | * 'title' => o título do grupo |
---|
| 905 | * } |
---|
| 906 | * } |
---|
| 907 | * Autor: Luiz Carlos Viana Melo - Prognus |
---|
| 908 | */ |
---|
| 909 | function getAddedRemovedGroups() |
---|
| 910 | { |
---|
| 911 | var selected_groups = getSelectedGroups(); |
---|
| 912 | var added_groups = diffContactIDArray(selected_groups, CC_initial_selected_grps); |
---|
| 913 | var removed_groups = diffContactIDArray(CC_initial_selected_grps, selected_groups); |
---|
| 914 | var groups = new Array(); |
---|
[4502] | 915 | groups['previous_selected'] = CC_initial_selected_grps; |
---|
[4498] | 916 | groups['added'] = added_groups; |
---|
| 917 | groups['removed'] = removed_groups; |
---|
| 918 | return groups; |
---|
| 919 | } |
---|
| 920 | |
---|
| 921 | /* |
---|
| 922 | * Função que retorna os grupos que foram selecionados pelo usuário. O formato retornado é: |
---|
| 923 | * [id_group] { |
---|
| 924 | * 'id_group' => o ID do grupo |
---|
| 925 | * 'title' => o título do grupo |
---|
| 926 | * } |
---|
| 927 | * Autor: Luiz Carlos Viana Melo - Prognus |
---|
| 928 | */ |
---|
| 929 | function getSelectedGroups() |
---|
| 930 | { |
---|
| 931 | var gprs_selected = Element('id_grps_selected'); |
---|
| 932 | var data = new Array(); |
---|
| 933 | for(i = 0; i < gprs_selected.options.length; i++) |
---|
| 934 | { |
---|
| 935 | var id_group = gprs_selected.options[i].value; |
---|
| 936 | data[id_group] = new Array(); |
---|
| 937 | data[id_group]['id_group'] = id_group; |
---|
| 938 | data[id_group]['title'] = gprs_selected.options[i].text; |
---|
| 939 | } |
---|
| 940 | return data; |
---|
| 941 | } |
---|
| 942 | |
---|
| 943 | /* |
---|
| 944 | * Função que retorna a diferença entre 2 arrays com ID dos contatos. |
---|
| 945 | * Autor: Luiz Carlos Viana Melo - Prognus |
---|
| 946 | */ |
---|
| 947 | function diffContactIDArray(array1, array2) |
---|
| 948 | { |
---|
| 949 | var diff = new Array(); |
---|
| 950 | for (var group in array1) |
---|
| 951 | { |
---|
| 952 | if (!array2[group]) |
---|
| 953 | diff.push(array1[group]); |
---|
| 954 | } |
---|
| 955 | return diff; |
---|
| 956 | } |
---|
| 957 | |
---|
[2] | 958 | function checkFullAdd() |
---|
| 959 | { |
---|
[1496] | 960 | |
---|
| 961 | /* Checa se o listbox esta desativado ou é nulo, ou seja, não existe catálogos compartilhados com o user atual */ |
---|
| 962 | |
---|
| 963 | if (!(Element('cc_contact_sharing').style.display == 'none' )) |
---|
| 964 | { |
---|
| 965 | if (Element('cc_contact_shared_types').disabled == true) |
---|
[1599] | 966 | { |
---|
[1496] | 967 | showMessage('Nenhum catálogo compartilhado existente'); |
---|
| 968 | return false; |
---|
| 969 | } |
---|
| 970 | if (Element('cc_contact_shared_types').selectedIndex == 0) |
---|
| 971 | { |
---|
| 972 | showMessage('Nenhum catálogo selecionado'); |
---|
| 973 | return false; |
---|
| 974 | } |
---|
| 975 | } |
---|
[1599] | 976 | |
---|
[2] | 977 | /* Check Personal Data */ |
---|
[1599] | 978 | |
---|
[2] | 979 | if (Element('cc_pd_given_names').value == '') |
---|
| 980 | { |
---|
| 981 | showMessage(Element('cc_msg_err_empty_field').value + " => " + Element('cc_pd_given_names').name); |
---|
| 982 | return false; |
---|
| 983 | } |
---|
| 984 | |
---|
| 985 | /* Check Addresses */ |
---|
| 986 | |
---|
| 987 | /* Check Connections */ |
---|
| 988 | |
---|
| 989 | saveConnFields(); |
---|
| 990 | |
---|
| 991 | var comp = /^[a-zA-Z\d(-)\.@_ -]{0,200}$/; |
---|
[1664] | 992 | haveConnections = false; |
---|
| 993 | if (CC_contact_full_info['connections']){ |
---|
| 994 | for (var type in CC_contact_full_info['connections']){ |
---|
| 995 | haveConnections = true; |
---|
| 996 | for (var i in CC_contact_full_info['connections'][type]){ |
---|
| 997 | if((CC_contact_full_info['connections'][type][i]['value'].length < 4) || |
---|
| 998 | (!comp.test(CC_contact_full_info['connections'][type][i]['value']))){ |
---|
| 999 | showMessage('Endereço para conexão de ' + CC_contact_full_info['connections'][type][i]['name'] + ', não é válido'); |
---|
| 1000 | return false; |
---|
| 1001 | } |
---|
| 1002 | } |
---|
| 1003 | var _options_default = Element("cc_"+(type == 1 ? 'email' : 'phone')+"_default"); |
---|
| 1004 | if(_options_default.value == '-1') { |
---|
| 1005 | alert("É necessário escolher um "+ (type == 1 ? 'E-mail' : 'Telefone')+" como padrão!"); |
---|
| 1006 | return false; |
---|
| 1007 | } |
---|
| 1008 | } |
---|
| 1009 | } |
---|
| 1010 | if(!haveConnections){ |
---|
[1682] | 1011 | showMessage(Element('cc_msg_tel_or_mail_required').value); |
---|
[1664] | 1012 | return false; |
---|
| 1013 | } |
---|
[1599] | 1014 | |
---|
[1664] | 1015 | /* Check Relations */ |
---|
[2] | 1016 | |
---|
[1664] | 1017 | return true; |
---|
[2] | 1018 | |
---|
| 1019 | } |
---|
| 1020 | |
---|
| 1021 | /********* Personal Data Functions *********/ |
---|
[1599] | 1022 | /* |
---|
[2] | 1023 | * data[0] => cc_pd_select_photo |
---|
| 1024 | * data[1] => cc_pd_alias |
---|
| 1025 | * data[2] => cc_pd_given_names |
---|
| 1026 | * data[3] => cc_pd_family_names |
---|
| 1027 | * data[4] => cc_pd_full_name |
---|
| 1028 | * data[5] => cc_pd_suffix |
---|
| 1029 | * data[6] => cc_pd_birthdate |
---|
| 1030 | * data[7] => cc_pd_sex SELECT |
---|
| 1031 | * data[8] => cc_pd_prefix |
---|
| 1032 | * data[9] => cc_pd_gpg_finger_print |
---|
| 1033 | * data[10] => cc_pd_notes |
---|
| 1034 | */ |
---|
| 1035 | |
---|
| 1036 | function populatePersonalData (data) |
---|
| 1037 | { |
---|
| 1038 | for (i in data) |
---|
| 1039 | { |
---|
| 1040 | switch(i) |
---|
| 1041 | { |
---|
| 1042 | case 'cc_pd_suffix': |
---|
| 1043 | case 'cc_pd_sex': |
---|
| 1044 | case 'cc_pd_prefix': |
---|
| 1045 | selectOption(i, data[i]); |
---|
| 1046 | break; |
---|
| 1047 | |
---|
| 1048 | case 'cc_pd_photo': |
---|
| 1049 | if (data[i]) |
---|
| 1050 | { |
---|
| 1051 | Element(i).src = data[i] + '&'+ Math.random(); |
---|
| 1052 | } |
---|
| 1053 | break; |
---|
| 1054 | |
---|
| 1055 | default: |
---|
[1650] | 1056 | Element(i).value = data[i] == undefined ? '' : unescape(data[i]); |
---|
[2] | 1057 | } |
---|
| 1058 | } |
---|
| 1059 | |
---|
| 1060 | return; |
---|
| 1061 | } |
---|
| 1062 | |
---|
| 1063 | /********* End Personal Data Functions *********/ |
---|
| 1064 | |
---|
| 1065 | |
---|
| 1066 | /********* Addresses Functions *********/ |
---|
| 1067 | function resetAddressFields() |
---|
| 1068 | { |
---|
| 1069 | Element('cc_addr_types').selectedIndex = 0; |
---|
[1599] | 1070 | |
---|
[2] | 1071 | Element('cc_addr_countries').selectedIndex = 0; |
---|
| 1072 | Element('cc_addr_countries').disabled = true; |
---|
[1599] | 1073 | |
---|
[2] | 1074 | Element('cc_addr_states').selectedIndex = 0; |
---|
| 1075 | Element('cc_addr_states').disabled = true; |
---|
| 1076 | Element('cc_addr_states_new').disabled = true; |
---|
| 1077 | Element('cc_addr_states_new').readonly = true; |
---|
| 1078 | Element('cc_addr_states_new').value = ''; |
---|
| 1079 | |
---|
| 1080 | Element('cc_addr_cities').selectedIndex = 0; |
---|
| 1081 | Element('cc_addr_cities').disabled = true; |
---|
| 1082 | Element('cc_addr_cities_new').disabled = true; |
---|
| 1083 | Element('cc_addr_cities_new').readonly = true; |
---|
| 1084 | Element('cc_addr_cities_new').value = ''; |
---|
| 1085 | |
---|
| 1086 | Element('cc_addr_id').value = ''; |
---|
| 1087 | |
---|
| 1088 | resetAddrFillingFields(); |
---|
| 1089 | } |
---|
| 1090 | |
---|
| 1091 | function resetAddrFillingFields() |
---|
| 1092 | { |
---|
| 1093 | Element('cc_addr_1').value = ''; |
---|
| 1094 | Element('cc_addr_2').value = ''; |
---|
| 1095 | Element('cc_addr_other').value = ''; |
---|
| 1096 | Element('cc_addr_complement').value = ''; |
---|
| 1097 | Element('cc_addr_postal_code').value = ''; |
---|
| 1098 | Element('cc_addr_po_box').value = ''; |
---|
| 1099 | Element('cc_addr_is_default').checked = false; |
---|
| 1100 | } |
---|
| 1101 | |
---|
| 1102 | function disableAddrFillingFields() |
---|
| 1103 | { |
---|
| 1104 | Element('cc_addr_1').readonly = true; |
---|
| 1105 | Element('cc_addr_1').disabled = true; |
---|
| 1106 | Element('cc_addr_2').readonly = true; |
---|
| 1107 | Element('cc_addr_2').disabled = true; |
---|
| 1108 | Element('cc_addr_other').readonly = true; |
---|
| 1109 | Element('cc_addr_other').disabled = true; |
---|
| 1110 | Element('cc_addr_complement').readonly = true; |
---|
| 1111 | Element('cc_addr_complement').disabled = true; |
---|
| 1112 | Element('cc_addr_postal_code').readonly = true; |
---|
| 1113 | Element('cc_addr_postal_code').disabled = true; |
---|
| 1114 | Element('cc_addr_po_box').readonly = true; |
---|
| 1115 | Element('cc_addr_po_box').disabled = true; |
---|
| 1116 | Element('cc_addr_is_default').readonly = true; |
---|
| 1117 | Element('cc_addr_is_default').disabled = true; |
---|
| 1118 | } |
---|
| 1119 | |
---|
| 1120 | function updateAddressFields() |
---|
| 1121 | { |
---|
| 1122 | var type = Element('cc_addr_types'); |
---|
| 1123 | var oldSelected = type.value; |
---|
[1599] | 1124 | |
---|
[2] | 1125 | saveAddressFields(); |
---|
[1599] | 1126 | |
---|
[2] | 1127 | if (oldSelected == '_NONE_') |
---|
| 1128 | { |
---|
| 1129 | resetAddressFields(); |
---|
| 1130 | return true; |
---|
| 1131 | } |
---|
[1599] | 1132 | |
---|
[2] | 1133 | CC_addr_last_selected = type.selectedIndex; |
---|
[1599] | 1134 | |
---|
[2] | 1135 | Element('cc_addr_countries').disabled = false; |
---|
[1599] | 1136 | |
---|
[2] | 1137 | var data = CC_contact_full_info['addresses']; |
---|
| 1138 | var addrIndex = 'address'+Element('cc_addr_types').value; |
---|
[1599] | 1139 | |
---|
| 1140 | if (typeof(data) != 'object' || typeof(data[addrIndex]) != 'object') |
---|
[2] | 1141 | { |
---|
| 1142 | resetAddressFields(); |
---|
| 1143 | Element('cc_addr_countries').disabled = false; |
---|
| 1144 | Element('cc_addr_countries').selectedIndex = CC_br_index; |
---|
| 1145 | type.value = oldSelected; |
---|
| 1146 | updateAddrStates(); |
---|
| 1147 | return true; |
---|
| 1148 | } |
---|
[1599] | 1149 | |
---|
[2] | 1150 | var addrTypeID = Element('cc_addr_types').value; |
---|
[1599] | 1151 | |
---|
[2] | 1152 | data = CC_contact_full_info['addresses'][addrIndex]; |
---|
[1599] | 1153 | |
---|
[2] | 1154 | Element('cc_addr_id').value = data['id_address'] ? data['id_address'] : ''; |
---|
| 1155 | Element('cc_addr_1').value = data['address1'] ? data['address1'] : ''; |
---|
| 1156 | Element('cc_addr_2').value = data['address2'] ? data['address2'] : ''; |
---|
| 1157 | Element('cc_addr_complement').value = data['complement'] ? data['complement'] : ''; |
---|
| 1158 | Element('cc_addr_other').value = data['address_other'] ? data['address_other'] : ''; |
---|
| 1159 | Element('cc_addr_postal_code').value = data['postal_code'] ? data['postal_code'] : ''; |
---|
| 1160 | Element('cc_addr_po_box').value = data['po_box'] ? data['po_box'] : ''; |
---|
| 1161 | Element('cc_addr_is_default').checked = data['address_is_default'] == '1' ? true: false; |
---|
| 1162 | |
---|
| 1163 | Element('cc_addr_countries').value = data['id_country']; |
---|
| 1164 | updateAddrStates(); |
---|
| 1165 | } |
---|
| 1166 | |
---|
| 1167 | function updateAddrStates() |
---|
| 1168 | { |
---|
| 1169 | var states = Element('cc_addr_states'); |
---|
| 1170 | if (Element('cc_addr_countries').value == '_NONE_') |
---|
| 1171 | { |
---|
| 1172 | states.disabled = true; |
---|
| 1173 | states.selectedIndex = 0; |
---|
| 1174 | clearSelectBox(states, 4); |
---|
[1599] | 1175 | updateAddrCities(); |
---|
[2] | 1176 | return; |
---|
| 1177 | } |
---|
| 1178 | |
---|
| 1179 | updateAddrFillingFields(); |
---|
| 1180 | populateStates(); |
---|
| 1181 | } |
---|
| 1182 | |
---|
| 1183 | function populateStates() |
---|
| 1184 | { |
---|
| 1185 | var states = Element('cc_addr_states'); |
---|
| 1186 | var cities = Element('cc_addr_cities'); |
---|
| 1187 | var handler = function (responseText) |
---|
| 1188 | { |
---|
| 1189 | var data = unserialize(responseText); |
---|
[1599] | 1190 | |
---|
[2] | 1191 | clearSelectBox(states, 1); |
---|
[1599] | 1192 | |
---|
[2] | 1193 | if (typeof(data) != 'object') |
---|
| 1194 | { |
---|
| 1195 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
[1599] | 1196 | |
---|
[2] | 1197 | return; |
---|
| 1198 | } |
---|
| 1199 | |
---|
| 1200 | if (data['status'] == 'empty') |
---|
| 1201 | { |
---|
| 1202 | states.disabled = true; |
---|
[1599] | 1203 | cities.disabled = true; |
---|
[2] | 1204 | states.selectedIndex = 0; |
---|
| 1205 | cities.selectedIndex = 0; |
---|
| 1206 | return; |
---|
| 1207 | } |
---|
| 1208 | else if (data['status'] != 'ok') |
---|
| 1209 | { |
---|
| 1210 | showMessage(data['msg']); |
---|
| 1211 | states.disabled = true; |
---|
| 1212 | states.selectedIndex = 0; |
---|
| 1213 | updateAddrCities(); |
---|
| 1214 | return; |
---|
| 1215 | } |
---|
| 1216 | states.disabled = false; |
---|
| 1217 | var i = 1; |
---|
| 1218 | for (var j in data['data']) |
---|
| 1219 | { |
---|
| 1220 | states.options[i] = new Option(data['data'][j], j); |
---|
| 1221 | i++; |
---|
| 1222 | } |
---|
| 1223 | |
---|
| 1224 | states.disabled = false; |
---|
| 1225 | states.selectedIndex = 0; |
---|
| 1226 | |
---|
| 1227 | data = CC_contact_full_info['addresses']; |
---|
| 1228 | var addrIndex = 'address'+Element('cc_addr_types').value; |
---|
| 1229 | if (data && data[addrIndex]) |
---|
| 1230 | { |
---|
| 1231 | states.value = data[addrIndex]['id_state']; |
---|
| 1232 | if (states.value == '_NEW_') |
---|
| 1233 | { |
---|
| 1234 | if (CC_contact_full_info['addresses']['new_states'][addrIndex]) |
---|
| 1235 | { |
---|
| 1236 | Element('cc_addr_states_new').value = CC_contact_full_info['addresses']['new_states'][addrIndex]; |
---|
| 1237 | } |
---|
| 1238 | updateAddrNewStateOnMouseOut(); |
---|
| 1239 | } |
---|
| 1240 | updateAddrCities(); |
---|
| 1241 | } |
---|
| 1242 | }; |
---|
[1599] | 1243 | |
---|
[2] | 1244 | Connector.newRequest('populateStates', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_states&country='+Element('cc_addr_countries').value, 'GET', handler); |
---|
| 1245 | } |
---|
| 1246 | |
---|
| 1247 | function updateAddrCities() |
---|
| 1248 | { |
---|
| 1249 | var states = Element('cc_addr_states'); |
---|
| 1250 | var cities = Element('cc_addr_cities'); |
---|
| 1251 | var newState = Element('cc_addr_states_new'); |
---|
| 1252 | var requestStr; |
---|
| 1253 | |
---|
| 1254 | switch (states.value) |
---|
| 1255 | { |
---|
| 1256 | case '_NONE_': |
---|
| 1257 | newState.readonly = true; |
---|
| 1258 | newState.disabled = true; |
---|
| 1259 | newState.value = ''; |
---|
| 1260 | |
---|
| 1261 | cities.disabled = true; |
---|
| 1262 | cities.selectedIndex = 0; |
---|
| 1263 | updateAddrFillingFields(); |
---|
| 1264 | return; |
---|
| 1265 | |
---|
| 1266 | case '_NEW_': |
---|
| 1267 | |
---|
| 1268 | newState.readonly = false; |
---|
| 1269 | newState.disabled = false; |
---|
| 1270 | updateAddrNewStateOnMouseOut(); |
---|
[1599] | 1271 | |
---|
[2] | 1272 | cities.disabled = false; |
---|
| 1273 | clearSelectBox(cities, 3); |
---|
| 1274 | cities.selectedIndex = 1; |
---|
| 1275 | updateAddrFillingFields(); |
---|
| 1276 | return; |
---|
| 1277 | |
---|
| 1278 | case '_SEP_': return; |
---|
| 1279 | |
---|
| 1280 | case '_NOSTATE_': |
---|
| 1281 | clearSelectBox(cities, 3); |
---|
[1599] | 1282 | |
---|
[2] | 1283 | cities.disabled = false; |
---|
| 1284 | cities.selectedIndex = 0; |
---|
[1599] | 1285 | |
---|
[2] | 1286 | requestStr = 'country='+Element('cc_addr_countries').value; |
---|
| 1287 | break; |
---|
[1599] | 1288 | |
---|
[2] | 1289 | default: |
---|
| 1290 | requestStr = 'country='+Element('cc_addr_countries').value+'&state='+states.value; |
---|
| 1291 | } |
---|
| 1292 | |
---|
| 1293 | newState.readonly = true; |
---|
| 1294 | newState.disabled = true; |
---|
| 1295 | newState.value = ''; |
---|
| 1296 | |
---|
| 1297 | populateCities(requestStr); |
---|
| 1298 | } |
---|
| 1299 | |
---|
| 1300 | function populateCities(requestStr) |
---|
| 1301 | { |
---|
| 1302 | var cities = Element('cc_addr_cities'); |
---|
[1599] | 1303 | |
---|
[2] | 1304 | var handler = function (responseText) |
---|
| 1305 | { |
---|
| 1306 | var data = unserialize(responseText); |
---|
[1599] | 1307 | |
---|
[2] | 1308 | clearSelectBox(cities, 1); |
---|
[1599] | 1309 | |
---|
[2] | 1310 | if (typeof(data) != 'object') |
---|
| 1311 | { |
---|
| 1312 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
[1599] | 1313 | |
---|
[2] | 1314 | return; |
---|
| 1315 | } |
---|
| 1316 | |
---|
| 1317 | if (data['status'] == 'empty') |
---|
| 1318 | { |
---|
| 1319 | cities.disabled = true; |
---|
| 1320 | cities.selectedIndex = 0; |
---|
| 1321 | return; |
---|
| 1322 | } |
---|
| 1323 | else if (data['status'] != 'ok') |
---|
| 1324 | { |
---|
| 1325 | showMessage(data['msg']); |
---|
| 1326 | cities.disabled = true; |
---|
| 1327 | cities.selectedIndex = 0; |
---|
| 1328 | updateAddrFillingFields(); |
---|
| 1329 | return; |
---|
| 1330 | } |
---|
| 1331 | cities.disabled = false; |
---|
| 1332 | var i = 1; |
---|
| 1333 | for (var j in data['data']) |
---|
| 1334 | { |
---|
| 1335 | cities.options[i] = new Option(data['data'][j], j); |
---|
| 1336 | i++; |
---|
| 1337 | } |
---|
| 1338 | |
---|
| 1339 | cities.disabled = false; |
---|
| 1340 | cities.selectedIndex = 0; |
---|
| 1341 | |
---|
| 1342 | data = CC_contact_full_info['addresses']; |
---|
| 1343 | var addrIndex = 'address'+Element('cc_addr_types').value; |
---|
| 1344 | if (data && data[addrIndex]) |
---|
| 1345 | { |
---|
| 1346 | cities.value = data[addrIndex]['id_city']; |
---|
| 1347 | |
---|
| 1348 | if (cities.value == '_NEW_') |
---|
| 1349 | { |
---|
| 1350 | if (CC_contact_full_info['addresses']['new_cities'][addrIndex]) |
---|
| 1351 | { |
---|
| 1352 | Element('cc_addr_cities_new').value = CC_contact_full_info['addresses']['new_cities'][addrIndex]; |
---|
| 1353 | } |
---|
| 1354 | updateAddrNewCityOnMouseOut(); |
---|
| 1355 | } |
---|
| 1356 | } |
---|
| 1357 | }; |
---|
[1599] | 1358 | |
---|
[2] | 1359 | Connector.newRequest('populateCities', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cities&'+requestStr, 'GET', handler); |
---|
| 1360 | } |
---|
| 1361 | |
---|
| 1362 | function updateAddrNewStateOnMouseOver () |
---|
| 1363 | { |
---|
[1599] | 1364 | if (Element('cc_addr_states_new').value == Element('cc_msg_type_state').value && Element('cc_addr_states').selectedIndex == 1) |
---|
[2] | 1365 | { |
---|
| 1366 | Element('cc_addr_states_new').value = ''; |
---|
| 1367 | } |
---|
| 1368 | } |
---|
| 1369 | |
---|
| 1370 | function updateAddrNewStateOnMouseOut () |
---|
| 1371 | { |
---|
[1599] | 1372 | if (Element('cc_addr_states_new').value.length == 0 && Element('cc_addr_states').selectedIndex == 1) |
---|
[2] | 1373 | { |
---|
| 1374 | Element('cc_addr_states_new').value = Element('cc_msg_type_state').value; |
---|
| 1375 | } |
---|
| 1376 | } |
---|
| 1377 | |
---|
| 1378 | function updateAddrFillingFields() |
---|
| 1379 | { |
---|
| 1380 | var countries = Element('cc_addr_countries'); |
---|
| 1381 | var cities = Element('cc_addr_cities'); |
---|
| 1382 | var newCity = Element('cc_addr_cities_new'); |
---|
| 1383 | |
---|
| 1384 | if (countries.value == '_NONE_') |
---|
| 1385 | { |
---|
| 1386 | newCity.readonly = true; |
---|
| 1387 | newCity.disabled = true; |
---|
| 1388 | newCity.value = ''; |
---|
| 1389 | disableAddrFillingFields(); |
---|
| 1390 | return; |
---|
| 1391 | } |
---|
[1599] | 1392 | |
---|
[2] | 1393 | Element('cc_addr_1').readonly = false; |
---|
| 1394 | Element('cc_addr_1').disabled = false; |
---|
| 1395 | |
---|
| 1396 | Element('cc_addr_2').readonly = false; |
---|
| 1397 | Element('cc_addr_2').disabled = false; |
---|
| 1398 | |
---|
| 1399 | Element('cc_addr_other').readonly = false; |
---|
| 1400 | Element('cc_addr_other').disabled = false; |
---|
| 1401 | |
---|
| 1402 | Element('cc_addr_complement').readonly = false; |
---|
| 1403 | Element('cc_addr_complement').disabled = false; |
---|
| 1404 | |
---|
| 1405 | Element('cc_addr_postal_code').readonly = false; |
---|
| 1406 | Element('cc_addr_postal_code').disabled = false; |
---|
| 1407 | |
---|
| 1408 | Element('cc_addr_po_box').readonly = false; |
---|
| 1409 | Element('cc_addr_po_box').disabled = false; |
---|
| 1410 | |
---|
| 1411 | Element('cc_addr_is_default').readonly = false; |
---|
| 1412 | Element('cc_addr_is_default').disabled = false; |
---|
| 1413 | |
---|
| 1414 | switch (cities.value) |
---|
| 1415 | { |
---|
| 1416 | case '_NONE_': |
---|
| 1417 | newCity.readonly = true; |
---|
| 1418 | newCity.disabled = true; |
---|
| 1419 | newCity.value = ''; |
---|
| 1420 | |
---|
| 1421 | //resetAddrFillingFields(); |
---|
[1599] | 1422 | |
---|
[2] | 1423 | return; |
---|
| 1424 | |
---|
| 1425 | case '_NEW_': |
---|
| 1426 | |
---|
| 1427 | newCity.readonly = false; |
---|
| 1428 | newCity.disabled = false; |
---|
| 1429 | updateAddrNewCityOnMouseOut(); |
---|
[1599] | 1430 | |
---|
[2] | 1431 | break; |
---|
| 1432 | |
---|
| 1433 | case '_SEP_': return; |
---|
| 1434 | |
---|
| 1435 | default: |
---|
| 1436 | newCity.readonly = true; |
---|
| 1437 | newCity.disabled = true; |
---|
| 1438 | newCity.value = ''; |
---|
| 1439 | } |
---|
| 1440 | } |
---|
| 1441 | |
---|
| 1442 | function updateAddrNewCityOnMouseOver () |
---|
| 1443 | { |
---|
[1599] | 1444 | if (Element('cc_addr_cities_new').value == Element('cc_msg_type_city').value && Element('cc_addr_cities').selectedIndex == 1) |
---|
[2] | 1445 | { |
---|
| 1446 | Element('cc_addr_cities_new').value = ''; |
---|
| 1447 | } |
---|
| 1448 | } |
---|
| 1449 | |
---|
| 1450 | function updateAddrNewCityOnMouseOut () |
---|
| 1451 | { |
---|
[1599] | 1452 | if (Element('cc_addr_cities_new').value.length == 0 && Element('cc_addr_cities').selectedIndex == 1) |
---|
[2] | 1453 | { |
---|
| 1454 | Element('cc_addr_cities_new').value = Element('cc_msg_type_city').value; |
---|
| 1455 | } |
---|
| 1456 | } |
---|
| 1457 | |
---|
| 1458 | function saveAddressFields () |
---|
| 1459 | { |
---|
| 1460 | var lastIndex = CC_addr_last_selected; |
---|
| 1461 | |
---|
| 1462 | if (lastIndex == 0) |
---|
| 1463 | { |
---|
| 1464 | return true; |
---|
| 1465 | } |
---|
[1599] | 1466 | |
---|
| 1467 | var addrFields = new Array('cc_addr_1', |
---|
| 1468 | 'cc_addr_2', |
---|
| 1469 | 'cc_addr_complement', |
---|
[2] | 1470 | 'cc_addr_other', |
---|
[1599] | 1471 | 'cc_addr_postal_code', |
---|
[2] | 1472 | 'cc_addr_po_box', |
---|
| 1473 | 'cc_addr_countries', |
---|
| 1474 | 'cc_addr_states', |
---|
| 1475 | 'cc_addr_cities'); |
---|
| 1476 | |
---|
| 1477 | var empty = true; |
---|
[1599] | 1478 | |
---|
[2] | 1479 | for (var i = 0; i < 8; i++) |
---|
| 1480 | { |
---|
| 1481 | var field = Element(addrFields[i]); |
---|
| 1482 | if (field.value && field.value != '_NONE_' && field.value != '_SEP_') |
---|
| 1483 | { |
---|
| 1484 | empty = false; |
---|
| 1485 | } |
---|
| 1486 | } |
---|
[1599] | 1487 | |
---|
[2] | 1488 | if (empty) |
---|
| 1489 | { |
---|
| 1490 | return true; |
---|
| 1491 | } |
---|
| 1492 | |
---|
| 1493 | if (!CC_contact_full_info['addresses']) |
---|
| 1494 | { |
---|
| 1495 | CC_contact_full_info['addresses'] = new Array(); |
---|
| 1496 | } |
---|
| 1497 | |
---|
| 1498 | var addrInfo = CC_contact_full_info['addresses']['address'+Element('cc_addr_types').options[lastIndex].value]; |
---|
| 1499 | |
---|
| 1500 | if (!addrInfo) |
---|
| 1501 | { |
---|
| 1502 | addrInfo = new Array(); |
---|
| 1503 | } |
---|
| 1504 | |
---|
| 1505 | addrInfo['id_address'] = Element('cc_addr_id').value; |
---|
| 1506 | |
---|
| 1507 | switch(Element('cc_addr_countries').value) |
---|
| 1508 | { |
---|
| 1509 | case '_SEP_': |
---|
| 1510 | case '_NONE_': |
---|
| 1511 | addrInfo['id_country'] = false; |
---|
| 1512 | break; |
---|
| 1513 | |
---|
| 1514 | default: |
---|
| 1515 | addrInfo['id_country'] = Element('cc_addr_countries').value; |
---|
[1599] | 1516 | |
---|
[2] | 1517 | } |
---|
| 1518 | |
---|
| 1519 | switch(Element('cc_addr_states').value) |
---|
| 1520 | { |
---|
| 1521 | case '_SEP_': |
---|
| 1522 | case '_NONE_': |
---|
| 1523 | case '_NEW_': |
---|
| 1524 | case '_NOSTATE_': |
---|
| 1525 | addrInfo['id_state'] = false; |
---|
| 1526 | break; |
---|
| 1527 | |
---|
| 1528 | default: |
---|
| 1529 | addrInfo['id_state'] = Element('cc_addr_states').value; |
---|
[1599] | 1530 | |
---|
[2] | 1531 | } |
---|
| 1532 | |
---|
| 1533 | switch(Element('cc_addr_cities').value) |
---|
| 1534 | { |
---|
| 1535 | case '_SEP_': |
---|
| 1536 | case '_NONE_': |
---|
| 1537 | case '_NEW_': |
---|
| 1538 | addrInfo['id_city'] = false; |
---|
| 1539 | break; |
---|
| 1540 | |
---|
| 1541 | default: |
---|
| 1542 | addrInfo['id_city'] = Element('cc_addr_cities').value; |
---|
| 1543 | |
---|
[1599] | 1544 | } |
---|
| 1545 | |
---|
[2] | 1546 | addrInfo['id_typeof_address'] = Element('cc_addr_types').options[lastIndex].value; |
---|
| 1547 | addrInfo['address1'] = Element('cc_addr_1').value ? Element('cc_addr_1').value : false; |
---|
| 1548 | addrInfo['address2'] = Element('cc_addr_2').value ? Element('cc_addr_2').value : false; |
---|
| 1549 | addrInfo['complement'] = Element('cc_addr_complement').value ? Element('cc_addr_complement').value : false; |
---|
| 1550 | addrInfo['address_other'] = Element('cc_addr_other').value ? Element('cc_addr_other').value : false; |
---|
| 1551 | addrInfo['postal_code'] = Element('cc_addr_postal_code').value ? Element('cc_addr_postal_code').value : false; |
---|
| 1552 | addrInfo['po_box'] = Element('cc_addr_po_box').value ? Element('cc_addr_po_box').value : false; |
---|
| 1553 | addrInfo['address_is_default'] = Element('cc_addr_is_default').checked ? '1' : '0'; |
---|
| 1554 | |
---|
| 1555 | CC_contact_full_info['addresses']['address'+Element('cc_addr_types').options[lastIndex].value] = addrInfo; |
---|
| 1556 | |
---|
[1599] | 1557 | if (Element('cc_addr_cities').value == '_NEW_' && |
---|
[2] | 1558 | Element('cc_msg_type_city').value != Element('cc_addr_cities_new').value && |
---|
| 1559 | Element('cc_addr_cities_new').value != '') |
---|
| 1560 | { |
---|
| 1561 | var addrRootInfo = CC_contact_full_info['addresses']['new_cities']; |
---|
[1599] | 1562 | |
---|
[2] | 1563 | if (!addrRootInfo) |
---|
| 1564 | { |
---|
| 1565 | addrRootInfo = new Array(); |
---|
| 1566 | } |
---|
[1599] | 1567 | |
---|
[2] | 1568 | var i = addrRootInfo.length; |
---|
| 1569 | addrRootInfo[addrInfo['id_typeof_address']] = new Array(); |
---|
| 1570 | addrRootInfo[addrInfo['id_typeof_address']]['id_country'] = Element('cc_addr_countries').value; |
---|
| 1571 | addrRootInfo[addrInfo['id_typeof_address']]['id_state'] = Element('cc_addr_states').value.charAt(0) != '_' ? Element('cc_addr_states').value : null; |
---|
| 1572 | addrRootInfo[addrInfo['id_typeof_address']]['city_name'] = Element('cc_addr_cities_new').value; |
---|
| 1573 | CC_contact_full_info['addresses']['new_cities'] = addrRootInfo; |
---|
| 1574 | } |
---|
| 1575 | |
---|
[1599] | 1576 | if (Element('cc_addr_states').value == '_NEW_' && |
---|
| 1577 | Element('cc_msg_type_state').value != Element('cc_addr_states_new').value && |
---|
[2] | 1578 | Element('cc_addr_states_new').value != '') |
---|
| 1579 | { |
---|
| 1580 | var addrRootInfo = CC_contact_full_info['addresses']['new_states']; |
---|
[1599] | 1581 | |
---|
[2] | 1582 | if (!addrRootInfo) |
---|
| 1583 | { |
---|
| 1584 | addrRootInfo = new Array(); |
---|
| 1585 | } |
---|
[1599] | 1586 | |
---|
[2] | 1587 | var i = addrRootInfo.length; |
---|
| 1588 | addrRootInfo[addrInfo['id_typeof_address']] = new Array(); |
---|
| 1589 | addrRootInfo[addrInfo['id_typeof_address']]['id_country'] = Element('cc_addr_countries').value; |
---|
| 1590 | addrRootInfo[addrInfo['id_typeof_address']]['state_name'] = Element('cc_addr_states_new').value; |
---|
| 1591 | CC_contact_full_info['addresses']['new_states'] = addrRootInfo; |
---|
| 1592 | } |
---|
| 1593 | |
---|
| 1594 | return true; |
---|
| 1595 | } |
---|
| 1596 | |
---|
| 1597 | |
---|
| 1598 | /********* End Addresses Functions *********/ |
---|
| 1599 | |
---|
| 1600 | |
---|
| 1601 | |
---|
| 1602 | /********* Begin Connections Functions ************/ |
---|
| 1603 | function connGetHTMLLine () |
---|
| 1604 | { |
---|
| 1605 | var _label = (CC_contact_full_info['connections'] |
---|
| 1606 | && typeof(CC_contact_full_info['connections'][CC_conn_last_selected])!= 'undefined' |
---|
| 1607 | && typeof(CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]) != 'undefined' |
---|
| 1608 | ? CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]['name'] |
---|
| 1609 | : Element("cc_conn_type_sel").value); |
---|
| 1610 | |
---|
| 1611 | var cc_conn_default = Element("cc_phone_default").style.display == '' ? Element("cc_phone_default") : Element("cc_email_default"); |
---|
| 1612 | cc_conn_default.disabled = false; |
---|
| 1613 | var idx_conn = 0; |
---|
| 1614 | for(idx_conn; idx_conn < cc_conn_default.options.length; idx_conn++) |
---|
| 1615 | if(cc_conn_default.options[idx_conn].value == _label) |
---|
[1599] | 1616 | break; |
---|
| 1617 | |
---|
[2] | 1618 | if(idx_conn == cc_conn_default.options.length) |
---|
| 1619 | cc_conn_default.options[idx_conn] = new Option (_label,_label, false,false); |
---|
[1599] | 1620 | |
---|
[2] | 1621 | if (!document.all) |
---|
| 1622 | { |
---|
[1599] | 1623 | if (Element("cc_conn_type_1").checked) |
---|
| 1624 | { |
---|
| 1625 | 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>'+ |
---|
| 1626 | //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ |
---|
| 1627 | '<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>' + |
---|
| 1628 | '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="100" type="text"> ' + |
---|
| 1629 | '<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>'; |
---|
| 1630 | } |
---|
| 1631 | else if (Element("cc_conn_type_2").checked) |
---|
| 1632 | { |
---|
| 1633 | 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>'+ |
---|
| 1634 | //'<td style="width: 30px;" align="right"><input name="cc_conn_is_default" id="cc_conn_is_default_'+ CC_conn_count +'" type="radio"></td>'+ |
---|
| 1635 | '<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>' + |
---|
[1612] | 1636 | '<td align="left"><input id="cc_conn_value_'+ CC_conn_count +'" style="width: 150px;" maxlength="30" type="text" onkeyup="formatPhone(this)"> ' + |
---|
[1599] | 1637 | '<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>'; |
---|
| 1638 | } |
---|
[2] | 1639 | } |
---|
| 1640 | else |
---|
| 1641 | { |
---|
| 1642 | var tds = new Array(); |
---|
| 1643 | var inputs = new Array(); |
---|
| 1644 | var img = document.createElement('img'); |
---|
| 1645 | |
---|
| 1646 | for (var i = 0; i < 4; i++) |
---|
| 1647 | { |
---|
| 1648 | tds[i] = document.createElement('td'); |
---|
| 1649 | } |
---|
| 1650 | |
---|
| 1651 | tds[0].style.position = 'absolute'; |
---|
| 1652 | tds[0].style.visibility = 'hidden'; |
---|
| 1653 | tds[0].style.zIndex = '-1'; |
---|
| 1654 | |
---|
| 1655 | var remove_id = 'cc_conn_tr_'+CC_conn_count; |
---|
| 1656 | img.alt = 'X'; |
---|
| 1657 | img.src = 'templates/default/images/x.png'; |
---|
| 1658 | img.style.width = '18px'; |
---|
| 1659 | img.style.height = '18px'; |
---|
| 1660 | img.align = 'top'; |
---|
| 1661 | img.onclick = function(e){ removeConnField(remove_id);}; |
---|
[1599] | 1662 | |
---|
[2] | 1663 | for (var i = 0; i < 3; i++) |
---|
| 1664 | { |
---|
| 1665 | inputs[i] = document.createElement('input'); |
---|
| 1666 | } |
---|
| 1667 | |
---|
| 1668 | inputs[0].id = 'cc_conn_id_'+CC_conn_count; |
---|
| 1669 | inputs[0].type = 'hidden'; |
---|
| 1670 | inputs[0].value = '_NEW_'; |
---|
| 1671 | |
---|
| 1672 | inputs[1].id = 'cc_conn_name_'+CC_conn_count; |
---|
[1599] | 1673 | inputs[1].type = 'hidden'; |
---|
[2] | 1674 | |
---|
| 1675 | inputs[2].id = 'cc_conn_value_'+CC_conn_count; |
---|
| 1676 | inputs[2].type = 'text'; |
---|
| 1677 | inputs[2].style.width = '150px'; |
---|
| 1678 | |
---|
| 1679 | var _span = document.createElement("SPAN"); |
---|
| 1680 | _span.style.width = "150px"; |
---|
| 1681 | _span.id = "cc_conn_label_"+CC_conn_count; |
---|
| 1682 | _span.innerHTML = _label; |
---|
| 1683 | tds[0].appendChild(inputs[0]); |
---|
| 1684 | tds[1].appendChild(inputs[1]); |
---|
| 1685 | tds[1].align = 'right'; |
---|
| 1686 | tds[1].appendChild(_span); |
---|
| 1687 | tds[2].appendChild(inputs[2]); |
---|
| 1688 | tds[2].align = 'left'; |
---|
| 1689 | tds[2].innerHTML +=" "; |
---|
| 1690 | tds[2].appendChild(img); |
---|
| 1691 | |
---|
| 1692 | return tds; |
---|
| 1693 | } |
---|
| 1694 | } |
---|
| 1695 | |
---|
| 1696 | function connAddNewLine () |
---|
| 1697 | { |
---|
| 1698 | |
---|
| 1699 | var _emptyLine = (!CC_contact_full_info['connections'] |
---|
| 1700 | || typeof(CC_contact_full_info['connections'][CC_conn_last_selected]) == 'undefined' |
---|
| 1701 | || typeof(CC_contact_full_info['connections'][CC_conn_last_selected][CC_conn_count]) == 'undefined'); |
---|
[1599] | 1702 | |
---|
| 1703 | if(_emptyLine) { |
---|
| 1704 | |
---|
[2] | 1705 | if(Element("cc_conn_type_sel").value == '-1'){ |
---|
[1599] | 1706 | return false; |
---|
[2] | 1707 | } |
---|
[1599] | 1708 | |
---|
[2] | 1709 | for(k = 0; k < CC_conn_count; k++) { |
---|
| 1710 | if(Element("cc_conn_name_"+k) && Element("cc_conn_name_"+k).value != "" && Element("cc_conn_name_"+k).value == Element("cc_conn_type_sel").value) { |
---|
[285] | 1711 | alert('Você já possui uma entrada para o tipo "'+Element("cc_conn_type_sel").value+'"!'); |
---|
[1599] | 1712 | Element("cc_conn_type_sel").options.selectedIndex = 0; |
---|
[2] | 1713 | return false; |
---|
| 1714 | } |
---|
| 1715 | } |
---|
[1599] | 1716 | } |
---|
[2] | 1717 | if (!document.all) |
---|
| 1718 | { |
---|
| 1719 | var obj = addHTMLCode('cc_conn', 'cc_conn_tr_'+CC_conn_count, connGetHTMLLine(),'tr'); |
---|
| 1720 | } |
---|
| 1721 | else |
---|
| 1722 | { |
---|
| 1723 | var tds = connGetHTMLLine(); |
---|
| 1724 | var tr = document.createElement('tr'); |
---|
| 1725 | var tbody = Element('cc_conn'); |
---|
| 1726 | |
---|
| 1727 | tr.id = 'cc_conn_tr_'+CC_conn_count; |
---|
| 1728 | tbody.appendChild(tr); |
---|
| 1729 | |
---|
| 1730 | for (var i = 0; i < 4; i++) |
---|
| 1731 | { |
---|
| 1732 | tr.appendChild(tds[i]); |
---|
| 1733 | } |
---|
| 1734 | } |
---|
| 1735 | Element("cc_conn_name_"+CC_conn_count).value = Element("cc_conn_type_sel").value; |
---|
| 1736 | Element("cc_conn_type_sel").options.selectedIndex = 0; |
---|
| 1737 | CC_conn_count++; |
---|
| 1738 | |
---|
| 1739 | return CC_conn_count; |
---|
| 1740 | } |
---|
| 1741 | |
---|
| 1742 | function connRemoveLine(id) |
---|
[1599] | 1743 | { |
---|
[2] | 1744 | var p = Element(id).parentNode; |
---|
| 1745 | var cc_conn_default = Element("cc_phone_default").style.display == '' ? Element("cc_phone_default") : Element("cc_email_default"); |
---|
| 1746 | var _label = Element("cc_conn_label_"+(id.substring(11,13))).innerHTML; |
---|
| 1747 | for(var i = 0;i < cc_conn_default.options.length; i++) { |
---|
| 1748 | if(cc_conn_default.options[i].value == _label) { |
---|
| 1749 | cc_conn_default.options[i] = null; |
---|
| 1750 | break; |
---|
| 1751 | } |
---|
| 1752 | } |
---|
| 1753 | if(cc_conn_default.options.length == 1) |
---|
| 1754 | cc_conn_default.disabled = true; |
---|
| 1755 | |
---|
| 1756 | removeHTMLCode(id); |
---|
| 1757 | |
---|
| 1758 | return; |
---|
| 1759 | connRefreshClass(p.childNodes); |
---|
| 1760 | } |
---|
| 1761 | |
---|
| 1762 | function connRefreshClass(Nodes) |
---|
| 1763 | { |
---|
| 1764 | for (var i = 2; i < Nodes.length; i++) |
---|
| 1765 | { |
---|
| 1766 | Nodes.item(i).className = i % 2 ? 'row_on' : 'row_off'; |
---|
| 1767 | } |
---|
| 1768 | } |
---|
| 1769 | |
---|
| 1770 | function clearConn() |
---|
| 1771 | { |
---|
| 1772 | var connParent = Element('cc_conn').childNodes; |
---|
| 1773 | var i; |
---|
| 1774 | |
---|
| 1775 | for (i = connParent.length - 1; i >= 0; i--) |
---|
| 1776 | { |
---|
| 1777 | if (connParent[i].id) |
---|
| 1778 | { |
---|
| 1779 | connRemoveLine(connParent[i].id); |
---|
| 1780 | } |
---|
| 1781 | } |
---|
[1599] | 1782 | |
---|
[2] | 1783 | CC_conn_count = 0; |
---|
| 1784 | } |
---|
| 1785 | |
---|
| 1786 | function removeConnField(id) |
---|
| 1787 | { |
---|
| 1788 | var count = id.substring(id.lastIndexOf('_')+1); |
---|
| 1789 | if (Element('cc_conn_id_'+count).value != '_NEW_') |
---|
| 1790 | { |
---|
| 1791 | if (typeof(CC_contact_full_info['removed_conns']) != 'object') |
---|
| 1792 | { |
---|
| 1793 | CC_contact_full_info['removed_conns'] = new Array(); |
---|
| 1794 | } |
---|
| 1795 | |
---|
| 1796 | CC_contact_full_info['removed_conns'][CC_contact_full_info['removed_conns'].length] = Element('cc_conn_id_'+count).value; |
---|
| 1797 | } |
---|
| 1798 | |
---|
| 1799 | connRemoveLine(id); |
---|
| 1800 | } |
---|
| 1801 | |
---|
| 1802 | function updateConnFields() |
---|
| 1803 | { |
---|
[1599] | 1804 | |
---|
[2] | 1805 | var connID; |
---|
| 1806 | var i; |
---|
| 1807 | var cc_conn_type_sel = Element("cc_conn_type_sel"); |
---|
| 1808 | var cc_phone_default = Element("cc_phone_default"); |
---|
| 1809 | var cc_email_default = Element("cc_email_default"); |
---|
| 1810 | var div_cc_conn_is_default = Element("div_cc_conn_is_default"); |
---|
| 1811 | var cc_conn_is_default = ''; |
---|
| 1812 | var selected_index = ''; |
---|
[1599] | 1813 | |
---|
[2] | 1814 | cc_conn_type_sel.disabled = false; |
---|
| 1815 | div_cc_conn_is_default.style.display = ""; |
---|
[1599] | 1816 | |
---|
[2] | 1817 | for(var i = 0;i < cc_conn_type_sel.options.length; i++) |
---|
[1599] | 1818 | cc_conn_type_sel.options[i--] = null; |
---|
| 1819 | |
---|
[2] | 1820 | if(Element('cc_conn_type_1').checked) { |
---|
[285] | 1821 | var lang_new_email = Element('cc_msg_new_email').value; |
---|
| 1822 | var lang_main = Element('cc_msg_main').value; |
---|
[1599] | 1823 | var lang_alternative = Element('cc_msg_alternative').value; |
---|
| 1824 | cc_conn_type_sel[0] = new Option(lang_new_email,'-1'); |
---|
[285] | 1825 | cc_conn_type_sel[1] = new Option(lang_main,lang_main); |
---|
[1599] | 1826 | cc_conn_type_sel[2] = new Option(lang_alternative,lang_alternative); |
---|
[2] | 1827 | connID = 1; |
---|
| 1828 | selected_index = cc_email_default.options.selectedIndex; |
---|
| 1829 | for(var i = 0;i < cc_email_default.options.length; i++) { |
---|
| 1830 | cc_email_default.options[i--] = null; |
---|
| 1831 | } |
---|
| 1832 | |
---|
[285] | 1833 | var lang_select_email = Element('cc_msg_select_email').value; |
---|
[1599] | 1834 | cc_email_default.options[0] = new Option(lang_select_email,'-1'); |
---|
[2] | 1835 | cc_phone_default.style.display = 'none'; |
---|
[1599] | 1836 | cc_email_default.style.display = ''; |
---|
[2] | 1837 | cc_conn_is_default = cc_email_default; |
---|
| 1838 | } |
---|
| 1839 | else if(Element('cc_conn_type_2').checked) { |
---|
[285] | 1840 | var lang_new_telephone = Element('cc_msg_new_phone').value; |
---|
| 1841 | var lang_home = Element('cc_msg_home').value; |
---|
| 1842 | var lang_cellphone = Element('cc_msg_cellphone').value; |
---|
| 1843 | var lang_work = Element('cc_msg_work').value; |
---|
| 1844 | var lang_fax = Element('cc_msg_fax').value; |
---|
| 1845 | var lang_pager = Element('cc_msg_pager').value; |
---|
[1517] | 1846 | var lang_corporative_cellphone = Element('cc_msg_corporative_cellphone').value; |
---|
| 1847 | var lang_corporative_fax = Element('cc_msg_corporative_fax').value; |
---|
| 1848 | var lang_corporative_pager = Element('cc_msg_corporative_pager').value; |
---|
[1599] | 1849 | |
---|
| 1850 | cc_conn_type_sel[0] = new Option(lang_new_telephone,'-1'); |
---|
[285] | 1851 | cc_conn_type_sel[1] = new Option(lang_home,lang_home); |
---|
[1599] | 1852 | cc_conn_type_sel[2] = new Option(lang_cellphone,lang_cellphone); |
---|
[285] | 1853 | cc_conn_type_sel[3] = new Option(lang_work,lang_work); |
---|
| 1854 | cc_conn_type_sel[4] = new Option(lang_fax,lang_fax); |
---|
[1517] | 1855 | if (document.getElementById('cc_contact_type').value == 'advanced') { |
---|
| 1856 | cc_conn_type_sel[5] = new Option(lang_pager, lang_pager); |
---|
| 1857 | cc_conn_type_sel[6] = new Option(lang_corporative_cellphone, lang_corporative_cellphone); |
---|
| 1858 | cc_conn_type_sel[7] = new Option(lang_corporative_fax, lang_corporative_fax); |
---|
| 1859 | cc_conn_type_sel[8] = new Option(lang_corporative_pager, lang_corporative_pager); |
---|
| 1860 | } |
---|
[1599] | 1861 | |
---|
[2] | 1862 | connID = 2; |
---|
| 1863 | selected_index = cc_phone_default.options.selectedIndex; |
---|
| 1864 | for(var i = 0;i < cc_phone_default.options.length; i++) { |
---|
| 1865 | cc_phone_default.options[i--] = null; |
---|
| 1866 | } |
---|
| 1867 | |
---|
[1599] | 1868 | var lang_choose_phone = Element('cc_msg_choose_phone').value; |
---|
[285] | 1869 | cc_phone_default.options[0] = new Option(lang_choose_phone,'-1'); |
---|
[2] | 1870 | cc_email_default.style.display = 'none'; |
---|
| 1871 | cc_phone_default.style.display = ''; |
---|
| 1872 | cc_conn_is_default = cc_phone_default; |
---|
| 1873 | } |
---|
[1599] | 1874 | |
---|
[2] | 1875 | Element("cc_conn_type_sel").options.selectedIndex = 0; |
---|
| 1876 | /* First save the data */ |
---|
| 1877 | saveConnFields(); |
---|
| 1878 | |
---|
| 1879 | CC_conn_last_selected = connID; |
---|
[1599] | 1880 | |
---|
[2] | 1881 | clearConn(); |
---|
[1599] | 1882 | |
---|
[2] | 1883 | if (connID == '_NONE_') |
---|
| 1884 | { cc_conn_is_default.disabled = true; |
---|
| 1885 | return; |
---|
| 1886 | } |
---|
[1599] | 1887 | |
---|
[2] | 1888 | /* If no data already available, return */ |
---|
| 1889 | if (!CC_contact_full_info['connections']) |
---|
| 1890 | { |
---|
| 1891 | cc_conn_is_default.disabled = true; |
---|
| 1892 | return; |
---|
| 1893 | } |
---|
| 1894 | cc_conn_is_default.disabled = (!CC_contact_full_info['connections'][connID] || CC_contact_full_info['connections'][connID].length == 0); |
---|
| 1895 | /* Put the information that's already available */ |
---|
| 1896 | for (i in CC_contact_full_info['connections'][connID]) |
---|
| 1897 | { |
---|
| 1898 | var num = connAddNewLine(); |
---|
| 1899 | Element('cc_conn_id_'+i).value = CC_contact_full_info['connections'][connID][i]['id']; |
---|
| 1900 | Element('cc_conn_name_'+i).value = CC_contact_full_info['connections'][connID][i]['name']; |
---|
| 1901 | Element('cc_conn_value_'+i).value = CC_contact_full_info['connections'][connID][i]['value']; |
---|
| 1902 | |
---|
| 1903 | if(!selected_index || (selected_index == '-1' && CC_contact_full_info['connections'][connID][i]['is_default'])){ |
---|
| 1904 | for(var j = 0;j < cc_conn_is_default.options.length; j++){ |
---|
| 1905 | if(cc_conn_is_default.options[j].value == CC_contact_full_info['connections'][connID][i]['name']) { |
---|
| 1906 | selected_index = j; |
---|
| 1907 | break; |
---|
| 1908 | } |
---|
| 1909 | } |
---|
| 1910 | } |
---|
[1599] | 1911 | } |
---|
[2] | 1912 | if(cc_conn_is_default.options.length > selected_index) |
---|
| 1913 | cc_conn_is_default.options.selectedIndex = (selected_index == "-1" ? 0 : selected_index); |
---|
| 1914 | } |
---|
| 1915 | |
---|
| 1916 | function saveConnFields() |
---|
| 1917 | { |
---|
| 1918 | if (CC_conn_last_selected != 0 && CC_conn_last_selected != '_NONE_') |
---|
| 1919 | { |
---|
| 1920 | var nodes = Element('cc_conn').childNodes; |
---|
| 1921 | var k = 0; |
---|
| 1922 | |
---|
| 1923 | if (typeof(CC_contact_full_info['connections']) != 'object' || CC_contact_full_info['connections'] == null) |
---|
| 1924 | { |
---|
| 1925 | CC_contact_full_info['connections'] = new Array(); |
---|
| 1926 | CC_contact_full_info['connections'][CC_conn_last_selected] = new Array(); |
---|
| 1927 | } |
---|
| 1928 | else if (typeof(CC_contact_full_info['connections'][CC_conn_last_selected]) != 'object') |
---|
| 1929 | { |
---|
| 1930 | CC_contact_full_info['connections'][CC_conn_last_selected] = new Array(); |
---|
| 1931 | } |
---|
[1599] | 1932 | else |
---|
[2] | 1933 | { |
---|
| 1934 | delete CC_contact_full_info['connections'][CC_conn_last_selected]; |
---|
| 1935 | CC_contact_full_info['connections'][CC_conn_last_selected] = new Array(); |
---|
| 1936 | } |
---|
| 1937 | |
---|
| 1938 | for (var i = 0; i < nodes.length; i++) |
---|
| 1939 | { |
---|
| 1940 | if (nodes[i].id) |
---|
| 1941 | { |
---|
| 1942 | var subNodes = nodes[i].childNodes; |
---|
| 1943 | var found = false; |
---|
[1599] | 1944 | |
---|
[2] | 1945 | for (var j = 0; j < subNodes.length; j++) |
---|
| 1946 | { |
---|
[1599] | 1947 | if (subNodes[j].childNodes.length > 0 && |
---|
[2] | 1948 | subNodes[j].childNodes[0].id) |
---|
| 1949 | { |
---|
| 1950 | /* Check for the Connection Info array */ |
---|
| 1951 | if (typeof(CC_contact_full_info['connections'][CC_conn_last_selected][k]) != 'object') |
---|
| 1952 | { |
---|
| 1953 | CC_contact_full_info['connections'][CC_conn_last_selected][k] = new Array(); |
---|
| 1954 | } |
---|
[1599] | 1955 | |
---|
[2] | 1956 | if (subNodes[j].childNodes[0].id.indexOf('cc_conn_name') != -1) |
---|
| 1957 | { |
---|
| 1958 | if (subNodes[j].childNodes[0].value) |
---|
| 1959 | { |
---|
| 1960 | CC_contact_full_info['connections'][CC_conn_last_selected][k]['name'] = subNodes[j].childNodes[0].value; |
---|
| 1961 | } |
---|
| 1962 | else |
---|
| 1963 | { |
---|
| 1964 | CC_contact_full_info['connections'][CC_conn_last_selected][k]['name'] = ''; |
---|
| 1965 | } |
---|
| 1966 | } |
---|
| 1967 | else if (subNodes[j].childNodes[0].id.indexOf('cc_conn_value') != -1) |
---|
| 1968 | { |
---|
| 1969 | if (subNodes[j].childNodes[0].value) |
---|
| 1970 | { |
---|
| 1971 | CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = subNodes[j].childNodes[0].value; |
---|
| 1972 | } |
---|
| 1973 | else |
---|
| 1974 | { |
---|
[1599] | 1975 | CC_contact_full_info['connections'][CC_conn_last_selected][k]['value'] = ''; |
---|
[2] | 1976 | } |
---|
| 1977 | } |
---|
| 1978 | else if (subNodes[j].childNodes[0].id.indexOf('cc_conn_id') != -1) |
---|
| 1979 | { |
---|
| 1980 | CC_contact_full_info['connections'][CC_conn_last_selected][k]['id'] = subNodes[j].childNodes[0].value; |
---|
| 1981 | } |
---|
| 1982 | |
---|
| 1983 | found = true; |
---|
| 1984 | } |
---|
| 1985 | } |
---|
[1599] | 1986 | |
---|
[2] | 1987 | if (found) |
---|
| 1988 | { |
---|
| 1989 | k++; |
---|
| 1990 | } |
---|
| 1991 | } |
---|
| 1992 | } |
---|
| 1993 | |
---|
| 1994 | if (CC_contact_full_info['connections'].length == 0) |
---|
| 1995 | { |
---|
| 1996 | delete CC_contact_full_info['connections']; |
---|
| 1997 | } |
---|
| 1998 | |
---|
| 1999 | if (CC_contact_full_info['connections'][CC_conn_last_selected].length == 0) |
---|
| 2000 | { |
---|
| 2001 | delete CC_contact_full_info['connections'][CC_conn_last_selected]; |
---|
| 2002 | } |
---|
[1599] | 2003 | |
---|
[2] | 2004 | } |
---|
| 2005 | |
---|
| 2006 | return; |
---|
| 2007 | } |
---|
| 2008 | |
---|
| 2009 | /***********************************************\ |
---|
| 2010 | * VIEW CARDS FUNCTIONS * |
---|
| 2011 | \***********************************************/ |
---|
| 2012 | function removeAllEntries() |
---|
| 2013 | { |
---|
| 2014 | var handler = function (responseText) |
---|
| 2015 | { |
---|
| 2016 | var data = unserialize(responseText); |
---|
| 2017 | if (typeof(data) != 'object') { |
---|
| 2018 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 2019 | return; |
---|
| 2020 | } |
---|
| 2021 | if (data['status'] != 'ok') { |
---|
| 2022 | showMessage(data['msg']); |
---|
| 2023 | return; |
---|
| 2024 | } |
---|
| 2025 | setTimeout('updateCards()',80); |
---|
| 2026 | }; |
---|
| 2027 | var number = randomString().toLowerCase(); |
---|
| 2028 | var result = ''; |
---|
[1599] | 2029 | |
---|
[2] | 2030 | if(!is_ie) |
---|
[285] | 2031 | 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); |
---|
[2] | 2032 | else |
---|
[285] | 2033 | 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,""); |
---|
[2] | 2034 | |
---|
| 2035 | if(result) { |
---|
| 2036 | if(result.toLowerCase() == number) |
---|
| 2037 | Connector.newRequest('removeAllEntries', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_all_entries', 'GET', handler); |
---|
| 2038 | else |
---|
[285] | 2039 | alert('Código Incorreto'); |
---|
[1599] | 2040 | } |
---|
[2] | 2041 | } |
---|
| 2042 | |
---|
| 2043 | function removeEntry(id, type) |
---|
| 2044 | { |
---|
| 2045 | var question = showMessage(type == 'groups' ? Element('cc_msg_group_remove_confirm').value: Element('cc_msg_card_remove_confirm').value, 'confirm'); |
---|
| 2046 | |
---|
| 2047 | if (!question) |
---|
| 2048 | { |
---|
| 2049 | return; |
---|
| 2050 | } |
---|
[1496] | 2051 | |
---|
[2] | 2052 | var handler = function (responseText) |
---|
| 2053 | { |
---|
| 2054 | var data = unserialize(responseText); |
---|
| 2055 | |
---|
| 2056 | if (typeof(data) != 'object') |
---|
| 2057 | { |
---|
| 2058 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 2059 | return; |
---|
| 2060 | } |
---|
[1599] | 2061 | |
---|
[2] | 2062 | if (data['status'] != 'ok') |
---|
| 2063 | { |
---|
| 2064 | showMessage(data['msg']); |
---|
| 2065 | return; |
---|
| 2066 | } |
---|
[1599] | 2067 | |
---|
[2] | 2068 | setTimeout('updateCards()',80);; |
---|
| 2069 | }; |
---|
[1599] | 2070 | |
---|
[2] | 2071 | typeArg = (type == 'groups' ? 'group' : 'entry'); |
---|
[1599] | 2072 | |
---|
[2] | 2073 | Connector.newRequest('removeEntry', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=remove_'+typeArg+'&remove=' + id, 'GET', handler); |
---|
| 2074 | } |
---|
| 2075 | |
---|
| 2076 | function updateCards() |
---|
| 2077 | { |
---|
| 2078 | setHeightSpace(); |
---|
| 2079 | setMaxCards(getMaxCards()); |
---|
| 2080 | showCards(getActualLetter(), getActualPage()); |
---|
| 2081 | } |
---|
| 2082 | |
---|
| 2083 | |
---|
| 2084 | window.onresize = function () |
---|
| 2085 | { |
---|
| 2086 | updateCards(); |
---|
| 2087 | } |
---|
| 2088 | |
---|
| 2089 | |
---|
| 2090 | function setHeightSpace () |
---|
| 2091 | { |
---|
| 2092 | /* |
---|
| 2093 | var w_height = 0; |
---|
| 2094 | var w_extra = 200; |
---|
[1599] | 2095 | |
---|
[2] | 2096 | if (document.body.clientHeight) |
---|
| 2097 | { |
---|
| 2098 | w_height = parseInt(document.body.clientHeight); |
---|
| 2099 | } |
---|
| 2100 | else |
---|
| 2101 | { |
---|
| 2102 | w_height = 500; |
---|
| 2103 | } |
---|
| 2104 | if (w_height < 500) |
---|
| 2105 | { |
---|
| 2106 | w_height = 500; |
---|
| 2107 | } |
---|
| 2108 | Element('cc_card_space').style.height = (w_height - w_extra) + 'px'; |
---|
| 2109 | */ |
---|
| 2110 | } |
---|
| 2111 | |
---|
| 2112 | function selectLetter (letter_id) |
---|
| 2113 | { |
---|
| 2114 | for (var i = 0; i < 28; i++) |
---|
| 2115 | { |
---|
| 2116 | if ( i == letter_id ) |
---|
| 2117 | { |
---|
| 2118 | Element('cc_letter_' + i).className = 'letter_box_active'; |
---|
| 2119 | } |
---|
| 2120 | else |
---|
| 2121 | { |
---|
| 2122 | Element('cc_letter_' + i).className = 'letter_box'; |
---|
| 2123 | } |
---|
| 2124 | } |
---|
| 2125 | } |
---|
| 2126 | |
---|
[284] | 2127 | function clearLetterSelection() |
---|
| 2128 | { |
---|
| 2129 | for (var i = 0; i < 28; i++) |
---|
| 2130 | { |
---|
| 2131 | Element('cc_letter_' + i).className = 'letter_box'; |
---|
| 2132 | } |
---|
| 2133 | } |
---|
[1599] | 2134 | |
---|
[2] | 2135 | function getActualPage () |
---|
| 2136 | { |
---|
| 2137 | return CC_actual_page; |
---|
| 2138 | } |
---|
| 2139 | |
---|
| 2140 | function getActualLetter () |
---|
| 2141 | { |
---|
| 2142 | return CC_actual_letter; |
---|
| 2143 | } |
---|
| 2144 | |
---|
| 2145 | function getFirstPage () |
---|
| 2146 | { |
---|
| 2147 | return 1; |
---|
| 2148 | } |
---|
| 2149 | |
---|
| 2150 | function getPreviousPage () |
---|
| 2151 | { |
---|
| 2152 | if ( CC_actual_page > 1 ) |
---|
| 2153 | { |
---|
| 2154 | return CC_actual_page - 1; |
---|
| 2155 | } |
---|
| 2156 | else |
---|
| 2157 | { |
---|
| 2158 | return 1; |
---|
| 2159 | } |
---|
| 2160 | } |
---|
| 2161 | |
---|
| 2162 | function getNextPage () |
---|
| 2163 | { |
---|
| 2164 | if ( CC_actual_page < CC_npages ) |
---|
| 2165 | { |
---|
| 2166 | return CC_actual_page + 1; |
---|
| 2167 | } |
---|
| 2168 | else |
---|
| 2169 | { |
---|
| 2170 | return CC_npages; |
---|
| 2171 | } |
---|
| 2172 | } |
---|
| 2173 | |
---|
| 2174 | function getLastPage () |
---|
| 2175 | { |
---|
| 2176 | return CC_npages; |
---|
| 2177 | } |
---|
| 2178 | |
---|
| 2179 | function setPages (npages, actual_page, showing_page) |
---|
| 2180 | { |
---|
| 2181 | var html_pages = ''; |
---|
| 2182 | var n_lines = 0; |
---|
| 2183 | var page_count = 0; |
---|
| 2184 | |
---|
| 2185 | if (CC_npages == 0) |
---|
| 2186 | { |
---|
| 2187 | html_pages = ''; |
---|
| 2188 | } |
---|
| 2189 | else |
---|
| 2190 | { |
---|
| 2191 | var page = 1; |
---|
| 2192 | if (showing_page > 10 || (!showing_page && actual_page > 10)) |
---|
| 2193 | { |
---|
| 2194 | var final_page = showing_page? showing_page-11 : actual_page-11; |
---|
| 2195 | if (final_page < 1) |
---|
| 2196 | { |
---|
| 2197 | final_page = 1; |
---|
| 2198 | } |
---|
[1599] | 2199 | |
---|
[2] | 2200 | html_pages += '<a href="javascript:setPages('+npages+', '+ actual_page +', '+ final_page +')">...</a> '; |
---|
| 2201 | |
---|
| 2202 | page = showing_page ? showing_page : actual_page; |
---|
| 2203 | } |
---|
[1599] | 2204 | |
---|
[2] | 2205 | for (; page <= npages; page++) |
---|
| 2206 | { |
---|
| 2207 | if (page_count > 10) |
---|
| 2208 | { |
---|
| 2209 | html_pages += '<a href="javascript:setPages('+npages+', '+ actual_page +', '+ page +');">...</a>'; |
---|
| 2210 | break; |
---|
| 2211 | } |
---|
| 2212 | if ( page == actual_page ) |
---|
| 2213 | { |
---|
| 2214 | html_pages += '<b>'+page+'</b>'; |
---|
| 2215 | } |
---|
| 2216 | else |
---|
| 2217 | { |
---|
| 2218 | html_pages += '<a href="javascript:showCards(\'' + CC_actual_letter + '\',' + page + ')">' + page + '</a>'; |
---|
| 2219 | } |
---|
| 2220 | html_pages += ' '; |
---|
| 2221 | page_count++; |
---|
| 2222 | } |
---|
| 2223 | } |
---|
| 2224 | |
---|
| 2225 | if (actual_page <= 1) |
---|
| 2226 | { |
---|
| 2227 | Element('cc_panel_arrow_first').onclick = ''; |
---|
| 2228 | Element('cc_panel_arrow_previous').onclick = ''; |
---|
| 2229 | Element('cc_panel_arrow_first').style.cursor = 'auto'; |
---|
| 2230 | Element('cc_panel_arrow_previous').style.cursor = 'auto'; |
---|
| 2231 | } |
---|
| 2232 | else |
---|
| 2233 | { |
---|
| 2234 | Element('cc_panel_arrow_first').onclick = function (event) { showCards(getActualLetter(), getFirstPage()); }; |
---|
| 2235 | Element('cc_panel_arrow_previous').onclick = function (event) { showCards(getActualLetter(), getPreviousPage()); }; |
---|
| 2236 | if (is_mozilla) |
---|
| 2237 | { |
---|
| 2238 | Element('cc_panel_arrow_first').style.cursor = 'pointer'; |
---|
| 2239 | Element('cc_panel_arrow_previous').style.cursor = 'pointer'; |
---|
| 2240 | } |
---|
| 2241 | Element('cc_panel_arrow_first').style.cursor = 'hand'; |
---|
| 2242 | Element('cc_panel_arrow_previous').style.cursor = 'hand'; |
---|
| 2243 | } |
---|
| 2244 | |
---|
| 2245 | if (actual_page == CC_npages) |
---|
| 2246 | { |
---|
| 2247 | Element('cc_panel_arrow_next').onclick = ''; |
---|
| 2248 | Element('cc_panel_arrow_last').onclick = ''; |
---|
| 2249 | Element('cc_panel_arrow_next').style.cursor = 'auto'; |
---|
| 2250 | Element('cc_panel_arrow_last').style.cursor = 'auto'; |
---|
| 2251 | } |
---|
| 2252 | else |
---|
| 2253 | { |
---|
| 2254 | Element('cc_panel_arrow_next').onclick = function (event) { showCards(getActualLetter(), getNextPage()); }; |
---|
| 2255 | Element('cc_panel_arrow_last').onclick = function (event) { showCards(getActualLetter(), getLastPage()); }; |
---|
| 2256 | if (is_mozilla) |
---|
| 2257 | { |
---|
| 2258 | Element('cc_panel_arrow_next').style.cursor = 'pointer'; |
---|
| 2259 | Element('cc_panel_arrow_last').style.cursor = 'pointer'; |
---|
| 2260 | } |
---|
| 2261 | Element('cc_panel_arrow_next').style.cursor = 'hand'; |
---|
| 2262 | Element('cc_panel_arrow_last').style.cursor = 'hand'; |
---|
| 2263 | } |
---|
[1599] | 2264 | |
---|
[2] | 2265 | Element('cc_panel_pages').innerHTML = html_pages; |
---|
| 2266 | } |
---|
| 2267 | |
---|
| 2268 | function populateCards(data, type) |
---|
| 2269 | { |
---|
[285] | 2270 | if (data[3].length >= 100 ) |
---|
| 2271 | { |
---|
| 2272 | alert("Critério de pesquisa muito abrangente, achados " + data[3].length + " resultados"); |
---|
| 2273 | for (i = 0; i < (Math.sqrt(data[3].length)-1); i++) |
---|
| 2274 | for (j = 0; j < 3; j++) |
---|
| 2275 | document.getElementById("cc_card:"+j+":"+i).innerHTML = ''; |
---|
[1599] | 2276 | return false; |
---|
[285] | 2277 | } |
---|
[1599] | 2278 | |
---|
| 2279 | if(type == 'groups' || type =='shared_groups') |
---|
[752] | 2280 | return populateGroupsInCards(data,type); |
---|
[1599] | 2281 | |
---|
[2] | 2282 | var pos = 0; |
---|
| 2283 | var ncards = data[3].length; |
---|
[1599] | 2284 | |
---|
[2] | 2285 | if (typeof(data[3]) == 'object' && ncards > 0) |
---|
| 2286 | { |
---|
| 2287 | for (var i = 0; i < CC_max_cards[1]; i++) |
---|
| 2288 | { |
---|
| 2289 | for (var j = 0; j < CC_max_cards[0]; j++) |
---|
| 2290 | { |
---|
| 2291 | id = 'cc_card:'+j+':'+i; |
---|
[1599] | 2292 | |
---|
[2] | 2293 | for (var k = 0; k < data[2].length; k++) |
---|
| 2294 | { |
---|
[285] | 2295 | if(!(ccTree.catalog_perms & 2)) |
---|
| 2296 | { |
---|
| 2297 | switch(data[2][k]) |
---|
| 2298 | { |
---|
| 2299 | case 'cc_mail' : |
---|
[2] | 2300 | |
---|
[285] | 2301 | if(data[3][pos][k] === 'none') |
---|
| 2302 | data[3][pos][k] = ' '; |
---|
| 2303 | break; |
---|
| 2304 | case 'cc_phone' : |
---|
| 2305 | |
---|
| 2306 | if(data[3][pos][k] === 'none') |
---|
| 2307 | data[3][pos][k] = ' '; |
---|
| 2308 | break; |
---|
| 2309 | } |
---|
[1599] | 2310 | |
---|
[285] | 2311 | } |
---|
[1599] | 2312 | |
---|
| 2313 | |
---|
[285] | 2314 | /*if(data[2][k] == 'cc_mail' && data[3][pos][k] == 'none' && !(ccTree.catalog_perms & 2) ) { |
---|
[2] | 2315 | Element(id).style.display = 'none'; |
---|
| 2316 | continue; |
---|
[285] | 2317 | }*/ |
---|
[1599] | 2318 | |
---|
[2] | 2319 | if(data[3][pos][k] != 'none') |
---|
| 2320 | { |
---|
[1650] | 2321 | data[3][pos][k] = unescape(data[3][pos][k]); |
---|
[2] | 2322 | switch (data[2][k]) |
---|
| 2323 | { |
---|
| 2324 | case 'cc_name': |
---|
| 2325 | if (data[3][pos][k].length > 50) |
---|
| 2326 | { |
---|
| 2327 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 50); |
---|
| 2328 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2329 | } |
---|
| 2330 | else |
---|
| 2331 | { |
---|
| 2332 | Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; |
---|
| 2333 | } |
---|
[1599] | 2334 | if(data[3][pos][12]) |
---|
| 2335 | Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][12]+"</i></font></span>"; |
---|
[2] | 2336 | break; |
---|
[1599] | 2337 | |
---|
[2] | 2338 | case 'cc_mail': |
---|
| 2339 | if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) |
---|
| 2340 | { |
---|
| 2341 | Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ adjustString(data[3][pos][k], (CC_visual == 'table' ? 50 : 20))+'</span>'; |
---|
| 2342 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2343 | } |
---|
| 2344 | else |
---|
| 2345 | { |
---|
[1599] | 2346 | Element(id+':'+data[2][k]).innerHTML = data[5] + data[3][pos][k] + '\')">'+ data[3][pos][k]+'</span>'; |
---|
[2] | 2347 | } |
---|
| 2348 | break; |
---|
[1599] | 2349 | |
---|
[2] | 2350 | case 'cc_phone': |
---|
| 2351 | if (data[3][pos][k].length > 20) |
---|
| 2352 | { |
---|
| 2353 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); |
---|
| 2354 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2355 | } |
---|
| 2356 | else |
---|
| 2357 | { |
---|
| 2358 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); |
---|
| 2359 | } |
---|
[1613] | 2360 | Element(id+':cc_phone').innerHTML = (data[3][pos][k].length < 23) ? data[3][pos][k]:data[3][pos][k].substr(0,22)+"<br>"+data[3][pos][k].substr(22,data[3][pos][k].length); |
---|
[2] | 2361 | break; |
---|
| 2362 | |
---|
| 2363 | case 'cc_title': |
---|
| 2364 | if (data[3][pos][k].length > 15) |
---|
| 2365 | { |
---|
| 2366 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); |
---|
| 2367 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2368 | } |
---|
| 2369 | else |
---|
| 2370 | { |
---|
| 2371 | Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; |
---|
| 2372 | } |
---|
| 2373 | break; |
---|
| 2374 | |
---|
| 2375 | case 'cc_id': |
---|
| 2376 | var id_contact = data[3][pos][k]; |
---|
| 2377 | Element(id+':'+data[2][k]).value = data[3][pos][k]; |
---|
[12] | 2378 | 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] : ''); |
---|
[2] | 2379 | if(ccTree.catalog_perms == 1) |
---|
[4500] | 2380 | { |
---|
[285] | 2381 | 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>'; |
---|
[4500] | 2382 | if (data[12] == true || data[12] == 'true') |
---|
| 2383 | Element(id+':cc_icon_data').innerHTML += " | " + '<span title="'+ Element('cc_msg_show_extra_detail').value+'" id="' + id + ':ccContactDetails" onclick="javascript:openContactDetails(\'' + Element(id+':cc_id').value + '\');" style="cursor: pointer; cursor: hand; z-index: 1"><img src="templates/default/images/addressbook-mini.png" align="center"></span>'; |
---|
| 2384 | } |
---|
[2] | 2385 | break; |
---|
| 2386 | |
---|
| 2387 | case 'cc_forwarding_address': |
---|
[880] | 2388 | var account_type = data[3][pos][k]; |
---|
[1599] | 2389 | |
---|
[880] | 2390 | if( !account_type) |
---|
[2] | 2391 | break; |
---|
[4275] | 2392 | else |
---|
[4305] | 2393 | if (account_type == 'list' || account_type == 'group') |
---|
[4275] | 2394 | icon = '<img src="templates/default/images/people-mini.png" align="center">'; |
---|
| 2395 | else |
---|
| 2396 | icon = ''; |
---|
| 2397 | |
---|
| 2398 | Element(id+':cc_icon_group').innerHTML = '<span title="'+Element('cc_participants').value+'" onmouseout="window.status=\'\';" onclick="ccListParticipants.showList(\''+ Element(id+':cc_id').value + '\',null,null,null,\''+account_type+'\');return true;" style="cursor: pointer; cursor: hand; z-index: 1">'+icon+' </span>'; |
---|
| 2399 | break; |
---|
[1599] | 2400 | |
---|
[2] | 2401 | |
---|
[1599] | 2402 | //Para tratar tamanho do campo "celular" do empregado |
---|
| 2403 | case 'cc_mobile': |
---|
| 2404 | if (data[3][pos][k].length > 20) |
---|
| 2405 | { |
---|
| 2406 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); |
---|
| 2407 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2408 | } |
---|
| 2409 | else |
---|
| 2410 | { |
---|
| 2411 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); |
---|
| 2412 | } |
---|
| 2413 | Element(id+':cc_mobile').innerHTML = data[3][pos][k]; |
---|
| 2414 | break; |
---|
| 2415 | |
---|
| 2416 | //Para tratar tamanho do campo "matricula" do empregado |
---|
| 2417 | case 'cc_empNumber': |
---|
| 2418 | if (data[3][pos][k].length > 20) |
---|
| 2419 | { |
---|
| 2420 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); |
---|
| 2421 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2422 | } |
---|
| 2423 | else |
---|
| 2424 | { |
---|
| 2425 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 20); |
---|
| 2426 | } |
---|
| 2427 | Element(id+':cc_empNumber').innerHTML = data[3][pos][k]; |
---|
| 2428 | break; |
---|
| 2429 | |
---|
| 2430 | //Para tratar tamanho do campo "departamento" do empregado |
---|
| 2431 | case 'cc_department': |
---|
| 2432 | if (data[3][pos][k].length > 15) |
---|
| 2433 | { |
---|
| 2434 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); |
---|
| 2435 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2436 | } |
---|
| 2437 | else |
---|
| 2438 | { |
---|
| 2439 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 15); |
---|
| 2440 | } |
---|
| 2441 | Element(id+':cc_department').innerHTML = data[3][pos][k]; |
---|
| 2442 | break; |
---|
| 2443 | |
---|
[2] | 2444 | default: |
---|
| 2445 | if (data[3][pos][k].length > 10) |
---|
| 2446 | { |
---|
| 2447 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 10); |
---|
| 2448 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2449 | } |
---|
| 2450 | else |
---|
| 2451 | { |
---|
[1599] | 2452 | if (Element(id+':'+data[2][k]) == null) alert('É nulo'); |
---|
[2] | 2453 | Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; |
---|
| 2454 | } |
---|
| 2455 | } |
---|
| 2456 | } |
---|
[1599] | 2457 | } |
---|
| 2458 | |
---|
[752] | 2459 | if (type == "shared_contacts") { |
---|
[1599] | 2460 | if (data[3][pos][11] & 4) |
---|
[503] | 2461 | eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedContact(Element('"+id+"' + ':cc_id').value);};"); |
---|
| 2462 | else |
---|
| 2463 | document.getElementById(id + ':cc_card_edit').onclick = function(){ |
---|
| 2464 | alert(Element('cc_msg_not_allowed').value); |
---|
| 2465 | }; |
---|
[1599] | 2466 | if (data[3][pos][11] & 8) |
---|
[503] | 2467 | eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value);};"); |
---|
| 2468 | else |
---|
| 2469 | document.getElementById(id + ':cc_card_remove').onclick = function(){ |
---|
| 2470 | alert(Element('cc_msg_not_allowed').value); |
---|
| 2471 | }; |
---|
| 2472 | } |
---|
[1599] | 2473 | |
---|
[2] | 2474 | if (--ncards == 0) |
---|
| 2475 | { |
---|
| 2476 | j = CC_max_cards[0]; |
---|
| 2477 | i = CC_max_cards[1]; |
---|
| 2478 | } |
---|
[1599] | 2479 | |
---|
[2] | 2480 | pos++; |
---|
| 2481 | } |
---|
| 2482 | } |
---|
| 2483 | } |
---|
| 2484 | } |
---|
| 2485 | |
---|
[752] | 2486 | function populateGroupsInCards(data,type) |
---|
[1599] | 2487 | { |
---|
[2] | 2488 | var pos = 0; |
---|
[1599] | 2489 | var contacts = data[5]; |
---|
[2] | 2490 | var ncards = data[3].length; |
---|
[1599] | 2491 | |
---|
[2] | 2492 | if (typeof(data[3]) == 'object' && ncards > 0) |
---|
| 2493 | { |
---|
| 2494 | for (var i = 0; i < CC_max_cards[1]; i++) |
---|
| 2495 | { |
---|
| 2496 | for (var j = 0; j < CC_max_cards[0]; j++) |
---|
| 2497 | { |
---|
| 2498 | id = 'cc_card:'+j+':'+i; |
---|
[1599] | 2499 | |
---|
[2] | 2500 | for (var k = 0; k < data[2].length; k++) |
---|
| 2501 | { |
---|
[1599] | 2502 | |
---|
[2] | 2503 | if(data[3][pos][k] != 'none') |
---|
[1599] | 2504 | { |
---|
| 2505 | |
---|
[2] | 2506 | switch (data[2][k]) |
---|
[1599] | 2507 | { |
---|
[2] | 2508 | case 'cc_title': |
---|
| 2509 | if (data[3][pos][k].length > 50) |
---|
| 2510 | { |
---|
| 2511 | Element(id+':'+data[2][k]).innerHTML = adjustString(data[3][pos][k], 50); |
---|
| 2512 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2513 | } |
---|
| 2514 | else |
---|
| 2515 | { |
---|
| 2516 | Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; |
---|
| 2517 | } |
---|
[752] | 2518 | if(data[3][pos][5]) |
---|
| 2519 | Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][5]+"</i></font></span>"; |
---|
[2] | 2520 | break; |
---|
[1599] | 2521 | |
---|
[2] | 2522 | case 'cc_short_name': |
---|
| 2523 | if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) |
---|
| 2524 | { |
---|
[752] | 2525 | Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k]+'::'+data[3][pos][6] +'\')">'+adjustString(data[3][pos][k], (CC_visual == 'table' ? 50 : 20))+'</span>'; |
---|
[2] | 2526 | Element(id+':'+data[2][k]).title = data[3][pos][k]; |
---|
| 2527 | } |
---|
| 2528 | else |
---|
| 2529 | { |
---|
[752] | 2530 | Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k]+(data[3][pos][6] ? '::'+data[3][pos][6] : "") + '\')">'+data[3][pos][k]+'</span>'; |
---|
[2] | 2531 | } |
---|
| 2532 | break; |
---|
[1599] | 2533 | |
---|
[2] | 2534 | case 'cc_contacts': |
---|
| 2535 | |
---|
| 2536 | var id_group = data[3][pos][k-1]; |
---|
| 2537 | var title = data[3][pos][k-3]; |
---|
| 2538 | contacts = data[3][pos][k]; |
---|
| 2539 | var contact = ""; |
---|
| 2540 | var email = ""; |
---|
| 2541 | |
---|
[1599] | 2542 | for (var d = 0; d < contacts.length; d++) { |
---|
[2] | 2543 | contact += contacts[d]['names_ordered']+ ","; |
---|
| 2544 | email += contacts[d]['connection_value']+","; |
---|
| 2545 | } |
---|
[1599] | 2546 | |
---|
[2] | 2547 | 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>'; |
---|
[1599] | 2548 | |
---|
[2] | 2549 | break; |
---|
[1599] | 2550 | |
---|
[2] | 2551 | case 'cc_id': |
---|
| 2552 | var id_contact = data[3][pos][k]; |
---|
| 2553 | Element(id+':'+data[2][k]).value = data[3][pos][k]; |
---|
[1599] | 2554 | |
---|
[2] | 2555 | break; |
---|
[1599] | 2556 | |
---|
[2] | 2557 | } |
---|
| 2558 | } |
---|
| 2559 | } |
---|
[1599] | 2560 | |
---|
[752] | 2561 | if (type == "shared_groups") { |
---|
[1280] | 2562 | |
---|
[752] | 2563 | if (data[3][pos][4] & 4) |
---|
[1280] | 2564 | eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedGroup(Element('"+id+"' + ':cc_id').value,"+data[3][pos][7]+");};"); |
---|
| 2565 | else |
---|
| 2566 | document.getElementById(id + ':cc_card_edit').onclick = function(){ alert(Element('cc_msg_not_allowed').value); }; |
---|
| 2567 | |
---|
[752] | 2568 | if (data[3][pos][4] & 8) |
---|
| 2569 | eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value,'groups');};"); |
---|
| 2570 | else |
---|
| 2571 | document.getElementById(id + ':cc_card_remove').onclick = function(){ |
---|
| 2572 | alert(Element('cc_msg_not_allowed').value); |
---|
| 2573 | }; |
---|
| 2574 | } |
---|
[1599] | 2575 | |
---|
[2] | 2576 | if (--ncards == 0) |
---|
| 2577 | { |
---|
| 2578 | j = CC_max_cards[0]; |
---|
| 2579 | i = CC_max_cards[1]; |
---|
| 2580 | } |
---|
[1599] | 2581 | |
---|
[2] | 2582 | pos++; |
---|
| 2583 | } |
---|
| 2584 | } |
---|
| 2585 | } |
---|
| 2586 | } |
---|
| 2587 | |
---|
| 2588 | function adjustString (str, max_chars) |
---|
| 2589 | { |
---|
| 2590 | if (str.length > max_chars) |
---|
| 2591 | { |
---|
| 2592 | return str.substr(0,max_chars) + '...'; |
---|
| 2593 | } |
---|
| 2594 | else |
---|
| 2595 | { |
---|
| 2596 | return str; |
---|
| 2597 | } |
---|
| 2598 | } |
---|
| 2599 | |
---|
| 2600 | function setMaxCards (maxcards) |
---|
| 2601 | { |
---|
| 2602 | CC_max_cards = maxcards; |
---|
| 2603 | ncards = maxcards[0] * maxcards[1]; |
---|
| 2604 | |
---|
| 2605 | var handler = function (responseText) |
---|
| 2606 | { |
---|
| 2607 | showMessage('ok'); |
---|
| 2608 | }; |
---|
| 2609 | |
---|
[1599] | 2610 | Connector.newRequest('setMaxCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=set_n_cards&ncards=' + ncards, 'GET'); |
---|
[2] | 2611 | } |
---|
| 2612 | |
---|
| 2613 | function getMaxCards () |
---|
| 2614 | { |
---|
| 2615 | var coord = new Array(); |
---|
[1599] | 2616 | |
---|
[2] | 2617 | card_space_width = parseInt(Element('cc_main').offsetWidth) - parseInt(Element('cc_left').offsetWidth) - parseInt(CC_card_extra); |
---|
| 2618 | card_space_height = parseInt(Element('cc_card_space').offsetHeight) - parseInt(CC_card_extra); |
---|
[1599] | 2619 | |
---|
[2] | 2620 | card_width = CC_card_image_width + CC_card_extra; |
---|
| 2621 | card_height = CC_card_image_height + CC_card_extra; |
---|
| 2622 | |
---|
| 2623 | ncols = parseInt(card_space_width / card_width); |
---|
| 2624 | nlines = parseInt(card_space_height / card_height); |
---|
[1599] | 2625 | |
---|
[2] | 2626 | coord[0] = ncols; |
---|
| 2627 | coord[1] = 10; |
---|
| 2628 | |
---|
| 2629 | return coord; |
---|
| 2630 | } |
---|
| 2631 | |
---|
| 2632 | function getCardHTML (id, type) |
---|
| 2633 | { |
---|
[752] | 2634 | if(type == 'groups' || type == 'shared_groups') { |
---|
[503] | 2635 | html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + |
---|
[1599] | 2636 | '<div style="border: 0px solid #999; position: relative;">' + |
---|
[503] | 2637 | '<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);">' + |
---|
| 2638 | '<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">' + |
---|
[1599] | 2639 | '<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">' + |
---|
[503] | 2640 | '<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>' + |
---|
| 2641 | '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + |
---|
[752] | 2642 | '<span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_short_name" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + |
---|
[503] | 2643 | '<input id="' + id + ':cc_id" type="hidden">' + |
---|
| 2644 | '</div>' + '</td>'; |
---|
[1599] | 2645 | |
---|
[503] | 2646 | } |
---|
| 2647 | else { |
---|
[2] | 2648 | html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + |
---|
| 2649 | '<div style="border: 0px solid #999; position: relative;">' + |
---|
[1599] | 2650 | '<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);">' + |
---|
[2] | 2651 | ( ccTree.catalog_perms == 1 ? |
---|
| 2652 | '<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>':'') + |
---|
| 2653 | (ccTree.catalog_perms & 2 ? |
---|
| 2654 | '<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">' + |
---|
| 2655 | '<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">' : '') + |
---|
[1599] | 2656 | '<img id="' + id + ':cc_photo" style="position: absolute; top: 15px; left: 7px;" src="" border="0" ondblclick="editContact(Element(\'' + id + ':cc_id\').value);">' + |
---|
[2] | 2657 | '<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>' + |
---|
[1599] | 2658 | '<span style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 100px; left: 35px" valign="bottom" id="' + id + ':cc_icon_group"> </span>'+ |
---|
| 2659 | //Para exibir a matricula do empregado nos cartoes |
---|
| 2660 | '<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>' + |
---|
| 2661 | '<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>' + |
---|
| 2662 | '<span id="' + id + ':cc_title" style="position: absolute; top: 50px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 12px; text-align: center; height: 10px;"></span>' + |
---|
| 2663 | //Para exibir o setor/lotacao do empregado nos cartoes |
---|
| 2664 | '<span id="' + id + ':cc_department" style="position: absolute; top: 60px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + |
---|
| 2665 | '<span id="' + id + ':cc_phone" style="position: absolute; top: 75px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + |
---|
| 2666 | //Para exibir o celular empresarial do empregado na tabela |
---|
| 2667 | '<span id="' + id + ':cc_mobile" style="position: absolute; top: 90px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + |
---|
| 2668 | '<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>' + |
---|
| 2669 | '<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>' + |
---|
[2] | 2670 | '<input id="' + id + ':cc_id" type="hidden">' + |
---|
| 2671 | '</div>' + '</td>'; |
---|
| 2672 | } |
---|
| 2673 | |
---|
| 2674 | return html_card; |
---|
| 2675 | } |
---|
| 2676 | |
---|
| 2677 | function getTableHTML (id, type) |
---|
| 2678 | { |
---|
| 2679 | var bg = ""; |
---|
| 2680 | if(!is_ie) |
---|
| 2681 | bg = "this.style.background=\'\'"; |
---|
| 2682 | else |
---|
| 2683 | bg = "this.style.background=\'#EEEEEE\'"; |
---|
[752] | 2684 | if(type == 'groups' || type == 'shared_groups') { |
---|
[503] | 2685 | html_card = '<tr width="40%" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' + |
---|
| 2686 | '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1"></span>' + |
---|
| 2687 | '<span id="' + id + ':cc_title"></span></td>' + |
---|
[752] | 2688 | '<td width="40%" style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_short_name"></span></td>' + |
---|
[503] | 2689 | '<td align="left" width="55px">'+ |
---|
| 2690 | '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style=" cursor: pointer; cursor: hand; z-index: 1;width: 18px; height: 18px;" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" src="templates/default/images/cc_card_edit.png">' + |
---|
| 2691 | ' | '+ |
---|
| 2692 | '<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">' + |
---|
[1599] | 2693 | '<input id="' + id + ':cc_id" type="hidden">'+ |
---|
[503] | 2694 | '</td></tr>'; |
---|
[1599] | 2695 | } |
---|
| 2696 | else { |
---|
| 2697 | html_card = '<tr style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE">' + |
---|
| 2698 | //Para exibir a matricula do empregado na tabela |
---|
[3796] | 2699 | (preferences.empNumShow && ccTree.catalog_perms == 1 ? '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_empNumber"></span></td>' : '') + |
---|
[1599] | 2700 | '<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>' + |
---|
| 2701 | '<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>' + |
---|
| 2702 | '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + |
---|
| 2703 | //Para exibir o celular empresarial do empregado na tabela |
---|
[3796] | 2704 | (preferences.cellShow && ccTree.catalog_perms == 1 ? '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_mobile"></span></td>' : '') + |
---|
[1599] | 2705 | //Para exibir o setor/lotacao do empregado na tabela |
---|
[3796] | 2706 | (preferences.departmentShow && ccTree.catalog_perms == 1 ? '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_department"></span></td>' : '') + |
---|
[2] | 2707 | ( ccTree.catalog_perms == 1 ? |
---|
[3796] | 2708 | '<td align="left"><span valign="bottom" id="' + id + ':cc_icon_data"></span></td>':'') + |
---|
| 2709 | (ccTree.catalog_perms & 2 ? |
---|
[2] | 2710 | '<td align="left" >'+ |
---|
| 2711 | '<img title="'+Element('cc_msg_card_edit').value+'" id="' + id + ':cc_card_edit" style=" cursor: pointer; cursor: hand; z-index: 1;width: 18px; height: 18px;" onclick="editContact(Element(\'' + id + ':cc_id\').value);" src="templates/default/images/cc_card_edit.png">' + |
---|
| 2712 | ' | '+ |
---|
| 2713 | '<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">' : '') + |
---|
| 2714 | '<input id="' + id + ':cc_id" type="hidden">'+ |
---|
[284] | 2715 | '<input type="hidden" id="' + id + ':cc_photo">' + |
---|
| 2716 | '<span id="' + id + ':cc_title" style="display:none"></span>' + |
---|
| 2717 | '<span id="' + id + ':cc_alias" style="display:none"></span>' + |
---|
[285] | 2718 | // Esse campo é necessário se o contato possui dados no campo cc_company |
---|
[284] | 2719 | '<span id="' + id + ':cc_company" style="display:none"></span>' + |
---|
[2] | 2720 | '</td></tr>'; |
---|
| 2721 | } |
---|
| 2722 | |
---|
| 2723 | return html_card; |
---|
| 2724 | } |
---|
| 2725 | |
---|
| 2726 | function drawTable(ncards, type) |
---|
| 2727 | { |
---|
| 2728 | var pos; |
---|
[1599] | 2729 | |
---|
[2] | 2730 | html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1"><table width="100%" border="0" cellpadding="0" cellspacing="3">'; |
---|
[1599] | 2731 | |
---|
[2] | 2732 | if (ncards > 0) |
---|
| 2733 | { |
---|
| 2734 | |
---|
| 2735 | for (var i = 0; i < CC_max_cards[1]; i++) |
---|
| 2736 | { |
---|
| 2737 | html_cards += ''; |
---|
| 2738 | for (var j = 0; j < CC_max_cards[0]; j++) |
---|
| 2739 | { |
---|
| 2740 | html_cards += getTableHTML('cc_card:' + j + ':' + i, type); |
---|
| 2741 | if (--ncards == 0) |
---|
| 2742 | { |
---|
| 2743 | j = CC_max_cards[0]; |
---|
| 2744 | i = CC_max_cards[1]; |
---|
| 2745 | } |
---|
| 2746 | } |
---|
| 2747 | html_cards += ''; |
---|
| 2748 | } |
---|
[752] | 2749 | if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') |
---|
[2] | 2750 | html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; |
---|
[1599] | 2751 | } |
---|
[2] | 2752 | else if (CC_max_cards != 0) |
---|
| 2753 | { |
---|
| 2754 | html_cards += '<tr><td align="center">' + Element('cc_msg_no_cards').value + '</td></tr>'; |
---|
| 2755 | } |
---|
| 2756 | else |
---|
| 2757 | { |
---|
| 2758 | html_cards += '<tr><td align="center">' + Element('cc_msg_err_no_room').value + '</td></tr>'; |
---|
| 2759 | } |
---|
| 2760 | |
---|
| 2761 | html_cards += '</table></div>'; |
---|
| 2762 | |
---|
| 2763 | Element('cc_card_space').innerHTML = html_cards; |
---|
| 2764 | } |
---|
| 2765 | |
---|
| 2766 | function drawCards(ncards, type) |
---|
| 2767 | { |
---|
| 2768 | var pos; |
---|
| 2769 | html_cards = '<div id="divScrollMain" style="overflow:auto;z-index:1">'; |
---|
| 2770 | html_cards += '<table border="0" cellpadding="0" cellspacing="' + CC_card_extra + '">'; |
---|
[1599] | 2771 | |
---|
[2] | 2772 | if (ncards > 0) |
---|
| 2773 | { |
---|
| 2774 | for (var i = 0; i < CC_max_cards[1]; i++) |
---|
| 2775 | { |
---|
| 2776 | html_cards += '<tr>'; |
---|
| 2777 | for (var j = 0; j < CC_max_cards[0]; j++) |
---|
| 2778 | { |
---|
| 2779 | html_cards += getCardHTML('cc_card:' + j + ':' + i, type); |
---|
| 2780 | if (--ncards == 0) |
---|
| 2781 | { |
---|
| 2782 | j = CC_max_cards[0]; |
---|
| 2783 | i = CC_max_cards[1]; |
---|
| 2784 | } |
---|
| 2785 | } |
---|
| 2786 | html_cards += '</tr>'; |
---|
| 2787 | } |
---|
[752] | 2788 | if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') |
---|
[2] | 2789 | html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; |
---|
[1599] | 2790 | } |
---|
[2] | 2791 | else if (CC_max_cards != 0) |
---|
| 2792 | { |
---|
| 2793 | html_cards += '<tr><td>' + Element('cc_msg_no_cards').value + '</td></tr>'; |
---|
| 2794 | } |
---|
| 2795 | else |
---|
| 2796 | { |
---|
| 2797 | html_cards += '<tr><td>' + Element('cc_msg_err_no_room').value + '</td></tr>'; |
---|
| 2798 | } |
---|
| 2799 | |
---|
| 2800 | html_cards += '</table></div>'; |
---|
| 2801 | |
---|
| 2802 | Element('cc_card_space').innerHTML = html_cards; |
---|
| 2803 | } |
---|
| 2804 | |
---|
| 2805 | function showCards (letter,page, ids) |
---|
| 2806 | { |
---|
| 2807 | var data = new Array(); |
---|
[1496] | 2808 | flag_compartilhado = false; |
---|
[2] | 2809 | if ( letter != CC_actual_letter ) |
---|
| 2810 | { |
---|
| 2811 | CC_actual_page = '1'; |
---|
| 2812 | } |
---|
| 2813 | else |
---|
| 2814 | { |
---|
| 2815 | CC_actual_page = page; |
---|
| 2816 | } |
---|
| 2817 | |
---|
| 2818 | CC_actual_letter = letter; |
---|
| 2819 | |
---|
| 2820 | if (CC_max_cards[0] == 0) |
---|
| 2821 | { |
---|
| 2822 | |
---|
| 2823 | if(CC_visual == 'cards') |
---|
| 2824 | drawCards(0); |
---|
| 2825 | else if(CC_visual == 'table') |
---|
| 2826 | drawTable(0); |
---|
[1599] | 2827 | |
---|
[2] | 2828 | setPages(0,0); |
---|
| 2829 | return; |
---|
| 2830 | } |
---|
| 2831 | |
---|
| 2832 | var handler = function (responseText) |
---|
| 2833 | { |
---|
| 2834 | var data = new Array(); |
---|
| 2835 | data = unserialize(responseText); |
---|
| 2836 | if (data[0] == '0') |
---|
[1599] | 2837 | { |
---|
| 2838 | Element('cc_type_contact').value = data[1]; |
---|
[2] | 2839 | CC_npages = 0; |
---|
| 2840 | CC_actual_page = 1; |
---|
| 2841 | if(CC_visual == 'cards') |
---|
| 2842 | drawCards(0); |
---|
| 2843 | else if(CC_visual == 'table') |
---|
| 2844 | drawTable(0); |
---|
| 2845 | setPages(0,0); |
---|
| 2846 | return; |
---|
| 2847 | } |
---|
| 2848 | else |
---|
| 2849 | Element('cc_type_contact').value = data[10]; |
---|
[1599] | 2850 | |
---|
| 2851 | // Element('cc_debug').innerHTML = responseText; |
---|
| 2852 | |
---|
[2] | 2853 | if (typeof(data) != 'object') |
---|
| 2854 | { |
---|
| 2855 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 2856 | return; |
---|
| 2857 | } |
---|
[1599] | 2858 | |
---|
[2] | 2859 | if (typeof(data[3]) == 'object') |
---|
| 2860 | { |
---|
[1496] | 2861 | if (data[8] == 'bo_shared_people_manager') |
---|
| 2862 | { |
---|
| 2863 | flag_compartilhado = true; |
---|
| 2864 | } |
---|
| 2865 | else |
---|
| 2866 | { |
---|
| 2867 | flag_compartilhado = false; |
---|
| 2868 | } |
---|
| 2869 | qtd_compartilhado = data[9]; |
---|
[2] | 2870 | CC_npages = parseInt(data[0]); |
---|
[1599] | 2871 | CC_actual_page = parseInt(data[1]); |
---|
[2] | 2872 | if(CC_visual == 'cards') |
---|
| 2873 | drawCards(data[3].length, data[10]); |
---|
| 2874 | else if(CC_visual == 'table') |
---|
| 2875 | drawTable(data[3].length, data[10]); |
---|
| 2876 | resizeWindow(); |
---|
| 2877 | populateCards(data, data[10]); |
---|
| 2878 | setPages(data[0], data[1]); |
---|
[1599] | 2879 | |
---|
[2] | 2880 | } |
---|
[1599] | 2881 | else if (data['error']) |
---|
| 2882 | { |
---|
| 2883 | showMessage(data['error']); |
---|
| 2884 | } |
---|
[2] | 2885 | else |
---|
| 2886 | { |
---|
| 2887 | showMessage(Element('cc_msg_err_contacting_server').value); |
---|
| 2888 | return; |
---|
| 2889 | } |
---|
| 2890 | }; |
---|
| 2891 | |
---|
| 2892 | var info = "letter="+letter+"&page="+CC_actual_page+"&ids="+ids; |
---|
| 2893 | Connector.newRequest('showCards', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler, info); |
---|
| 2894 | } |
---|
| 2895 | |
---|
[1599] | 2896 | |
---|
[284] | 2897 | function clearCards() |
---|
| 2898 | { |
---|
| 2899 | clearLetterSelection(); |
---|
| 2900 | setHeightSpace(); |
---|
| 2901 | setMaxCards(getMaxCards()); |
---|
| 2902 | |
---|
| 2903 | if(CC_visual == 'cards') |
---|
| 2904 | drawCards(0); |
---|
| 2905 | else if(CC_visual == 'table') |
---|
| 2906 | drawTable(0); |
---|
| 2907 | |
---|
| 2908 | setPages(0,0); |
---|
| 2909 | return; |
---|
| 2910 | } |
---|
| 2911 | |
---|
[2] | 2912 | /***********************************************\ |
---|
| 2913 | * COMMON ENTRY FUNCTIONS * |
---|
| 2914 | \***********************************************/ |
---|
| 2915 | |
---|
| 2916 | function ccChangeVisualization(type) |
---|
| 2917 | { |
---|
| 2918 | var table_h = Element('cc_panel_table'); |
---|
| 2919 | var cards_h = Element('cc_panel_cards'); |
---|
[1599] | 2920 | |
---|
[2] | 2921 | switch (type) |
---|
| 2922 | { |
---|
| 2923 | case 'cards': |
---|
| 2924 | cards_h.style.display = 'none'; |
---|
| 2925 | table_h.style.display = 'inline'; |
---|
| 2926 | break; |
---|
| 2927 | |
---|
| 2928 | case 'table': |
---|
| 2929 | table_h.style.display = 'none'; |
---|
| 2930 | cards_h.style.display = 'inline'; |
---|
| 2931 | break; |
---|
| 2932 | } |
---|
[1599] | 2933 | |
---|
[2] | 2934 | CC_visual = type; |
---|
| 2935 | showCards(getActualLetter(), getActualPage()); |
---|
| 2936 | } |
---|
| 2937 | |
---|
[1599] | 2938 | function ccSearchUpdate() |
---|
| 2939 | { |
---|
| 2940 | Element('cc_panel_letters').style.display = 'none'; |
---|
| 2941 | Element('cc_panel_search').style.display = 'inline'; |
---|
| 2942 | |
---|
| 2943 | if(CC_visual == 'cards') |
---|
| 2944 | drawCards(0); |
---|
| 2945 | else if(CC_visual == 'table') |
---|
| 2946 | drawTable(0); |
---|
| 2947 | |
---|
| 2948 | if (CC_actual_letter != 'search') |
---|
| 2949 | { |
---|
| 2950 | CC_last_letter = CC_actual_letter; |
---|
| 2951 | } |
---|
| 2952 | } |
---|
| 2953 | |
---|
[2] | 2954 | function ccSearchHidePanel() |
---|
| 2955 | { |
---|
| 2956 | Element('cc_panel_search').style.display = 'none'; |
---|
| 2957 | Element('cc_panel_letters').style.display = 'inline'; |
---|
| 2958 | if (CC_actual_letter == 'search') |
---|
| 2959 | { |
---|
| 2960 | CC_actual_letter = CC_last_letter; |
---|
| 2961 | } |
---|
| 2962 | } |
---|
| 2963 | |
---|
| 2964 | function ccSearchHide() |
---|
| 2965 | { |
---|
| 2966 | Element('cc_panel_search').style.display = 'none'; |
---|
| 2967 | Element('cc_panel_letters').style.display = 'inline'; |
---|
[284] | 2968 | clearCards(); |
---|
[2] | 2969 | } |
---|
| 2970 | |
---|
| 2971 | /***********************************************\ |
---|
| 2972 | * QUICK ADD FUNCTIONS * |
---|
| 2973 | \***********************************************/ |
---|
| 2974 | |
---|
| 2975 | |
---|
| 2976 | function resetQuickAdd () |
---|
| 2977 | { |
---|
| 2978 | Element('cc_qa_alias').value = ''; |
---|
| 2979 | Element('cc_qa_given_names').value = ''; |
---|
| 2980 | Element('cc_qa_family_names').value = ''; |
---|
| 2981 | Element('cc_qa_phone').value = ''; |
---|
| 2982 | Element('cc_qa_email').value = ''; |
---|
| 2983 | } |
---|
| 2984 | |
---|
| 2985 | function getQuickAdd () |
---|
| 2986 | { |
---|
| 2987 | var data = new Array(); |
---|
| 2988 | data[0] = Element('cc_qa_alias').value; |
---|
| 2989 | data[1] = Element('cc_qa_given_names').value; |
---|
| 2990 | data[2] = Element('cc_qa_family_names').value; |
---|
| 2991 | data[3] = Element('cc_qa_phone').value; |
---|
| 2992 | data[4] = Element('cc_qa_email').value; |
---|
[1599] | 2993 | |
---|
[2] | 2994 | return data; |
---|
| 2995 | } |
---|
| 2996 | |
---|
| 2997 | function sendQuickAdd () |
---|
| 2998 | { |
---|
| 2999 | var data = getQuickAdd(); |
---|
[1599] | 3000 | |
---|
[2] | 3001 | var str = serialize(data); |
---|
| 3002 | |
---|
| 3003 | if (!str) |
---|
| 3004 | { |
---|
| 3005 | return false; |
---|
| 3006 | } |
---|
| 3007 | |
---|
| 3008 | var handler = function (responseText) |
---|
| 3009 | { |
---|
| 3010 | setTimeout('updateCards()',100);; |
---|
| 3011 | } |
---|
| 3012 | |
---|
| 3013 | resetQuickAdd(); |
---|
| 3014 | |
---|
| 3015 | Connector.newRequest('quickAdd', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=quick_add', 'POST', handler, 'add='+escape(str)); |
---|
| 3016 | } |
---|
[284] | 3017 | |
---|
[1599] | 3018 | |
---|
[284] | 3019 | function connectVoip (phoneUser, typePhone){ |
---|
| 3020 | var handler_voip = function (responseText){ |
---|
| 3021 | if(!responseText) { |
---|
| 3022 | alert("Erro conectando servidor VoIP."); |
---|
| 3023 | } |
---|
| 3024 | else{ |
---|
[1599] | 3025 | data = unserialize(responseText); |
---|
[284] | 3026 | alert("Requisitando chamada para o ramal: "+data); |
---|
[1599] | 3027 | } |
---|
[284] | 3028 | } |
---|
| 3029 | Connector.newRequest('voip', "../../expressoMail1_2/controller.php?action=expressoMail1_2.functions.callVoipconnect&to="+phoneUser+"&typePhone="+typePhone, 'POST', handler_voip); |
---|
| 3030 | } |
---|