function emQuickCatalogSearch () { this.arrayWin = new Array(); this.el; this.cc_contacts = new Array(); this.cc_groups = new Array(); } $(document).ready(function(){ $('#combobox option').each(function(){ if($(this).val() == preferences.catalog_search){ $(this).attr('selected',true); } }); }); /* showlist */ emQuickCatalogSearch.prototype.showList = function(data, begin, end, ID, field) { data_ = data; id_ = ID; field_ = field; begin_ = begin; end_ = end; content = $("#content_id_"+ID); keypress_read(data); configure_slider(data); create_list(data, true); details_results(data); this.showWindow(); } /* Leitura das teclas de atalho */ function keypress_read(data) { $("#dialog-modal").unbind('keydown').keydown(function (e) { var keyCode = e.keyCode; arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13, esc: 27, space: 32}; var slider = $( "#slider" ); switch (keyCode) { case arrow.enter: if(!search_focus){ i = $(".ui-selected:last").attr("value") + 1; if($("#actions_"+i).clone().find(".ui-button-text").text() == '+') add_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); else{ remove_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); } document.getElementById("busca").value = ""; //Evita que o campo "para" receba o enter e.preventDefault(); $("#dialog-modal").dialog("close"); } if (is_webkit){ //Posiciona o cursor no final do texto no Chrome var txt_area = document.getElementById('to_'+id_); var len = txt_area.value.length; txt_area.setSelectionRange(len, len); } break; case arrow.left: if(!search_focus){ slider.slider("value", $( "#slider" ).slider( "value" ) - 1); create_list(data_, false); } break; case arrow.right: if(!search_focus){ if((($( "#slider" ).slider( "value" ))) == Math.ceil(data_.length/6)) break; slider.slider( "value", $( "#slider" ).slider( "value" ) + 1); create_list(data_, false); } break; case arrow.up: if(!search_focus){ show_detail(data_, "up"); } break; case arrow.down: if(!search_focus){ show_detail(data_, "down"); } break; case arrow.space: if(!search_focus){ i = $(".ui-selected:last").attr("value") + 1; if($("#actions_"+i).clone().find(".ui-button-text").text() == '+') { add_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); }else{ remove_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); } document.getElementById("busca").value = ""; } break; } }); } /* Mostra os detalhes do contato selecionado */ function show_detail(data_, direction) { id_contact = $(".ui-selected:last").attr("value"); if(direction == "down") { if((id_contact == (((((parseInt($( "#slider" ).slider( "value" )) - 1)*6))+6)-1)) || id_contact == data_.length - 1 || data_.length == 1) return; var line_contact = $('li.ui-selected'); $('li.ui-selected').next().addClass("ui-selected"); id_contact++; } else { if(id_contact == (($( "#slider" ).slider( "value" ) -1)*6)) return; var line_contact = $('li.ui-selected'); $('li.ui-selected').prev().addClass("ui-selected"); id_contact--; } line_contact.removeClass("ui-selected").addClass("ui-selectee"); var details = $("#detalhes_contato").empty(); switch(data_['type_catalog']) { case 'G': if(data_['extra_ldap_fields'] != undefined){ if(data_['extra_ldap_fields'].length != 0) var extra_fields = (data_['extra_ldap_fields']).split("#"); else var extra_fields = []; }else var extra_fields = []; if(preferences.default_fields_quick_search != 0) { details.append('
" + '' + (data_[id_contact].mail ? data_[id_contact].mail[0] : "") + '
'); if((data_[id_contact].telephonenumber ? data_[id_contact].telephonenumber[0] : "")) details.append('' + '' + (data_[id_contact].telephonenumber ? data_[id_contact].telephonenumber[0] : "") + '
'); } for (var i=0; i<=extra_fields.length-1; i++) { var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); if(data_[id_contact][valor.toLowerCase()] != undefined) { var tmp_campo = '" ;
for(j=0; j
Filtro "Fora do Escritório" ativo.
'); if ( data_[id_contact].vacationinfo ){ details.append('' + '' + data_[id_contact].short_name + '
'); else details.append('' + '' + data_[id_contact].mail + '
'); if(data_[id_contact].telephonenumber != null) details.append('' + '' + data_[id_contact].telephonenumber + '
'); if (data_[id_contact].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if (data_[id_contact].vacationinfo){ details.append('' + '' + data_[id_contact].short_name + '
'); else details.append('' + '' + data_[id_contact].mail + '
'); if(data_[id_contact].telephonenumber != null) details.append('' + '' + data_[id_contact].telephonenumber + '
'); } if(data_[id_contact].mail[0] == 'undefined') break; if(data_[id_contact].mail[0].length > 1) { for (var i=0; i<=extra_fields.length-1; i++) { var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); if(data_[id_contact][valor.toLowerCase()] != undefined) { var tmp_campo = '" ;
for(j=0; j
Filtro "Fora do Escritório" ativo.
'); if (data_[id_contact].vacationinfo){ details.append('" + '' + (data[first_contact].mail ? data[first_contact].mail[0] : "") + "
"); if(data[first_contact].telephonenumber) details.append('' + '' + (data[first_contact].telephonenumber ? data[first_contact].telephonenumber[0] : "") + '
'); } for (var i=0; i<=extra_fields.length-1; i++) { var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); if(data[0][valor.toLowerCase()] != undefined) { var tmp_campo = '" ; for(j=0; j' + utf8_decoder(data[first_contact][valor.toLowerCase()][j]) + "
"); tmp_campo = ""; } } } if (data[first_contact].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if ( data[first_contact].vacationinfo ){ details.append('' + '' + data[first_contact].mail + '
'); else details.append('' + '' + data[first_contact].short_name + '
'); if(data[first_contact].telephonenumber != null) details.append('' + '' + data[first_contact].telephonenumber + '
'); if (data[first_contact].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if ( data[first_contact].vacationinfo ){ details.append('' + '' + data[first_contact].mail + '
'); else details.append('' + '' + data[first_contact].short_name + '
'); if(data[first_contact].telephonenumber != null) details.append('' + '' + data[first_contact].telephonenumber + "
"); } if( data[first_contact].type_contact == "G") { if(data[first_contact].mail[0].length > 1) { for (var i=0; i<=extra_fields.length-1; i++) { var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); if(data[first_contact][valor.toLowerCase()] != undefined) { var tmp_campo = '" ; for(j=0; j' + utf8_decoder(data[first_contact][valor.toLowerCase()][j]) + "
"); tmp_campo = ""; } } } } } if (data[first_contact].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if ( data[first_contact].vacationinfo ){ details.append('" + '' + (data[this.value].mail ? data[this.value].mail[0] : "")+ "
"); if(data[this.value].telephonenumber ) details.append('' + '' + (data[this.value].telephonenumber ? data[this.value].telephonenumber[0] : "")+ "
"); } for (var i=0; i<=extra_fields.length-1; i++) { var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); if( data[this.value] && data[this.value][valor.toLowerCase()] != undefined) { var tmp_campo = '" ; for(j=0; j' + utf8_decoder(data[this.value][valor.toLowerCase()][j]) + "
"); tmp_campo = ""; } } } if (data[this.value].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if ( data[this.value].vacationinfo ){ details.append('" + '' + data[this.value].short_name + "
"); else details.append('" + '' + data[this.value].mail + "
"); if(data[this.value].telephonenumber != null) details.append('' + '' + data[this.value].telephonenumber + "
"); if (data[this.value].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if ( data[this.value].vacationinfo ){ details.append('" + '' + data[this.value].short_name + "
"); else details.append('" + '' + data[this.value].mail + "
"); if(data[this.value].telephonenumber != null) details.append('' + '' + data[this.value].telephonenumber + "
"); } if(data[this.value].mail[0] == 'undefined') break; if(data[this.value].mail[0] != get_lang("No mail")) { if(data[this.value].mail[0].length > 1) { for (var i=0; i<=extra_fields.length-1; i++) { var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); if(data[this.value][valor.toLowerCase()] != undefined) { var tmp_campo = '" ; for(j=0; j' + utf8_decoder(data[this.value][valor.toLowerCase()][j]) + "
"); tmp_campo = ""; } } } } } if (data[this.value].vacationactive == "TRUE"){ details.append('Filtro "Fora do Escritório" ativo.
'); if ( data[this.value].vacationinfo ){ details.append('