[2] | 1 | function emQuickCatalogSearch () |
---|
| 2 | { |
---|
| 3 | this.arrayWin = new Array(); |
---|
| 4 | this.el; |
---|
| 5 | this.cc_contacts = new Array(); |
---|
| 6 | this.cc_groups = new Array(); |
---|
| 7 | } |
---|
[5231] | 8 | |
---|
| 9 | $(document).ready(function(){ |
---|
| 10 | $('#combobox option').each(function(){ |
---|
| 11 | if($(this).val() == preferences.catalog_search){ |
---|
| 12 | $(this).attr('selected',true); |
---|
| 13 | } |
---|
| 14 | }); |
---|
| 15 | }); |
---|
[6631] | 16 | |
---|
[5134] | 17 | /* showlist */ |
---|
[5075] | 18 | emQuickCatalogSearch.prototype.showList = function(data, begin, end, ID, field) |
---|
| 19 | { |
---|
[5172] | 20 | data_ = data; |
---|
| 21 | id_ = ID; |
---|
| 22 | field_ = field; |
---|
| 23 | begin_ = begin; |
---|
| 24 | end_ = end; |
---|
[5911] | 25 | content = $("#content_id_"+ID); |
---|
| 26 | |
---|
[5172] | 27 | keypress_read(data); |
---|
| 28 | configure_slider(data); |
---|
[5134] | 29 | create_list(data, true); |
---|
[5172] | 30 | details_results(data); |
---|
| 31 | |
---|
[5404] | 32 | this.showWindow(); |
---|
[5075] | 33 | } |
---|
[5172] | 34 | |
---|
| 35 | |
---|
[5134] | 36 | /* Leitura das teclas de atalho */ |
---|
| 37 | function keypress_read(data) { |
---|
[5172] | 38 | $("#dialog-modal").unbind('keydown').keydown(function (e) { |
---|
[5134] | 39 | var keyCode = e.keyCode; |
---|
[5172] | 40 | arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13, esc: 27, space: 32}; |
---|
| 41 | var slider = $( "#slider" ); |
---|
[5075] | 42 | switch (keyCode) |
---|
| 43 | { |
---|
[5172] | 44 | case arrow.enter: |
---|
[5134] | 45 | if(!search_focus){ |
---|
| 46 | i = $(".ui-selected:last").attr("value") + 1; |
---|
[5172] | 47 | if($("#actions_"+i).clone().find(".ui-button-text").text() == '+') |
---|
| 48 | add_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); |
---|
| 49 | else{ |
---|
| 50 | remove_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); |
---|
| 51 | } |
---|
[5134] | 52 | document.getElementById("busca").value = ""; |
---|
[5395] | 53 | //Evita que o campo "para" receba o enter |
---|
| 54 | e.preventDefault(); |
---|
[5172] | 55 | $("#dialog-modal").dialog("close"); |
---|
[5134] | 56 | } |
---|
[5402] | 57 | if (is_webkit){ |
---|
| 58 | //Posiciona o cursor no final do texto no Chrome |
---|
| 59 | var txt_area = document.getElementById('to_'+id_); |
---|
| 60 | var len = txt_area.value.length; |
---|
| 61 | txt_area.setSelectionRange(len, len); |
---|
| 62 | } |
---|
[5075] | 63 | break; |
---|
| 64 | case arrow.left: |
---|
[5172] | 65 | if(!search_focus){ |
---|
| 66 | slider.slider("value", $( "#slider" ).slider( "value" ) - 1); |
---|
| 67 | create_list(data_, false); |
---|
| 68 | } |
---|
[5075] | 69 | break; |
---|
| 70 | case arrow.right: |
---|
[5172] | 71 | if(!search_focus){ |
---|
| 72 | if((($( "#slider" ).slider( "value" ))) == Math.ceil(data_.length/6)) |
---|
| 73 | break; |
---|
| 74 | slider.slider( "value", $( "#slider" ).slider( "value" ) + 1); |
---|
| 75 | create_list(data_, false); |
---|
| 76 | } |
---|
[5075] | 77 | break; |
---|
| 78 | case arrow.up: |
---|
[5172] | 79 | if(!search_focus){ |
---|
| 80 | show_detail(data_, "up"); |
---|
| 81 | } |
---|
[5134] | 82 | break; |
---|
| 83 | case arrow.down: |
---|
[5172] | 84 | if(!search_focus){ |
---|
| 85 | show_detail(data_, "down"); |
---|
| 86 | } |
---|
| 87 | break; |
---|
| 88 | case arrow.space: |
---|
| 89 | |
---|
| 90 | if(!search_focus){ |
---|
| 91 | i = $(".ui-selected:last").attr("value") + 1; |
---|
| 92 | if($("#actions_"+i).clone().find(".ui-button-text").text() == '+') |
---|
| 93 | { |
---|
| 94 | add_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); |
---|
| 95 | }else{ |
---|
| 96 | remove_contact_field(document.getElementById("contact_"+i).innerHTML, document.getElementById("actions_"+i), "contact_"+i); |
---|
| 97 | } |
---|
| 98 | document.getElementById("busca").value = ""; |
---|
| 99 | } |
---|
| 100 | break; |
---|
| 101 | } |
---|
[5134] | 102 | }); |
---|
[5172] | 103 | } |
---|
[5134] | 104 | |
---|
| 105 | |
---|
| 106 | /* Mostra os detalhes do contato selecionado */ |
---|
| 107 | function show_detail(data_, direction) { |
---|
| 108 | id_contact = $(".ui-selected:last").attr("value"); |
---|
| 109 | if(direction == "down") { |
---|
| 110 | if((id_contact == (((((parseInt($( "#slider" ).slider( "value" )) - 1)*6))+6)-1)) || id_contact == data_.length - 1 || data_.length == 1) |
---|
| 111 | return; |
---|
| 112 | var line_contact = $('li.ui-selected'); |
---|
| 113 | $('li.ui-selected').next().addClass("ui-selected"); |
---|
| 114 | id_contact++; |
---|
[5172] | 115 | } |
---|
[5134] | 116 | else { |
---|
| 117 | if(id_contact == (($( "#slider" ).slider( "value" ) -1)*6)) |
---|
| 118 | return; |
---|
| 119 | var line_contact = $('li.ui-selected'); |
---|
| 120 | $('li.ui-selected').prev().addClass("ui-selected"); |
---|
| 121 | id_contact--; |
---|
[5172] | 122 | } |
---|
[5134] | 123 | line_contact.removeClass("ui-selected").addClass("ui-selectee"); |
---|
[5172] | 124 | var details = $("#detalhes_contato").empty(); |
---|
[5134] | 125 | switch(data_['type_catalog']) { |
---|
| 126 | case 'G': |
---|
[6504] | 127 | if(data_['extra_ldap_fields'] != undefined){ |
---|
| 128 | if(data_['extra_ldap_fields'].length != 0) |
---|
| 129 | var extra_fields = (data_['extra_ldap_fields']).split("#"); |
---|
[5466] | 130 | else |
---|
| 131 | var extra_fields = []; |
---|
| 132 | }else |
---|
| 133 | var extra_fields = []; |
---|
[5134] | 134 | if(preferences.default_fields_quick_search != 0) { |
---|
[5466] | 135 | details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn[0]) + "</label>" + '<span class="value">' + (data_[id_contact].mail ? data_[id_contact].mail[0] : "") + '</span></p>'); |
---|
| 136 | if((data_[id_contact].telephonenumber ? data_[id_contact].telephonenumber[0] : "")) |
---|
| 137 | details.append('<p><label class="attribute">Telefone </label>' + '<span class="value">' + (data_[id_contact].telephonenumber ? data_[id_contact].telephonenumber[0] : "") + '</span></p>'); |
---|
[5172] | 138 | } |
---|
[5134] | 139 | for (var i=0; i<=extra_fields.length-1; i++) |
---|
[5172] | 140 | { |
---|
| 141 | var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); |
---|
| 142 | var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); |
---|
[5134] | 143 | if(data_[id_contact][valor.toLowerCase()] != undefined) { |
---|
| 144 | var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; |
---|
| 145 | for(j=0; j<data_[id_contact][valor.toLowerCase()].length; j++) { |
---|
| 146 | details.append(tmp_campo + '<span class="value">' + data_[id_contact][valor.toLowerCase()][j] + "</span></p>"); |
---|
| 147 | tmp_campo = ""; |
---|
[5172] | 148 | } |
---|
| 149 | } |
---|
| 150 | } |
---|
| 151 | break; |
---|
[5134] | 152 | case 'P': |
---|
[5172] | 153 | if(utf8_decoder(data_[id_contact].cn) == 'undefined') |
---|
| 154 | details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].title) + '</label>' + '<span class="value">' + data_[id_contact].short_name + '</span></p>'); |
---|
| 155 | else |
---|
| 156 | details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn) + '</label>' + '<span class="value">' + data_[id_contact].mail + '</span></p>'); |
---|
[5134] | 157 | if(data_[id_contact].telephonenumber != null) |
---|
| 158 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data_[id_contact].telephonenumber + '</span></p>'); |
---|
[5172] | 159 | break; |
---|
[5134] | 160 | default: |
---|
[6504] | 161 | if(data_['extra_ldap_fields'] != undefined){ |
---|
| 162 | if(data_['extra_ldap_fields'].length != 0) |
---|
| 163 | var extra_fields = (data_['extra_ldap_fields']).split("#"); |
---|
[5466] | 164 | else |
---|
| 165 | var extra_fields = []; |
---|
| 166 | }else{ |
---|
[5456] | 167 | var extra_fields = []; |
---|
[5466] | 168 | } |
---|
[6475] | 169 | if(preferences.default_fields_quick_search != 0 || data_[id_contact].type_contact == "P" || data_[id_contact].type_contact == "G") { |
---|
[5172] | 170 | if(utf8_decoder(data_[id_contact].cn) == 'undefined') |
---|
| 171 | details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].title) + '</label>' + '<span class="value">' + data_[id_contact].short_name + '</span></p>'); |
---|
| 172 | else |
---|
| 173 | details.append('<p><label class="attribute">' + utf8_decoder(data_[id_contact].cn) + '</label>' + '<span class="value">' + data_[id_contact].mail + '</span></p>'); |
---|
[5134] | 174 | if(data_[id_contact].telephonenumber != null) |
---|
| 175 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data_[id_contact].telephonenumber + '</span></p>'); |
---|
[5172] | 176 | } |
---|
| 177 | if(data_[id_contact].mail[0] == 'undefined') |
---|
| 178 | break; |
---|
[5134] | 179 | if(data_[id_contact].mail[0].length > 1) { |
---|
| 180 | for (var i=0; i<=extra_fields.length-1; i++) { |
---|
[5172] | 181 | var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); |
---|
| 182 | var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); |
---|
[5134] | 183 | if(data_[id_contact][valor.toLowerCase()] != undefined) { |
---|
| 184 | var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; |
---|
| 185 | for(j=0; j<data_[id_contact][valor.toLowerCase()].length; j++) { |
---|
| 186 | details.append(tmp_campo + '<span class="value">' + data_[id_contact][valor.toLowerCase()][j] + "</span></p>"); |
---|
| 187 | tmp_campo = ""; |
---|
[5172] | 188 | } |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | } |
---|
| 192 | break; |
---|
| 193 | } |
---|
[5075] | 194 | } |
---|
[5172] | 195 | |
---|
[3718] | 196 | |
---|
[5172] | 197 | /* |
---|
| 198 | * Método que cria a lista de contatos |
---|
| 199 | */ |
---|
[5134] | 200 | function create_list(data, begin, uiValue) { |
---|
| 201 | var sliderValue = 1; |
---|
| 202 | if(typeof($( "#slider" ).slider( "value" )) != "object") |
---|
| 203 | sliderValue = $( "#slider" ).slider( "value" ); |
---|
| 204 | if(uiValue) |
---|
| 205 | sliderValue = uiValue; |
---|
[5172] | 206 | $("#detalhes_contato").empty(); |
---|
[5134] | 207 | var paginas = Math.ceil(data.length/6); |
---|
[5172] | 208 | $("#title_usuarios").html( get_lang("Results") ); |
---|
| 209 | var selectable = $("#selectable"); |
---|
| 210 | selectable.empty(); |
---|
| 211 | var acento = data.search_for; |
---|
| 212 | var Ul = document.createElement("ul"); |
---|
| 213 | var caracteresInvalidos = 'àèìòùâêîôûäëïöüáéíóúãõÀÈÌÒÙÂÊÎÔÛÄËÏÖÜÁÉÍÓÚÃÕ'; |
---|
| 214 | var caracteresValidos = 'aeiouaeiouaeiouaeiouaoAEIOUAEIOUAEIOUAEIOUAO'; |
---|
| 215 | |
---|
| 216 | var i = new Number(); |
---|
| 217 | var j = new Number(); |
---|
| 218 | var cString = new String(); |
---|
| 219 | var varRes = ''; |
---|
| 220 | |
---|
| 221 | for (i = 0; i < data.search_for.length; i++) { |
---|
| 222 | cString = data.search_for.substring(i, i + 1); |
---|
| 223 | for (j = 0; j < caracteresInvalidos.length; j++) { |
---|
| 224 | if (caracteresInvalidos.substring(j, j + 1) == cString){ |
---|
| 225 | cString = caracteresValidos.substring(j, j + 1); |
---|
| 226 | } |
---|
| 227 | } |
---|
| 228 | varRes += cString; |
---|
| 229 | } |
---|
| 230 | data.search_for = varRes; |
---|
| 231 | |
---|
[5134] | 232 | for (i=((sliderValue -1)*6)+1; i<(((sliderValue -1)*6)+1)+6; i++) { |
---|
[5172] | 233 | var Op = document.createElement("li"); |
---|
[5134] | 234 | if(i > data.length) |
---|
[5172] | 235 | break; |
---|
| 236 | if (data['type_catalog'] != 'G' && (data[i-1].mail == null || data[i-1].mail == "")) |
---|
| 237 | data[i-1].mail = get_lang("No mail"); |
---|
[5134] | 238 | |
---|
| 239 | if(i == (((sliderValue -1)*6)+1)) { |
---|
[5172] | 240 | Op.setAttribute("class", "ui-selected"); |
---|
[5134] | 241 | Op.setAttribute("className", "ui-selected"); |
---|
[5172] | 242 | } |
---|
| 243 | else { |
---|
| 244 | Op.setAttribute("class", "ui-selectee"); |
---|
[5134] | 245 | Op.setAttribute("className", "ui-selectee"); |
---|
[5172] | 246 | } |
---|
| 247 | var contact_name = utf8_decoder(data[i-1].cn); |
---|
| 248 | if(contact_name == 'undefined'){ |
---|
| 249 | contact_name = utf8_decoder(data[i-1].title); |
---|
| 250 | if(contact_name != 'undefined'){ |
---|
| 251 | data[i-1].mail = data[i-1].short_name; |
---|
| 252 | } |
---|
| 253 | } |
---|
| 254 | var exist = "add_contact_field"; |
---|
| 255 | var signal = "+"; |
---|
| 256 | var btnClass = "add"; |
---|
[5911] | 257 | var emailList = content.find(field_).val(); |
---|
[5172] | 258 | var emails_adicionados = emailList.split(","); |
---|
| 259 | for(aux=0; aux<emails_adicionados.length -1; aux++) { |
---|
[5258] | 260 | if(emails_adicionados[aux].match(/<([^<]*)>[\s]*$/)){ |
---|
| 261 | if(emails_adicionados[aux].match(/<([^<]*)>[\s]*$/)[1].toLowerCase() == (utf8_decoder(data[i-1].mail)).toLowerCase()){ |
---|
| 262 | emails_adicionados[aux] = "%"; |
---|
| 263 | exist = "remove_contact_field"; |
---|
| 264 | signal = "x"; |
---|
| 265 | btnClass = "remove"; |
---|
| 266 | } |
---|
| 267 | }else{ |
---|
| 268 | if(emails_adicionados[aux].toLowerCase() == (utf8_decoder(data[i-1].mail)).toLowerCase()){ |
---|
| 269 | emails_adicionados[aux] = "%"; |
---|
| 270 | exist = "remove_contact_field"; |
---|
| 271 | signal = "x"; |
---|
| 272 | btnClass = "remove"; |
---|
| 273 | } |
---|
[5172] | 274 | } |
---|
| 275 | } |
---|
| 276 | |
---|
| 277 | if(contact_name.toLowerCase().indexOf(acento.toLowerCase()) != -1 && acento.indexOf(" ") == -1 && acento.indexOf("@") == -1) |
---|
| 278 | contact_name = contact_name.substring(0, contact_name.toLowerCase().indexOf(acento.toLowerCase())) + "<u>" + contact_name.substr(contact_name.toLowerCase().indexOf(acento.toLowerCase()), acento.length) + "</u>" + contact_name.substring(contact_name.toLowerCase().indexOf(acento.toLowerCase()) + acento.length); |
---|
| 279 | else if(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) != -1 && data.search_for.indexOf(" ") == -1 && data.search_for.indexOf("@") == -1) |
---|
| 280 | contact_name = contact_name.substring(0, contact_name.toLowerCase().indexOf(data.search_for.toLowerCase())) + "<u>" + contact_name.substr(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()), data.search_for.length) + "</u>" + contact_name.substring(contact_name.toLowerCase().indexOf(data.search_for.toLowerCase()) + data.search_for.length); |
---|
[5466] | 281 | var line = '<span class="menu-control"><button class="'+btnClass+'" id="actions_'+i+'" onClick="'+exist+'(document.getElementById(\'contact_' + i + '\').innerHTML, this, \'contact_' + i + '\')">'+ signal +'</button></span><div id="contact_' + i + '" onDblClick="'+exist+'(this.innerHTML, document.getElementById(\'actions_'+i+'\'), \'contact_' + i + '\')"><div class="name_contact"><strong class="name">' + contact_name + '</strong><em class="email">' + ((utf8_decoder(data[i-1].mail) != undefined)? (utf8_decoder(data[i-1].mail) == 'undefined' ? get_lang("No mail") : utf8_decoder(data[i-1].mail)) : get_lang("No mail")) + '</em></div></div>'; |
---|
[5172] | 282 | Op.innerHTML = line; |
---|
| 283 | $(Op).val(i - 1); |
---|
[5134] | 284 | selectable.append(Op); |
---|
[5172] | 285 | $("#contact_"+i).click(function(){ |
---|
| 286 | document.getElementById("amount-text").focus(); |
---|
| 287 | }); |
---|
| 288 | } |
---|
[5134] | 289 | selectable.append(Ul); |
---|
| 290 | var first_contact; |
---|
| 291 | begin ? first_contact = 0 : first_contact = ((sliderValue* 6) -6); |
---|
[5172] | 292 | var details = $("#detalhes_contato").empty(); |
---|
| 293 | |
---|
[5134] | 294 | switch (data['type_catalog']) { |
---|
| 295 | case 'G': |
---|
[5466] | 296 | if(data['extra_ldap_fields']){ |
---|
| 297 | if(data['extra_ldap_fields'].length != 0) |
---|
| 298 | var extra_fields = (data['extra_ldap_fields']).split("#"); |
---|
| 299 | else |
---|
| 300 | var extra_fields = []; |
---|
| 301 | }else |
---|
[5456] | 302 | var extra_fields = []; |
---|
[5134] | 303 | if(preferences.default_fields_quick_search != 0) { |
---|
[5466] | 304 | details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn[0]) + "</label>" + '<span class="value">' + (data[first_contact].mail ? data[first_contact].mail[0] : "") + "</span></p>"); |
---|
| 305 | if(data[first_contact].telephonenumber) |
---|
| 306 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + (data[first_contact].telephonenumber ? data[first_contact].telephonenumber[0] : "") + '</span></p>'); |
---|
[5456] | 307 | } |
---|
[5134] | 308 | for (var i=0; i<=extra_fields.length-1; i++) { |
---|
| 309 | var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); |
---|
| 310 | var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); |
---|
| 311 | if(data[0][valor.toLowerCase()] != undefined) |
---|
| 312 | { |
---|
| 313 | var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; |
---|
| 314 | for(j=0; j<data[first_contact][valor.toLowerCase()].length; j++) { |
---|
[5251] | 315 | details.append(tmp_campo + '<span class="value">' + utf8_decoder(data[first_contact][valor.toLowerCase()][j]) + "</span></p>"); |
---|
[5134] | 316 | tmp_campo = ""; |
---|
| 317 | } |
---|
| 318 | } |
---|
| 319 | } |
---|
| 320 | break; |
---|
| 321 | case 'P': |
---|
[5172] | 322 | if(utf8_decoder(data[first_contact].cn) != 'undefined') |
---|
| 323 | details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn) + '</label>' + '<span class="value">' + data[first_contact].mail + '</span></p>'); |
---|
| 324 | else |
---|
| 325 | details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].title) + '</label>' + '<span class="value">' + data[first_contact].short_name + '</span></p>'); |
---|
[5134] | 326 | if(data[first_contact].telephonenumber != null) |
---|
| 327 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber + '</span></p>'); |
---|
| 328 | break; |
---|
[5456] | 329 | default: |
---|
[5466] | 330 | if(data['extra_ldap_fields']){ |
---|
| 331 | if(data['extra_ldap_fields'].length != 0) |
---|
| 332 | var extra_fields = (data['extra_ldap_fields']).split("#"); |
---|
| 333 | else |
---|
| 334 | var extra_fields = []; |
---|
| 335 | }else |
---|
[5456] | 336 | var extra_fields = []; |
---|
[6475] | 337 | if(preferences.default_fields_quick_search != 0 || data[first_contact].type_contact == "P" || data[first_contact].type_contact == "G") { |
---|
[5172] | 338 | if(utf8_decoder(data[first_contact].cn) != 'undefined') |
---|
| 339 | details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].cn) + '</label>' + '<span class="value">' + data[first_contact].mail + '</span></p>'); |
---|
| 340 | else |
---|
| 341 | details.append('<p><label class="attribute">' + utf8_decoder(data[first_contact].title) + '</label>' + '<span class="value">' + data[first_contact].short_name + '</span></p>'); |
---|
[5134] | 342 | if(data[first_contact].telephonenumber != null) |
---|
| 343 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[first_contact].telephonenumber + "</span></p>"); |
---|
| 344 | } |
---|
[5251] | 345 | if( data[first_contact].type_contact == "G") { |
---|
| 346 | if(data[first_contact].mail[0].length > 1) { |
---|
[5134] | 347 | for (var i=0; i<=extra_fields.length-1; i++) { |
---|
| 348 | var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); |
---|
| 349 | var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); |
---|
| 350 | if(data[first_contact][valor.toLowerCase()] != undefined) { |
---|
| 351 | var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; |
---|
| 352 | for(j=0; j<data[first_contact][valor.toLowerCase()].length; j++) { |
---|
[5251] | 353 | details.append(tmp_campo + '<span class="value">' + utf8_decoder(data[first_contact][valor.toLowerCase()][j]) + "</span></p>"); |
---|
[5134] | 354 | tmp_campo = ""; |
---|
| 355 | } |
---|
| 356 | } |
---|
| 357 | } |
---|
| 358 | } |
---|
| 359 | } |
---|
| 360 | break; |
---|
| 361 | } |
---|
[6631] | 362 | var string_results = sliderValue + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"; |
---|
| 363 | $( "#amount-text" ).val( string_results ).attr('readonly', true); |
---|
[5134] | 364 | $("button").button(); |
---|
[5172] | 365 | //$("button.remove").button({icons:{primary:"ui-icon-close"}, text: false}); |
---|
| 366 | //$("button.add").button({icons:{primary:"ui-icon-plus"}, text: false}); |
---|
[5134] | 367 | if(!is_ie) |
---|
| 368 | document.getElementById("amount-text").focus(); |
---|
[5172] | 369 | $("#selectable li:first").focus(); |
---|
[5134] | 370 | removeFocus(); |
---|
[5172] | 371 | } |
---|
[3305] | 372 | |
---|
[5075] | 373 | |
---|
[5134] | 374 | /* Método que configura os detalhes do resultado da busca */ |
---|
| 375 | function details_results(data) { |
---|
[5172] | 376 | $(function() { |
---|
| 377 | $( "#selectable" ).selectable({ |
---|
| 378 | stop: function() { |
---|
| 379 | var details = $("#detalhes_contato").empty(); |
---|
| 380 | $( ".ui-selected", this ).each(function() { |
---|
| 381 | if(data.length > 0){ |
---|
| 382 | switch(data['type_catalog']) { |
---|
| 383 | case 'G': |
---|
[5466] | 384 | if(data['extra_ldap_fields'] != undefined){ |
---|
| 385 | if(data['extra_ldap_fields'].length != 0) |
---|
| 386 | var extra_fields = (data['extra_ldap_fields']).split("#"); |
---|
| 387 | else |
---|
| 388 | var extra_fields = []; |
---|
| 389 | }else |
---|
[5456] | 390 | var extra_fields = []; |
---|
[6290] | 391 | if(preferences.default_fields_quick_search != 0 && data[this.value] ) { |
---|
[6289] | 392 | details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn[0]) + "</label>" + '<span class="value">' + (data[this.value].mail ? data[this.value].mail[0] : "")+ "</span></p>"); |
---|
[5466] | 393 | if(data[this.value].telephonenumber ) |
---|
| 394 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + (data[this.value].telephonenumber ? data[this.value].telephonenumber[0] : "")+ "</span></p>"); |
---|
[5172] | 395 | } |
---|
[5134] | 396 | for (var i=0; i<=extra_fields.length-1; i++) { |
---|
[5172] | 397 | var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); |
---|
| 398 | var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); |
---|
[6290] | 399 | if( data[this.value] && data[this.value][valor.toLowerCase()] != undefined) { |
---|
[5134] | 400 | var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; |
---|
| 401 | for(j=0; j<data[this.value][valor.toLowerCase()].length; j++) { |
---|
[5251] | 402 | details.append(tmp_campo + '<span class="value">' + utf8_decoder(data[this.value][valor.toLowerCase()][j]) + "</span></p>"); |
---|
[5134] | 403 | tmp_campo = ""; |
---|
[5172] | 404 | } |
---|
| 405 | } |
---|
| 406 | } |
---|
| 407 | break; |
---|
| 408 | case 'P': |
---|
| 409 | if(utf8_decoder(data[this.value].cn) == 'undefined') |
---|
| 410 | details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].title) + "</label>" + '<span class="value">' + data[this.value].short_name + "</span></p>"); |
---|
| 411 | else |
---|
| 412 | details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn) + "</label>" + '<span class="value">' + data[this.value].mail + "</span></p>"); |
---|
| 413 | if(data[this.value].telephonenumber != null) |
---|
| 414 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber + "</span></p>"); |
---|
| 415 | break; |
---|
| 416 | default: |
---|
[6504] | 417 | if(this.value == undefined) |
---|
| 418 | break; |
---|
| 419 | |
---|
[5456] | 420 | if(data['extra_ldap_fields'].length != 0) |
---|
| 421 | var extra_fields = (data['extra_ldap_fields']).split("#"); |
---|
| 422 | else |
---|
| 423 | var extra_fields = []; |
---|
[6475] | 424 | if(preferences.default_fields_quick_search != 0 || data[this.value].type_contact == "P" || data[this.value].type_contact == "G") { |
---|
[5172] | 425 | if(utf8_decoder(data[this.value].cn) == 'undefined') |
---|
| 426 | details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].title) + "</label>" + '<span class="value">' + data[this.value].short_name + "</span></p>"); |
---|
| 427 | else |
---|
| 428 | details.append('<p><label class="attribute">' + utf8_decoder(data[this.value].cn) + "</label>" + '<span class="value">' + data[this.value].mail + "</span></p>"); |
---|
| 429 | if(data[this.value].telephonenumber != null) |
---|
| 430 | details.append('<p><label class="attribute">Telefone</label>' + '<span class="value">' + data[this.value].telephonenumber + "</span></p>"); |
---|
| 431 | } |
---|
| 432 | if(data[this.value].mail[0] == 'undefined') |
---|
| 433 | break; |
---|
| 434 | if(data[this.value].mail[0] != get_lang("No mail")) { |
---|
| 435 | if(data[this.value].mail[0].length > 1) { |
---|
| 436 | for (var i=0; i<=extra_fields.length-1; i++) { |
---|
| 437 | var campo = extra_fields[i].substr(extra_fields[i].indexOf("|")+1); |
---|
| 438 | var valor = extra_fields[i].substr(0, (extra_fields[i].indexOf("|"))); |
---|
| 439 | if(data[this.value][valor.toLowerCase()] != undefined) { |
---|
| 440 | var tmp_campo = '<p><label class="attribute">' + campo + "</label>" ; |
---|
| 441 | for(j=0; j<data[this.value][valor.toLowerCase()].length; j++) { |
---|
[5251] | 442 | details.append(tmp_campo + '<span class="value">' + utf8_decoder(data[this.value][valor.toLowerCase()][j]) + "</span></p>"); |
---|
[5172] | 443 | tmp_campo = ""; |
---|
| 444 | } |
---|
| 445 | } |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | } |
---|
| 449 | break; |
---|
| 450 | } |
---|
[5075] | 451 | } |
---|
[5172] | 452 | }); |
---|
| 453 | } |
---|
| 454 | }); |
---|
| 455 | }); |
---|
| 456 | } |
---|
| 457 | |
---|
| 458 | |
---|
| 459 | /* |
---|
| 460 | * Método que configura o slider e os resultados |
---|
| 461 | */ |
---|
[5134] | 462 | function configure_slider(data) { |
---|
| 463 | var paginas = (Math.ceil(data.length/6)); |
---|
[5172] | 464 | $("#title_usuarios").html( get_lang("Results") ); |
---|
| 465 | $(function() { |
---|
| 466 | $( "#slider" ).slider({ |
---|
| 467 | value:1, |
---|
| 468 | min: 1, |
---|
| 469 | max: paginas, |
---|
| 470 | step: 1, |
---|
[5134] | 471 | slide: function( event, ui ) { |
---|
| 472 | create_list(data, false, ui.value); |
---|
[5172] | 473 | var string_results = ui.value + " " + get_lang("of") + " " + paginas + " (" + data.length + " " + get_lang("Results") + ")"; |
---|
[5134] | 474 | $( "#amount-text" ).val( string_results ); |
---|
[5172] | 475 | } |
---|
| 476 | }); |
---|
[5134] | 477 | $("#selectable li:first button:first").focus(); |
---|
[5172] | 478 | }); |
---|
| 479 | } |
---|
[5075] | 480 | |
---|
[5134] | 481 | var search_focus = false; |
---|
[5172] | 482 | |
---|
[5134] | 483 | function setFocus() {search_focus = true;return;} |
---|
[5172] | 484 | |
---|
[5134] | 485 | function removeFocus() {search_focus = false;return;} |
---|
| 486 | |
---|
| 487 | function checkEnter(e) { |
---|
[5172] | 488 | var kC = window.event ? event.keyCode : |
---|
| 489 | e && e.keyCode ? e.keyCode : |
---|
| 490 | e && e.which ? e.which : null; |
---|
[5134] | 491 | if (kC) |
---|
[5172] | 492 | return kC == 13; |
---|
[5134] | 493 | else |
---|
[5172] | 494 | return false; |
---|
| 495 | } |
---|
[5075] | 496 | |
---|
[5172] | 497 | |
---|
| 498 | /* |
---|
| 499 | * Faz a busca direto da tela modal |
---|
| 500 | */ |
---|
[5134] | 501 | function buscaContato(param) { |
---|
| 502 | $("#busca, #detalhes_contato, #selectable").empty(); |
---|
| 503 | if(param.length == 0) { |
---|
| 504 | alert(get_lang("Please enter a parameter to search")); |
---|
| 505 | return; |
---|
[5172] | 506 | } |
---|
[5134] | 507 | if(param.length < preferences.search_characters_number) { |
---|
[5172] | 508 | alert(get_lang("parameter must be at least") + " " + preferences.search_characters_number + " " + get_lang("characters")); |
---|
| 509 | return false; |
---|
| 510 | } |
---|
| 511 | var catalog = $("#combobox").val(); |
---|
| 512 | var handler_emQuickSearch = function(data) { |
---|
| 513 | data_ = data; |
---|
| 514 | if(data_.length > 0) { |
---|
| 515 | configure_slider(data_); |
---|
| 516 | create_list(data, true); |
---|
| 517 | details_results(data_); |
---|
[5075] | 518 | } |
---|
[5134] | 519 | else { |
---|
[5172] | 520 | $("#detalhes_contato, #selectable").empty(); |
---|
| 521 | var selectable = $("#selectable"); |
---|
| 522 | var Ul = document.createElement("ul"); |
---|
| 523 | Ul.onclick = function(){ |
---|
| 524 | }; |
---|
| 525 | var Op = document.createElement("li"); |
---|
| 526 | Op.innerHTML = '<span class="menu-control"></span><div id="no_results"><div class="name_contact"><strong class="name">Nenhum Resultado Encontrado</strong></div></div>'; |
---|
| 527 | selectable.append(Op); |
---|
| 528 | selectable.append(Ul); |
---|
| 529 | var string_results = "0 " + get_lang("of") + " 0 (0 " + get_lang("Results") + ")"; |
---|
| 530 | $( "#amount-text" ).val( string_results ); |
---|
| 531 | details_results(data); |
---|
| 532 | configure_slider(data); |
---|
[5075] | 533 | } |
---|
| 534 | } |
---|
[5172] | 535 | cExecute ("$this.ldap_functions.quicksearchcontact&search_for="+param+"&field=TO&ID=0&catalog="+catalog, handler_emQuickSearch); |
---|
| 536 | } |
---|
[5075] | 537 | |
---|
[5172] | 538 | function verifyEmails(emailAux, contato) { |
---|
| 539 | var contact_id = contato.split("_"); |
---|
| 540 | if(contact_id[1] != 0) |
---|
| 541 | { |
---|
| 542 | var ini = parseInt((contact_id[1]/6).toFixed(0)); |
---|
| 543 | if(ini != 0 && ini != 1){ |
---|
| 544 | ini = ini * 6; |
---|
| 545 | var fim = ini+1; |
---|
| 546 | } |
---|
| 547 | else{ |
---|
| 548 | ini = 1; |
---|
| 549 | var fim = ini; |
---|
| 550 | } |
---|
| 551 | fim = fim +5; |
---|
| 552 | var contact2 = ""; |
---|
| 553 | for(aux = ini; aux <= fim; aux++){ |
---|
| 554 | if(contact_id[1] != aux){ |
---|
| 555 | if($("#"+contact_id[0]+"_"+aux).find('.email').text() == emailAux){ |
---|
| 556 | contact2 = contact_id[0]+"_"+aux; |
---|
| 557 | var button = document.getElementById("actions_"+aux); |
---|
| 558 | var div = document.getElementById(contact2); |
---|
| 559 | if($("#actions_"+aux).find('.ui-button-text').text() == '+'){ |
---|
| 560 | button.onclick = function(){ |
---|
| 561 | remove_contact_field(div.innerHTML, button, contact2); |
---|
| 562 | }; |
---|
| 563 | div.ondblclick = function(){ |
---|
| 564 | remove_contact_field(div.innerHTML, button, contact2); |
---|
| 565 | }; |
---|
| 566 | $("#actions_"+aux).find('.ui-button-text').text('x'); |
---|
| 567 | } |
---|
| 568 | else{ |
---|
| 569 | button.onclick = function(){ |
---|
| 570 | add_contact_field(div.innerHTML, button, contact2); |
---|
| 571 | }; |
---|
| 572 | div.ondblclick = function(){ |
---|
| 573 | add_contact_field(div.innerHTML, button, contact2); |
---|
| 574 | }; |
---|
| 575 | $("#actions_"+aux).find('.ui-button-text').text('+'); |
---|
| 576 | } |
---|
| 577 | } |
---|
| 578 | } |
---|
| 579 | } |
---|
| 580 | } |
---|
| 581 | } |
---|
| 582 | /* |
---|
| 583 | * Método que adiciona o contato selecionado no campo do email (To, CC, CCo) |
---|
| 584 | */ |
---|
| 585 | function add_contact_field(contact, button, divs) { |
---|
| 586 | |
---|
| 587 | var nome = $(contact).clone().find('.name').text(); |
---|
| 588 | var email = $(contact).clone().find('.email').text(); |
---|
| 589 | |
---|
| 590 | if(email == get_lang("No mail")){ |
---|
| 591 | alert(get_lang("It is not possible to add this contact as a recipient because it does not have email")); |
---|
| 592 | if(!is_ie) |
---|
| 593 | document.getElementById("amount-text").focus(); |
---|
| 594 | return; |
---|
| 595 | } |
---|
| 596 | |
---|
| 597 | verifyEmails(email, divs); |
---|
| 598 | |
---|
| 599 | final_contact = "\""+nome +"\" <"+email+">, "; |
---|
| 600 | |
---|
[5911] | 601 | var emailList = content.find(field_).val(); |
---|
[5395] | 602 | //remove os caracteres da busca |
---|
| 603 | emailList = emailList.substr(0,emailList.lastIndexOf(',')+1); |
---|
[5172] | 604 | |
---|
[5134] | 605 | if (emailList[0] != '"' && emailList.indexOf(",") < 0) |
---|
[5172] | 606 | emailList = emailList.substr(end_); |
---|
[5383] | 607 | if(emailList.lastIndexOf(",") > 0){ |
---|
[5382] | 608 | if(emailList.substr(emailList.length-1, emailList.length) == "," || emailList.substr(emailList.length-2, 1) == ","){ |
---|
[5134] | 609 | emailList = emailList.substr(0, emailList.lastIndexOf(",") + 1); |
---|
[5382] | 610 | } else { |
---|
| 611 | emailList = emailList.substr(0, emailList.lastIndexOf("") + 1); |
---|
| 612 | final_contact = ","+final_contact; |
---|
| 613 | } |
---|
[5383] | 614 | } |
---|
[5382] | 615 | |
---|
[5134] | 616 | final_contact = final_contact.replace(/\/n/, ""); |
---|
[5172] | 617 | new_emailList = emailList + final_contact; |
---|
[5911] | 618 | content.find(field_).val(new_emailList); |
---|
[5134] | 619 | |
---|
[5911] | 620 | content.find(field_).trigger("update"); |
---|
[5423] | 621 | |
---|
[6631] | 622 | content.find(field_).filter("input").val(""); |
---|
[5172] | 623 | button.onclick = function(){ |
---|
| 624 | remove_contact_field(document.getElementById(divs).innerHTML, button, divs); |
---|
| 625 | }; |
---|
| 626 | var div = document.getElementById(divs); |
---|
[5134] | 627 | |
---|
[5172] | 628 | div.ondblclick = function(){ |
---|
| 629 | remove_contact_field(div.innerHTML, button, divs); |
---|
| 630 | }; |
---|
[5134] | 631 | |
---|
[5172] | 632 | button.innerHTML = '<span class="ui-button-text" style="">x</span>'; |
---|
| 633 | } |
---|
[5134] | 634 | |
---|
[5075] | 635 | |
---|
[5172] | 636 | /* |
---|
| 637 | * Método que remove o contato selecionado no campo do email (To, CC, CCo) |
---|
| 638 | */ |
---|
| 639 | function remove_contact_field(contact, button, divs) { |
---|
| 640 | var email = $(contact).clone().find('.email').text(); |
---|
[5134] | 641 | var exist = false; |
---|
[5172] | 642 | |
---|
[5911] | 643 | var emailList = content.find(field_).val(); |
---|
[5172] | 644 | var emails_adicionados = emailList.split(","); |
---|
| 645 | |
---|
| 646 | verifyEmails(email, divs); |
---|
| 647 | |
---|
[5134] | 648 | for(i=0; i<emails_adicionados.length -1; i++) { |
---|
[5172] | 649 | |
---|
[5258] | 650 | if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)){ |
---|
| 651 | if(emails_adicionados[i].match(/<([^<]*)>[\s]*$/)[1].toLowerCase() == email.toLowerCase()) { |
---|
| 652 | emails_adicionados[i] = "%"; |
---|
| 653 | exist = true; |
---|
| 654 | } |
---|
| 655 | }else{ |
---|
| 656 | if(emails_adicionados[i].toLowerCase() == email.toLowerCase()) { |
---|
| 657 | emails_adicionados[i] = "%"; |
---|
| 658 | exist = true; |
---|
| 659 | } |
---|
[5075] | 660 | } |
---|
[5172] | 661 | } |
---|
| 662 | |
---|
[5134] | 663 | if (exist == false) |
---|
[5172] | 664 | return false; |
---|
| 665 | var novos_contatos = emails_adicionados.join(","); |
---|
| 666 | novos_contatos = novos_contatos.replace(/%,/g, ""); |
---|
[5911] | 667 | content.find(field_).val(novos_contatos); |
---|
[5172] | 668 | |
---|
| 669 | button.onclick = function(){ |
---|
| 670 | add_contact_field(document.getElementById(divs).innerHTML, button, divs); |
---|
| 671 | }; |
---|
| 672 | |
---|
| 673 | var div = document.getElementById(divs); |
---|
| 674 | |
---|
| 675 | div.ondblclick = function(){ |
---|
| 676 | add_contact_field(div.innerHTML, button, divs); |
---|
| 677 | }; |
---|
| 678 | |
---|
[5911] | 679 | content.find(field_).trigger("update"); |
---|
[5172] | 680 | button.innerHTML = '<span class="ui-button-text" style="">+</span>'; |
---|
| 681 | } |
---|
[5075] | 682 | |
---|
[5172] | 683 | |
---|
[5134] | 684 | /* Decoder utf8 */ |
---|
| 685 | function utf8_decoder ( str_data ) { |
---|
[5172] | 686 | var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0; |
---|
| 687 | str_data += ''; |
---|
[5134] | 688 | while ( i < str_data.length ) { |
---|
[5172] | 689 | c1 = str_data.charCodeAt(i); |
---|
[5134] | 690 | if (c1 < 128) { |
---|
[5172] | 691 | tmp_arr[ac++] = String.fromCharCode(c1); |
---|
| 692 | i++; |
---|
[5134] | 693 | } else if ((c1 > 191) && (c1 < 224)) { |
---|
[5172] | 694 | c2 = str_data.charCodeAt(i+1); |
---|
| 695 | tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63)); |
---|
| 696 | i += 2; |
---|
| 697 | } else { |
---|
| 698 | c2 = str_data.charCodeAt(i+1); |
---|
| 699 | c3 = str_data.charCodeAt(i+2); |
---|
| 700 | tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); |
---|
| 701 | i += 3; |
---|
| 702 | } |
---|
[5075] | 703 | } |
---|
[5172] | 704 | return tmp_arr.join(''); |
---|
| 705 | } |
---|
[5075] | 706 | |
---|
[5172] | 707 | |
---|
[5134] | 708 | /* Mostra tela de help */ |
---|
| 709 | function show_help() { |
---|
[5075] | 710 | $(function() { |
---|
| 711 | $( "#dialog-modal_help" ).dialog({ |
---|
| 712 | resizable: false, |
---|
| 713 | width: 540, |
---|
| 714 | modal: true, |
---|
[5172] | 715 | closeOnEscape: true, |
---|
| 716 | close : function (event, ui) { |
---|
| 717 | $( "#amount-text" ).focus(); |
---|
| 718 | event.stopPropagation(); |
---|
| 719 | } |
---|
[5075] | 720 | }); |
---|
| 721 | }); |
---|
| 722 | } |
---|
[5172] | 723 | |
---|
| 724 | $("#dialog-modal_help").live("dialogclose", function(){ |
---|
| 725 | if(!is_ie) |
---|
| 726 | $( "#amount-text" ).focus(); |
---|
| 727 | }); |
---|
| 728 | |
---|
| 729 | |
---|
[5404] | 730 | emQuickCatalogSearch.prototype.showWindow = function () { |
---|
[5134] | 731 | $(this).bind('keydown'); |
---|
[5172] | 732 | $(function() { |
---|
| 733 | $( "#dialog:ui-dialog" ).dialog( "destroy" ); |
---|
| 734 | $( "#dialog-modal" ).dialog({ |
---|
| 735 | resizable: false, |
---|
[5134] | 736 | // height: "auto", |
---|
| 737 | width: 780, |
---|
[5172] | 738 | modal: true, |
---|
[5134] | 739 | position: 'bottom', |
---|
[5172] | 740 | closeOnEscape: true, |
---|
| 741 | close: function (event, ui) { |
---|
| 742 | event.stopPropagation(); |
---|
[5134] | 743 | $(this).unbind('keydown'); |
---|
| 744 | if (is_ie) { |
---|
[5911] | 745 | var range= content.find(field_).createTextRange(); |
---|
[5134] | 746 | range.collapse(false); |
---|
| 747 | range.select(); |
---|
| 748 | } else { |
---|
[5911] | 749 | content.find(field_).focus(); |
---|
[5134] | 750 | } |
---|
| 751 | }, |
---|
| 752 | open: function () { |
---|
[5172] | 753 | removeFocus(); |
---|
| 754 | $("#selectable li:first").focus(); |
---|
| 755 | document.getElementById("amount-text").focus(); |
---|
| 756 | }, |
---|
| 757 | focus: function (event, ui) { |
---|
[5134] | 758 | //$(this).unbind('keydown'); |
---|
[5172] | 759 | }, |
---|
| 760 | beforeClose: function (event, ui) { |
---|
[5134] | 761 | $(this).unbind('keydown'); |
---|
[5172] | 762 | }, |
---|
[5134] | 763 | buttons:[ |
---|
| 764 | { |
---|
| 765 | text: "Fechar", |
---|
| 766 | click: function(){ |
---|
[5172] | 767 | $("#detalhes_contato, #selectable, #busca").empty(); |
---|
| 768 | $(this).dialog("close"); |
---|
[5134] | 769 | if (is_ie) { |
---|
[5911] | 770 | var range= content.find(field_).createTextRange(); |
---|
[5134] | 771 | range.collapse(false); |
---|
| 772 | range.select(); |
---|
| 773 | } else { |
---|
[5911] | 774 | content.find(field_).focus(); |
---|
[5172] | 775 | } |
---|
[5134] | 776 | }, |
---|
| 777 | style: "margin-top: -2.1em" |
---|
[5075] | 778 | } |
---|
[5134] | 779 | ] |
---|
[5172] | 780 | }); |
---|
| 781 | }); |
---|
[5134] | 782 | $(".ui-dialog .ui-dialog-titlebar") |
---|
| 783 | .append('<a href="#" class="ui-dialog-titlebar-minimize ui-corner-all" role="button"><span class="ui-icon ui-icon-minusthick">minimize</span></a>') |
---|
| 784 | .find('.ui-dialog-titlebar-minimize').click(function() { |
---|
| 785 | $(".ui-dialog-buttonpane, .ui-dialog-content").toggle(); |
---|
| 786 | $(".ui-icon-minusthick, .ui-icon-newwin").toggleClass('ui-icon-minusthick').toggleClass('ui-icon-newwin'); |
---|
| 787 | }); |
---|
[5786] | 788 | $("#dialog-modal .ui-icon-search").click(function (){buscaContato($('#busca').val());}); |
---|
| 789 | $("#dialog-modal button, input.button").button(); |
---|
| 790 | } |
---|
[4034] | 791 | |
---|
[2] | 792 | |
---|
[5134] | 793 | /* Build the Object */ |
---|
[4761] | 794 | //QuickCatalogSearch; |
---|
[5382] | 795 | QuickCatalogSearch = new emQuickCatalogSearch(); |
---|