- Timestamp:
- 10/24/08 14:52:37 (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/inc/class.uiconfig.inc.php
r382 r540 152 152 echo parse_navbar(); 153 153 154 if($appname=="expressoAdmin1_2") { 155 /* Varre a pasta inc do admin do expresso procurando scripts de geração de login automático 156 (classes com nomes iniciados pela string 'login', procedida da string '_' mais o nome 157 do algoritmo. 158 */ 159 $dir = $GLOBALS['phpgw']->common->get_app_dir($appname) . "/inc"; 160 $options = ' '; 161 if (is_dir($dir)) { 162 if ($dh = opendir($dir)) { 163 while (($file = readdir($dh)) !== false) { 164 $temp = explode(".",$file); 165 if((substr($temp[1],0,5)=='login') && ($temp[0]=='class')) { 166 $options .= "<option value='".$temp[1]."'"; 167 if($current_config['expressoAdmin_loginGenScript'] == $temp[1]) 168 $options .= " selected"; 169 $options .= ">" . ucwords(str_replace("_"," ",substr($temp[1],6))) . "</option>"; 170 } 171 } 172 closedir($dh); 173 } 174 } 175 176 $t->set_var('rows_login_generator',$options); 177 } 154 178 $t->set_var('title',lang('Site Configuration')); 155 179 $t->set_var('action_url',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname)); -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r509 r540 369 369 } 370 370 371 function gera_login($params) { 372 $params = unserialize($params['attributes']); 373 $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 374 $justthese = array("uid"); 375 $i=1; 376 $login = array("status" => False,"msg" => "Gerador de logins desabilitado"); 377 378 if( (isset($this->current_config['expressoAdmin_loginGenScript'])) && 379 ($this->current_config['expressoAdmin_loginGenScript']!="nenhum")) { 380 381 include_once "if.login.inc.php"; 382 include_once "class.".$this->current_config['expressoAdmin_loginGenScript']. 383 ".inc.php"; 384 385 $classe = new ReflectionClass($this->current_config['expressoAdmin_loginGenScript']); 386 387 if(!$classe->implementsInterface('login')) { 388 return array("status" => False, "msg" => "A classe geradora de logins não implementa a interface login (Se você for um usuário, contacte o suporte)"); 389 } 390 391 $gerador = $classe->newInstance(); 392 393 $login = $gerador->gera_login($params["first_name"],$params["second_name"],$this->ldap); 394 395 /* 396 Se o algoritmo gerar um login que já existe, colocamos um número no final do 397 login gerado, resultando em um login não existente 398 */ 399 while(true) { 400 $filter = "(uid=$login)"; 401 $search = ldap_search($this->ldap, $context, $filter, $justthese); 402 $entries = ldap_count_entries($this->ldap,$search); 403 if($entries==0) 404 break; 405 else { 406 $login.=$i; 407 $i++; 408 } 409 } 410 } 411 412 return array('status'=>true,'msg' => $login); 413 } 371 414 function validate_fields_group($params) 372 415 { -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r520 r540 241 241 // First ABA 242 242 'display_spam_uid' => 'display:none', 243 243 'lang_gerar_login' => lang('Generate login'), 244 'start_coment_expired' => "<!--", 245 'end_coment_expired' => "-->", 244 246 'sectors' => $combo_manager_org, 245 247 'combo_organizations' => $combo_manager_org, … … 275 277 'use_suggestion_in_logon_script' => $this->current_config['expressoAdmin_defaultLogonScript'] == '' ? 'true' : 'false', 276 278 ); 279 280 if( (isset($this->current_config['expressoAdmin_loginGenScript'])) && 281 ($this->current_config['expressoAdmin_loginGenScript']!="nenhum")) { 282 $var['input_uid_disabled'] = 'disabled'; 283 $var['comment_button'] = ' '; 284 $var['end_comment_button'] = ' '; 285 } 286 else { 287 $var['input_uid_disabled'] = ' '; 288 $var['comment_button'] = '<!--'; 289 $var['end_comment_button'] = '-->'; 290 } 291 277 292 $t->set_var($var); 278 293 $t->set_var($this->functions->make_dinamic_lang($t, 'main')); -
trunk/expressoAdmin1_2/js/jscode/users.js
r510 r540 191 191 select_user_groups.options[i].selected = true; 192 192 ///////////////////////////////////////////////////////////////////////////////////////////////////////// 193 193 document.getElementById('uid').disabled = false; //Caso o login seja gerado automático, tirar o disabled. 194 194 cExecute ('$this.ldap_functions.validate_fields&attributes='+attributes, handler_validate_fields); 195 } 196 197 function gera_login(first_name,second_name) { 198 if ((first_name=='') || (second_name=='')) { 199 alert(get_lang("You must type the first and the second name before generate the login")); 200 return; 201 } 202 var attrs_array = new Array(); 203 attrs_array['first_name'] = first_name; 204 attrs_array['second_name'] = second_name; 205 var attributes = connector.serialize(attrs_array); 206 207 var hangler_gera_login = function(data) { 208 if(data['status']) { 209 document.getElementById('uid').value = data['msg']; 210 emailSuggestion_expressoadmin('true','true'); 211 document.getElementById("mail").value=document.getElementById("mail1").value; 212 } 213 else 214 alert(data['msg']); 215 } 216 217 cExecute ('$this.ldap_functions.gera_login&attributes='+attributes, hangler_gera_login); 195 218 } 196 219 -
trunk/expressoAdmin1_2/templates/default/accounts_form.tpl
r493 r540 54 54 <td> 55 55 <table border="0" style="{display_input_account_lid}"><tr><td> 56 <input type="text" name="uid" value="{uid}"autocomplete="off" {disabled} size=20 onKeyUp="javascript:emailSuggestion_expressoadmin('{use_suggestion_in_logon_script}','{concatenateDomain}')" onblur="users_form.mail.value=users_form.mail1.value;"></input>57 </td> </tr></table>56 <input type="text" name="uid" id="uid" value="{uid}"autocomplete="off" {disabled} {input_uid_disabled} size=20 onKeyUp="javascript:emailSuggestion_expressoadmin('{use_suggestion_in_logon_script}','{concatenateDomain}')" onblur="users_form.mail.value=users_form.mail1.value;"></input> 57 </td>{comment_button}<td><input type="button" value="{lang_gerar_login}" onclick="javascript:gera_login(document.getElementById('givenname').value,document.getElementById('sn').value)" ></td>{end_comment_button}</tr></table> 58 58 <spam style="{display_spam_uid}"><font size="3">{uid}</font></spam> 59 59 </td> 60 60 <td>{lang_email}:</td> 61 <td><input type="text" name="mail1" autocomplete="off" {disabled} size=42 value="{mail1}" onblur="users_form.mail.value=this.value;"></td>61 <td><input type="text" name="mail1" id="mail1" autocomplete="off" {disabled} size=42 value="{mail1}" onblur="users_form.mail.value=this.value;"></td> 62 62 </tr> 63 63 64 64 <tr bgcolor={row_off}> 65 65 <td width="15%">{lang_firstname}:</td> 66 <td width="35%"><input type="text" name="givenname" value="{givenname}" autocomplete="off" {disabled} size=42></input> </td>66 <td width="35%"><input type="text" name="givenname" id="givenname" value="{givenname}" autocomplete="off" {disabled} size=42></input> </td> 67 67 <td width="15%">{lang_lastname}:</td> 68 <td width="35%"><input type="text" name="sn" value="{sn}" autocomplete="off" {disabled} size=42></input> </td>68 <td width="35%"><input type="text" name="sn" id="sn" value="{sn}" autocomplete="off" {disabled} size=42></input> </td> 69 69 </tr> 70 70 … … 157 157 <tr bgcolor={row_on}> 158 158 <td>{lang_email}:</td> 159 <td><input type="text" name="mail" autocomplete="off" value="{mail1}" {disabled} size=30 onblur="users_form.mail1.value=this.value"></td>159 <td><input type="text" name="mail" id="mail" autocomplete="off" value="{mail1}" {disabled} size=30 onblur="users_form.mail1.value=this.value"></td> 160 160 </tr> 161 161 -
trunk/expressoAdmin1_2/templates/default/config.tpl
r355 r540 162 162 <td><span>{lang_Result}: </span><span id="nextid_db_result"></span></td> 163 163 </tr> 164 164 <tr class="row_on"> 165 <td>{lang_use_login_generator}</td> 166 <td> 167 <select name="newsettings[expressoAdmin_loginGenScript]"> 168 <option value="nenhum">{lang_none}</option> 169 {rows_login_generator} 170 </select> 171 </td> 172 </tr> 165 173 <!-- END body --> 166 174 <!-- BEGIN footer -->
Note: See TracChangeset
for help on using the changeset viewer.