Changeset 4544
- Timestamp:
- 05/27/11 17:57:48 (13 years ago)
- Location:
- sandbox/2.2.0.2/contactcenter
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.2.0.2/contactcenter/inc/class.abo_catalog.inc.php
r4538 r4544 523 523 } 524 524 break; 525 525 case 'customFilter': 526 case 'exact': 527 case 'CN': 528 break; 529 526 530 default: 527 531 exit('Invalid \'other\' field passed to find in file '.__FILE__.' on line '.__LINE__); -
sandbox/2.2.0.2/contactcenter/inc/class.bo_global_ldap_catalog.inc.php
r4538 r4544 219 219 require_once $_SESSION['rootPath'].'/API/class.servicelocator.php'; 220 220 $ldapService = ServiceLocator::getService('ldap'); 221 $filter = $ldapService->getSearchFilter($find); 221 222 if($other['customFilter']) 223 $filter = $ldapService->getSearchFilter( $other['CN'], false, $find, $other['exact'] ); 224 else 225 $filter = $ldapService->getSearchFilter( $find ); 226 222 227 $fields = array('cn','dn'); 223 228 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); -
sandbox/2.2.0.2/contactcenter/inc/class.ui_data.inc.php
r4538 r4544 19 19 var $public_functions = array( 20 20 'data_manager' => true, 21 'advanced_searh_fields' => true 21 22 ); 22 23 … … 262 263 $GLOBALS['phpgw']->template->set_var('cc_msg_add_contact_to_group', lang('You did not add any contact for this group.')); 263 264 $GLOBALS['phpgw']->template->set_var('cc_msg_fill_field_name', lang('Fill the field Full Name')); 265 266 267 268 269 /* 270 * Monta Contactcenter Busca Avancada 271 */ 272 $c = CreateObject('phpgwapi.config','contactcenter'); 273 $c->read_repository(); 274 $current_config = $c->config_data; 275 276 $arraySearch = array(); 277 foreach ($current_config as $index => $value) 278 { 279 280 if(substr($index, 0, 24) == 'cc_attribute_searchable_') 281 { 282 if($value == 'true') 283 { 284 $v = substr($index, 24, strlen($index)); 285 $arraySearch[] = $v; 286 } 287 } 288 } 289 $advanceSearchArray = array(); 290 foreach ($arraySearch as $value) 291 { 292 foreach ($current_config as $index => $value2) 293 { 294 if($value == substr($index, 22, strlen($index)) && substr($index, 0, 22) == 'cc_attribute_ldapname_') 295 { 296 foreach ($current_config as $index2 => $value3) 297 { 298 if($value == substr($index2, 18, strlen($index2)) && substr($index2, 0, 18) == 'cc_attribute_name_') 299 $advanceSearchArray[$value2] = $value3; 300 } 301 } 302 303 } 304 } 305 306 $advanceSearch = array(); 307 foreach ($advanceSearchArray as $index => $value) 308 $advanceSearch[] ='"'.$index.'":"'.$value.'"'; 309 310 $advancedFields = "{".implode(',',$advanceSearch)."}"; 311 312 313 $GLOBALS['phpgw']->template->set_var('cc_config_advanced_search', $advancedFields); 264 314 265 315 $select_groups = ''; … … 3194 3244 { 3195 3245 3196 $data['search_for'] = utf8_encode($data['search_for']);3246 $data['search_for'] = ($data['search_for']); 3197 3247 } 3198 3248 … … 3319 3369 // Get only this attributes: dn, cn for external catalogs, 3320 3370 // used to restrict the attributes used in filters 3321 $ids = $this->bo->find(array($data['fields']['id'], $data['fields']['search']), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC' ), $data['search_for'] != null);3371 $ids = $this->bo->find(array($data['fields']['id'], $data['fields']['search']), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC', 'customFilter' => $data['custom_filter'], 'CN' => $data['CN'], 'exact' => $data['exact']), $data['search_for'] != null); 3322 3372 } 3323 3373 else … … 3333 3383 'contact.connection.mail', 3334 3384 'contact.connection.phone' 3335 ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC' ), $data['search_for_area'], $data['search_for'] != null );3385 ), $rules, array('order' => $data['fields']['search'], 'sort' => 'ASC', 'customFilter' => $data['custom_filter'], 'CN' => $data['CN'], 'exact' => $data['exact']), $data['search_for_area'], $data['search_for'] != null ); 3336 3386 } 3337 3387 -
sandbox/2.2.0.2/contactcenter/js/cc_config.js
r4502 r4544 34 34 35 35 if(inputs[0].value == "" || inputs[1].value == "") 36 { 37 36 { 37 //tupla.parentNode.removeChild(tupla); 38 38 inputs[0].setAttribute("value", ""); 39 39 inputs[1].setAttribute("value", ""); … … 41 41 select = tupla.getElementsByTagName("select"); 42 42 select[0].innerHTML = "<option value=\"\" selected=\"selected\"></option>"; 43 select[1].innerHTML = "<option value=\"\" selected=\"selected\"></option>"; 43 44 44 45 tupla.style.visible = "hidden"; … … 59 60 function cc_attribute_add() 60 61 { 61 var strings = document.getElementsByClassName("cc_attribute")[0].getElementsByTagName("label");62 var stringNome = strings[0].innerHTML + " ";63 var stringCorrespLdap = " " + strings[1].innerHTML + " ";64 var stringTipo = " " + strings[2].innerHTML + " ";65 66 62 var stringTexto = document.getElementsByClassName("cc_attribute")[0].getElementsByTagName("select")[0].getElementsByTagName("option")[0].innerHTML; 67 63 var stringMultivalorado = document.getElementsByClassName("cc_attribute")[0].getElementsByTagName("select")[0].getElementsByTagName("option")[1].innerHTML … … 71 67 72 68 var maior = 0; 73 for (var i= 0; i<vars.length; i++) {69 for (var i=1; i<vars.length; i++) { 74 70 var tupla = vars[i]; 75 71 var linhaIndice = tupla.getElementsByTagName("input")[0]; … … 89 85 var cc_attribute_name = "newsettings[cc_attribute_name_" + numeroAtributo + "]"; 90 86 var cc_attribute_ldapname = "newsettings[cc_attribute_ldapname_" + numeroAtributo + "]"; 91 var cc_attribute_type = "newsettings[cc_attribute_type_" + numeroAtributo + "]"; 87 var cc_attribute_type = "newsettings[cc_attribute_type_" + numeroAtributo + "]"; 88 var cc_attribute_searchable = "newsettings[cc_attribute_searchable_" + numeroAtributo + "]"; 92 89 93 90 var pool = document.getElementById("cc_attribute_fields"); … … 95 92 96 93 var newDiv = document.createElement("div"); 97 newDiv.setAttribute("class", "cc_attribute"); 98 99 var labelNome = document.createElement("label"); 100 labelNome.appendChild(document.createTextNode(stringNome)); 101 94 newDiv.setAttribute("class", "cc_attribute"); 95 102 96 var formularioNome = document.createElement("input"); 103 formularioNome.setAttribute("type", "text"); 104 formularioNome.setAttribute("name", cc_attribute_name); 105 formularioNome.setAttribute("value", ""); 106 107 var labelCorrespondenteLdap = document.createElement("label"); 108 labelCorrespondenteLdap.appendChild(document.createTextNode(stringCorrespLdap)); 109 97 formularioNome.setAttribute("type", "text"); 98 formularioNome.setAttribute("name", cc_attribute_name); 99 formularioNome.setAttribute("value", ""); 100 formularioNome.setAttribute("style", "width: 170px;"); 101 110 102 var formularioLdap = document.createElement("input"); 111 formularioLdap.setAttribute("type", "text"); 112 formularioLdap.setAttribute("name", cc_attribute_ldapname); 113 formularioLdap.setAttribute("value", ""); 114 115 var labelTipo = document.createElement("label"); 116 labelTipo.appendChild(document.createTextNode(stringTipo)); 117 103 formularioLdap.setAttribute("type", "text"); 104 formularioLdap.setAttribute("name", cc_attribute_ldapname); 105 formularioLdap.setAttribute("value", ""); 106 //formularioLdap.setAttribute("style", "margin: 0px 40px;"); 107 formularioLdap.setAttribute("style", "width: 170px;"); 108 118 109 var selectTipos = document.createElement("select"); 119 110 selectTipos.setAttribute("name", cc_attribute_type); 111 selectTipos.setAttribute("style", "width: 86px; margin: 0px 0px 0px 8px"); 112 //selectTipos.setAttribute("style", "margin: 0px 0px 0px 8px"); 120 113 var optionTexto = document.createElement("option"); 121 114 optionTexto.setAttribute("value", "text"); … … 130 123 selectTipos.appendChild(optionMultivalorado); 131 124 132 125 var selectPesquisavel = document.createElement("select"); 126 selectPesquisavel.setAttribute("name", cc_attribute_searchable); 127 selectPesquisavel.setAttribute("style", "margin: 0px 16px;"); 128 var optionYes = document.createElement("option"); 129 optionYes.setAttribute("value", "true"); 130 optionYes.innerHTML = "Sim "; 131 var optionNo = document.createElement("option"); 132 optionNo.setAttribute("value", "false"); 133 optionNo.setAttribute("selected", "selected"); 134 optionNo.innerHTML = "Não "; 135 136 137 selectPesquisavel.appendChild(optionYes); 138 selectPesquisavel.appendChild(optionNo); 139 140 141 133 142 var imagem = document.createElement("img"); 134 imagem.setAttribute("type", "image"); 135 imagem.setAttribute("src", "contactcenter/templates/default/images/cc_x.png"); 136 imagem.setAttribute("alt", "Excluir Campo "); 137 imagem.setAttribute("style", "width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;"); 138 imagem.setAttribute("onclick", "javascript:cc_attribute_delete(this)"); 139 140 newDiv.appendChild(labelNome); 143 imagem.setAttribute("type", "image"); 144 imagem.setAttribute("src", "contactcenter/templates/default/images/cc_x.png"); 145 imagem.setAttribute("alt", "Excluir Campo "); 146 imagem.setAttribute("style", "width: 15px; height: 14px; cursor: pointer; position: relative; top: 3px;"); 147 imagem.setAttribute("onclick", "javascript:cc_attribute_delete(this)"); 148 141 149 newDiv.appendChild(formularioNome); 142 newDiv.appendChild( labelCorrespondenteLdap);150 newDiv.appendChild(document.createTextNode(" ")); 143 151 newDiv.appendChild(formularioLdap); 144 newDiv.appendChild( labelTipo);152 newDiv.appendChild(document.createTextNode(" ")); 145 153 newDiv.appendChild(selectTipos); 154 newDiv.appendChild(document.createTextNode(" ")); 155 newDiv.appendChild(selectPesquisavel); 146 156 newDiv.appendChild(document.createTextNode(" ")); 147 157 newDiv.appendChild(imagem); … … 168 178 var select = tupla.getElementsByTagName("select"); 169 179 select[0].innerHTML = "<option value=\"\" selected=\"selected\"></option>"; 180 select[1].innerHTML = "<option value=\"\" selected=\"selected\"></option>"; 170 181 171 182 tupla.style.visible = "hidden"; -
sandbox/2.2.0.2/contactcenter/js/cc_search.js
r3644 r4544 130 130 this.DOMinput = document.createElement('input'); 131 131 this.DOMbtn = document.createElement('input'); 132 this.DOMAdv = document.createElement('input'); 132 133 this.DOMbtn2 = document.createElement('input'); 133 134 this.DOMbtn3 = document.createElement('input'); … … 191 192 this.DOMbtn.type = 'button'; 192 193 //this.DOMbtn.style.height = parseInt(this.DOMdiv.style.height)/2 + 'px'; 193 this.DOMbtn.style.width = '60px';194 // this.DOMbtn.style.width = '60px'; 194 195 this.DOMbtn.value = params['button_text']; 195 196 this.DOMbtn.onclick = function () {_this.go();}; … … 206 207 this.DOMbtn3.disabled = 'disabled'; 207 208 this.DOMbtn3.value = v_label + ':'; 209 var btn = this.DOMbtn.cloneNode(true); 210 211 var btn = this.DOMbtn.cloneNode(true); 212 213 this.DOMAdv.type = 'button'; 214 // this.DOMAdv.style.padding = '1px'; 215 this.DOMAdv.value = 'Busca Avancada'; 216 this.DOMAdv.id = 'advanced'; 217 this.DOMAdv.onclick = function() 218 { 219 var target = document.getElementById( 'Layer2' ); 220 221 if( !target.innerHTML ) 222 { 223 var overlay = document.createElement( 'DIV' ); 224 225 var items = target.style.width = overlay.innerHTML = ''; 226 227 var config = { "cn":"Nome", "uid":"Matricula" }; 228 229 for( attr in config ) 230 items += "<tr><td style='padding: 3px'>"+config[attr]+"</td><td style='padding: 5px;'><input type='text' name='advanced_search' label='"+attr+"'><br></td></tr>"; 231 232 for( attr in advanced_search_fields ) 233 items += "<tr><td style='padding: 3px'>"+advanced_search_fields[attr]+"</td><td style='padding: 5px;'><input type='text' name='advanced_search' label='"+attr+"'><br></td></tr>"; 234 235 var itemH = document.createElement('DIV'); 236 237 itemH.innerHTML = items ? '<table>' + items + '</table>' : ''; 238 target.appendChild( itemH ); 239 240 target.style.left = "507px"; 241 242 var holder = document.createElement('DIV'); 243 holder.setAttribute('align','center'); 244 245 var exact_search = document.createElement('input'); 246 exact_search.type = 'checkbox'; 247 exact_search.id = 'exact_search'; 248 exact_search.setAttribute( "checked", "checked" ); 249 250 var label_exact_search = document.createElement('label'); 251 label_exact_search.setAttribute( "rel", exact_search.id ); 252 label_exact_search.innerHTML = 'Busca Exata'; 253 254 btn.onclick = function(){ _this.go(); }; 255 var closeBtn = document.createElement('input'); 256 closeBtn.value = 'Fechar'; 257 closeBtn.type = 'button'; 258 closeBtn.onclick = function(){ 259 document.getElementById('Layer2').style.visibility = 'hidden'; 260 document.getElementById('overlay').style.visibility = 'hidden'; 261 }; 262 263 holder.appendChild( exact_search ); 264 holder.appendChild( label_exact_search ); 265 holder.appendChild( spacer.cloneNode(false) ); 266 holder.appendChild( btn ); 267 holder.appendChild( spacer.cloneNode(false) ); 268 holder.appendChild( closeBtn ); 269 holder.appendChild( spacer.cloneNode(false) ); 270 271 holder.style.padding = '5px'; 272 target.style.padding = '5px'; 273 274 target.appendChild( holder ); 275 } 276 277 var overlay = document.getElementById('overlay'); 278 279 overlay.style.visibility = ( overlay.style.visibility === 'hidden' ? 'visible' : 'hidden' ); 280 281 var pos = findPosY( this ); 282 283 with( target.style ) 284 { 285 if( !visibility || visibility === 'visible' ) 286 visibility = 'hidden'; 287 else 288 { 289 visibility = 'visible'; 290 top = 19 + pos + "px"; 291 } 292 } 293 }; 208 294 209 295 this.DOMprogHold.style.position = 'absolute'; … … 236 322 this.DOMdiv.appendChild(spacer); 237 323 this.DOMdiv.appendChild(this.DOMbtn); 324 this.DOMdiv.appendChild(spacer.cloneNode(false)); 325 this.DOMdiv.appendChild(this.DOMAdv); 238 326 this.DOMdiv.appendChild(this.DOMprogHold); 239 327 this.DOMdiv.appendChild(this.DOMresult); … … 242 330 ccSearchClass.prototype.go = function() 243 331 { 244 if ( (this.DOMinput.value == '') && (this.DOMinputx.value == '') ) {245 if ((ccTree.actualCatalog != 'bo_group_manager') &&246 (ccTree.actualCatalog != 'bo_shared_group_manager') &&247 (!ccTree.actualCatalogIsExternal)) { //Busca avançada para pessoal e catálogo geral248 ccFullSearchVar.showForm();249 return;250 }251 }252 332 var data = new Array(); 253 333 … … 269 349 270 350 data['search_for'] = this.DOMinput.value; 271 data['search_for_area'] = this.DOMinputx.value; 272 273 var invalidChars = /[\%\?]/; 274 if(invalidChars.test(data['search_for']) || invalidChars.test(data['search_for_area'])){ 275 showMessage(Element('cc_msg_err_invalid_serch').value); 276 return; 351 352 // var customFilter = '(mail=*@mail.prognus*)(uid=*c120455*)'; 353 354 var customFilterDiv = document.getElementById( 'Layer2' ); 355 356 if( customFilterDiv && customFilterDiv.style.visibility !== 'hidden' ) 357 { 358 var customFilter = cn = ''; 359 360 var values = document.getElementsByName('advanced_search'); 361 362 for( var i = 0; i < values.length; i++ ) 363 { 364 if( !values[i].value ) continue; 365 366 if( values[i].getAttribute('label') === 'cn' ) 367 { 368 cn = values[i].value; 369 continue; 370 } 371 372 customFilter += '(' + values[i].getAttribute('label') + '=*' + values[i].value.replace( / /g, '*' ) + '*)'; 373 } 374 375 if( customFilter ) 376 { 377 if( document.getElementById('exact_search').checked ) 378 data['exact'] = 'true'; 379 380 data['search_for'] = customFilter; 381 data['CN'] = cn; 382 data['custom_filter'] = true; 383 } 384 else 385 data['search_for'] = cn; 386 387 customFilterDiv.style.visibility = 'hidden'; 388 document.getElementById('overlay').style.visibility = 'hidden'; 277 389 } 278 390 279 var search_for = data['search_for'].split(' ');280 var greaterThan4 = false;281 var use_length = v_min;282 283 if (search_for.length == 1)284 {285 if(search_for[0].length == 0)286 {287 search_for[0] = "*";288 data['search_for'] = "*";289 use_length = 1;290 }291 }292 293 for (i = 0; i < search_for.length; i++)294 {295 if (search_for[i].length >= use_length)296 {297 greaterThan4 = true;298 }299 }300 301 if (!greaterThan4){302 alert("Favor fazer a consulta com pelo menos " + v_min + " caracteres!");303 return;304 }391 // var search_for = data['search_for'].split(' '); 392 // var greaterThan4 = false; 393 // var use_length = v_min; 394 395 // if (search_for.length == 1) 396 // { 397 // if(search_for[0].length == 0) 398 // { 399 // search_for[0] = "*"; 400 // data['search_for'] = "*"; 401 // use_length = 1; 402 // } 403 // } 404 405 // for (i = 0; i < search_for.length; i++) 406 // { 407 // if (search_for[i].length >= use_length) 408 // { 409 // greaterThan4 = true; 410 // } 411 // } 412 413 // if (!greaterThan4){ 414 // alert("Favor fazer a consulta com pelo menos " + v_min + " caracteres!"); 415 // return; 416 // } 305 417 306 418 var _this = this; -
sandbox/2.2.0.2/contactcenter/js/cc_tree.js
r3970 r4544 50 50 var _this = this; 51 51 var _catalog = catalog; 52 if( parseInt( catalog.charAt(2) ) < 2 ){ 53 document.getElementById( 'advanced' ).style.display = 'none'; 54 } 55 else 56 document.getElementById( 'advanced' ).style.display = ''; 57 52 58 53 59 var handler = function (responseText) -
sandbox/2.2.0.2/contactcenter/templates/default/config.tpl
r4538 r4544 52 52 <td>{lang_Password_for_the_account_above_(if_any)}:</td> 53 53 <td><input name="newsettings[cc_ldap_pw0]" type="password" value="" size="40" /></td> 54 </tr>55 <tr class="row_on">56 <td>{lang_LDAP_max_results}:</td>57 <td><input name="newsettings[cc_ldap_max_results]" value="{value_cc_ldap_max_results}" size="40" /></td>58 54 </tr> 59 55 <tr class="row_off"> -
sandbox/2.2.0.2/contactcenter/templates/default/index.tpl
r4500 r4544 12 12 </style> 13 13 <script src="js/cc.js" type="text/javascript"></script> 14 <script type="text/javascript"> 15 var advanced_search_fields = {cc_config_advanced_search}; 16 </script> 14 17 <!-- JS MESSAGES --> 15 18 <input id="cc_msg_name_mandatory" type="hidden" value="{cc_msg_name_mandatory}"> … … 256 259 </table> 257 260 <div id="Layer1" style="position:absolute; top:178px; left:183px;width:auto; padding:2px; z-index:100000; background-color:#F2F3ED; border:1px solid #999999;visibility:hidden"></div> 261 <div id="Layer2" style="position:absolute; top:178px; left:183px;width:auto; padding:2px; z-index:100000; background-color:#F2F3ED; border:1px solid #999999;visibility:hidden"></div> 258 262 <div id="debug_layer" style="position:absolute;width:0px;height:0px;display:none"></div> 259 263 <!-- _END VIEW CARDS --> … … 265 269 <script type="text/javascript" src="js/ccMain.js"></script> 266 270 <script type="text/javascript" src="js/cc_full_search.js"></script> 271 <div id='overlay' style='background-color: #666666; opacity: .50; filter:Alpha(Opacity=50); height: 100%; width: 100%; position: absolute; top: 0; left: 0; visibility: hidden;'></div> 267 272 <!-- END BOTTOM DETAILS-->
Note: See TracChangeset
for help on using the changeset viewer.