Changeset 325 for trunk/expressoMail1_2/js/QuickCatalogSearch.js
- Timestamp:
- 06/24/08 16:45:40 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/QuickCatalogSearch.js
r271 r325 35 35 var cmb = document.createElement("SELECT"); 36 36 cmb.id = "select_QuickCatalogSearch"; 37 cmb.style.width = " 585px";37 cmb.style.width = "685px"; // na comunidade valor eh 585px 38 38 cmb.size = "12"; 39 39 cmb.onkeypress = function (e) … … 134 134 Op.text = data[i].cn + ' (' + data[i].mail + ')'; 135 135 if (data[i].phone != '') 136 Op.text += ' (tel: ' + data[i].phone + ')'; 136 Op.text += ' - ' + data[i].phone; 137 if (data[i].ou != '') 138 Op.text += ' - ' + data[i].ou; // adicionado "data[i].ou" para exibir setor (F9) 137 139 Op.value = '"' + data[i].cn + '" ' + '<' + data[i].mail + '>'; 138 140 cmb.options.add(Op); 141 139 142 } 140 143 cmb.options[0].selected = true; … … 150 153 151 154 if(! this.arrayWin[div.id]) { 152 div.style.width = " 600px";155 div.style.width = "700px"; //na comunidade valor eh 600px 153 156 div.style.height = "230px"; 154 157 var title = get_lang('The results were found in the Global Catalog')+':'; … … 223 226 el.style.visibility = "hidden"; 224 227 el.style.position = "absolute"; 225 el.style.width = " 495px";228 el.style.width = "700px"; // na comunidade valor eh 495px 226 229 el.style.height = is_ie ? "360px" : "375px"; 227 230 el.style.left = "0px"; … … 234 237 '<table border="0" cellpading="0" cellspacing="0">'+ 235 238 '<tr><td>'+get_lang("Select an organization and click on button <b>Search</b>")+' :</td></tr>'+ 236 '<tr><td><select id="select_organization" name="select_organization"></select> '+ 237 '<input type="text" id="search_for" name="search_for" value="" size="17" maxlength="20"/> <input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'"> <input type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+ 239 '<tr><td><select style="width:150px" id="select_catalog" name="select_catalog" onchange="javascript:QuickCatalogSearch.update_organizations();"></select> '+ 240 '<select id="select_organization" style="width:100px" name="select_organization"></select> '+ 241 '<input type="text" id="search_for" name="search_for" value="" size="10" maxlength="15"/> <input type="button" onclick="QuickCatalogSearch.searchCatalogList(true)" class="button" value="'+get_lang('Search')+'"> <input style="display:none" type="button" onclick="QuickCatalogSearch.searchCatalogList(false)" class="button" value="'+get_lang('List All')+'"></td></tr>'+ 238 242 '<tr><td><input onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" id="type" type="radio" name="type" value="l"/>'+get_lang('Public Lists')+' <input type="radio" name="type" value="u" onclick="javascript:QuickCatalogSearch.changeOptions(this.value)" checked/>'+get_lang('Users')+' '+ 239 243 '<span style="visibility:hidden;background:#cc4444" id=msg_search> <font face="Verdana" size="1" color="WHITE">'+get_lang('Search in Catalog')+'...</font> </span></td></tr>'+ 240 244 '<tr><td>'+ 241 '<span id="list_span"><select multiple style="display:none;width:4 00px" size="14" id="list_values"></select></span>'+242 '<span id="user_span"><select multiple style="width: 400px" size="14" id="user_values"></select></span>'+245 '<span id="list_span"><select multiple style="display:none;width:450px" size="14" id="list_values"></select></span>'+ 246 '<span id="user_span"><select multiple style="width:580px" size="14" id="user_values"></select></span>'+ 243 247 '</td></tr>'+ 244 248 '<tr><td nowrap><center>'+get_lang('Click here to add into the fields')+': <input type="button" class="button" value="'+get_lang('TO')+'" onClick="javascript:QuickCatalogSearch.addContacts(\'to\')"> '+ … … 291 295 win.open(); 292 296 293 var handler_ organizations = function(data){294 var user_ organization = Element('user_organization').value;297 var handler_catalogs = function(data){ 298 var user_catalog = "Catalogo Geral"; 295 299 296 300 for(i = 0; i < data.length; i++) { 297 Element('select_organization').options[i] = new Option(data[i],data[i]); 298 if(user_organization.toUpperCase() == data[i].toUpperCase()) 299 Element('select_organization').options[i].selected = true; 300 } 301 } 302 cExecute ("$this.ldap_functions.get_organizations&referral=true", handler_organizations); 303 301 302 Element('select_catalog').options[i] = new Option(data[i],i); 303 if(user_catalog.toUpperCase() == data[i].toUpperCase()) 304 Element('select_catalog').options[i].selected = true; 305 } 306 } 307 cExecute ("$this.ldap_functions.get_catalogs", handler_catalogs); 308 309 this.update_organizations(); 310 304 311 var handler_cc_contacts= function(data){ 305 312 if(data && data.length > 0){ … … 367 374 } 368 375 376 emQuickCatalogSearch.prototype.update_organizations = function(){ 377 378 379 while(Element('select_organization').options.length > 0) { 380 Element('select_organization').remove(0); 381 } 382 383 384 var handler_org = function(data){ 385 Element('select_organization').options[0] = new Option('todos','todos'); 386 if (data != null){ 387 388 for(x = 0; x < data.length; x++) { 389 Element('select_organization').options[x+1] = new Option(data[x],data[x]); 390 } 391 } 392 393 } 394 395 cExecute ("$this.ldap_functions.get_organizations&referral=false&catalog="+Element('select_catalog').value, handler_org); 396 397 } 398 369 399 emQuickCatalogSearch.prototype.changeOptions = function(type){ 370 400 … … 428 458 emQuickCatalogSearch.prototype.searchCatalogList = function (itemSearch){ 429 459 430 if(itemSearch && Element('search_for').value.length == 0){431 alert(get_lang(' No data to search'));460 if(itemSearch && Element('search_for').value.length < 4){ 461 alert(get_lang('your search argument must be longer than 4 characters.')); 432 462 Element('search_for').focus(); 433 463 return false; … … 435 465 var organization = Element('select_organization').value; 436 466 var search = itemSearch ? Element('search_for').value : ''; 437 var max_result = 2000; 467 var catalog = Element('select_catalog').value; 468 var max_result = 300; 438 469 439 470 var handler_searchResults = function(data){ … … 477 508 478 509 for(i = 0; data.users && i < data.users.length; i++) { 479 if(is_ie) 510 if(is_ie){ 480 511 arr[i] = '<option value="'+'"'+data.users[i].name+'" <'+data.users[i].email+'>">'+data.users[i].name+' ('+data.users[i].email+')'+'</option>'; 481 else 482 user.options[i] = new Option(data.users[i].name+' ('+data.users[i].email+')','"'+data.users[i].name+'" <'+data.users[i].email+'>'); 512 } 513 else{ 514 515 /*******************************************************************************************/ 516 /* O resultado pratico do bloco de codigo a seguir eh a exibicao dos valores em tela, 517 ja que vai verificar se o departamento e o email estao vazios ou nulos e a partir dai o 518 resultado apresentado em tela sera exibido de maneira mais apresentavel; 519 */ 520 //verifica se departamento eh null ou nao; 521 var departamento_nulo = 'false'; 522 if((data.users[i].department == null) || (data.users[i].department == '')) { 523 data.users[i].department = ''; 524 departamento_nulo = 'true'; 525 } 526 else { 527 data.users[i].department = ' - ' + data.users[i].department; 528 } 529 530 //verifica se email eh null ou nao; 531 if((data.users[i].email == null) || (data.users[i].email == '')) { 532 if(departamento_nulo = 'true') { 533 data.users[i].email = ''; 534 } 535 else { 536 data.users[i].email = ' - '; 537 } 538 } 539 else { 540 data.users[i].email = ' (' + data.users[i].email + ') '; 541 } 542 543 user.options[i] = new Option(data.users[i].name+data.users[i].email+data.users[i].department,'"'+data.users[i].name+'" <'+data.users[i].email+'>'); // incluido data.users[i].department para exibir setor na opcao "Pesquisar" do email; 544 } 483 545 } 484 546 … … 488 550 489 551 Element('msg_search').style.visibility = 'visible'; 490 cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&search_for="+search , handler_searchResults);552 cExecute ("$this.ldap_functions.catalogsearch&max_result="+max_result+"&organization="+organization+"&search_for="+search+"&catalog="+catalog, handler_searchResults); 491 553 } 492 554
Note: See TracChangeset
for help on using the changeset viewer.