Changeset 33
- Timestamp:
- 06/21/07 08:32:34 (17 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.functions.inc.php
r32 r33 428 428 */ 429 429 430 function get_organizations($context, $selected='' )430 function get_organizations($context, $selected='', $referral=false, $show_invisible_ou=true) 431 431 { 432 432 $s = CreateObject('phpgwapi.sector_search_ldap'); 433 $sectors_info = $s->get_organizations($context, $selected, false, true);433 $sectors_info = $s->get_organizations($context, $selected, $referral, $show_invisible_ou); 434 434 return $sectors_info; 435 435 } 436 436 437 function get_sectors($selected='', $referral=false, $show_invisible_ou=true) 438 { 439 $s = CreateObject('phpgwapi.sector_search_ldap'); 440 $sectors_info = $s->get_sectors($selected, $referral, $show_invisible_ou); 441 return $sectors_info; 442 } 443 437 444 /* 438 445 function get_sectors($context, $selected='') -
trunk/expressoAdmin1_2/inc/class.group.inc.php
r23 r33 93 93 { 94 94 $group_info['objectClass'][] = 'sambaGroupMapping'; 95 $group_info['sambaSID'] = $ this->current_config['expressoAdmin_sambaSID'] . '-' . (($id * 2) + 1001);95 $group_info['sambaSID'] = $params['sambadomain'] . '-' . (($id * 2) + 1001); 96 96 $group_info['sambaGroupType'] = '2'; 97 97 } … … 167 167 168 168 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 169 // REPLACE SAMBASID OF SAMBA 170 if ( ($this->current_config['expressoAdmin_samba_support'] == 'true') && ($diff['sambadomain']) ) 171 { 172 $ldap_mod_replace['sambaSID'] = $new_values['sambadomain'] . '-' . ((2 * $new_values['uidnumber'])+1001); 173 $this->db_functions->write_log("Alterado dominio samba do grupo $dn para " . $new_values['sambadomain'],'',$dn,'',''); 174 } 175 176 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 169 177 // REPLACE DESCRIPTION 170 178 if ($new_values['description'] != $old_values['description']) 171 179 { 172 180 $ldap_mod_replace['description'] = $new_values['description']; 181 $this->db_functions->write_log("Modificado descrição do grupo $dn",'',$dn,'',''); 182 } 183 184 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 185 // CALL LDAP_REPLACE FUNCTION 186 if (count($ldap_mod_replace)) 187 { 173 188 $result = $this->ldap_functions->replace_user_attributes($dn, $ldap_mod_replace); 174 189 if (!$result['status']) … … 177 192 $return['msg'] .= $result['msg']; 178 193 } 179 else 180 $this->db_functions->write_log("Modificado descrição do grupo $dn",'',$dn,'',''); 181 } 194 } 182 195 183 196 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// … … 213 226 $ldap_add['objectClass'][] = 'sambaGroupMapping'; 214 227 $ldap_add['sambagrouptype'] = '2'; 215 $ldap_add['sambasid'] = $ this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $new_values['gidnumber'])+1001);228 $ldap_add['sambasid'] = $new_values['sambadomain'] . '-' . ((2 * $new_values['gidnumber'])+1001); 216 229 217 230 $result = $this->ldap_functions->add_user_attributes($dn, $ldap_add); … … 225 238 } 226 239 } 227 240 228 241 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 229 242 // ADD ATTRIBUTES -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r32 r33 371 371 372 372 $entries = ldap_get_entries($this->ldap, $groups_list); 373 return $entries; 373 374 $options = ''; 375 for ($i=0; $i<$entries['count']; $i++) 376 { 377 $options .= "<option value=" . $entries[$i]['gidnumber'][0] . ">" . $entries[$i]['cn'][0] . "</option>"; 378 } 379 380 return $options; 374 381 } 375 382 … … 382 389 383 390 $entries = ldap_get_entries($this->ldap, $maillists); 384 return $entries; 391 392 $options = ''; 393 for ($i=0; $i<$entries['count']; $i++) 394 { 395 $options .= "<option value=" . $entries[$i]['uidnumber'][0] . ">" . $entries[$i]['uid'][0] . " (" . $entries[$i]['mail'][0] . ")" . "</option>"; 396 } 397 return $options; 385 398 } 386 399 … … 744 757 if ($entry[0]['objectclass'][$i] == 'sambaGroupMapping') 745 758 $result['sambaGroup'] = true; 759 760 $a_tmp = explode("-", $entry[0]['sambasid'][0]); 761 array_pop($a_tmp); 762 $result['sambasid'] = implode("-", $a_tmp); 746 763 } 747 764 … … 1161 1178 return $return; 1162 1179 } 1163 1180 /* 1164 1181 function rename_departmentnumber($old_dp, $new_dp) 1165 1182 { … … 1177 1194 $ldap_mod_replace['departmentnumber'] = $new_dp; 1178 1195 @ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace); 1179 / *if (!@ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace))1180 {1181 $return['status'] = false;1182 $return['msg'] .= 'Erro em ldap_funcitons->rename_departmentnumber: ' . ldap_error($this->ldap);1183 }*/1196 //if (!@ldap_mod_replace ( $this->ldap, $dn, $ldap_mod_replace)) 1197 //{ 1198 // $return['status'] = false; 1199 // $return['msg'] .= 'Erro em ldap_funcitons->rename_departmentnumber: ' . ldap_error($this->ldap); 1200 //} 1184 1201 } 1202 return $return; 1203 } 1204 */ 1205 /* 1206 function get_sambadomains($context) 1207 { 1208 $return['status'] = true; 1209 $return['sambaDomains'] = array(); 1210 1211 $justthese = array("sambaSID","sambaDomainName"); 1212 $filter="(objectClass=sambaDomain)"; 1213 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1214 $entry = ldap_get_entries($this->ldap, $search); 1215 1216 for ($i=0; $i<$entry['count']; $i++) 1217 { 1218 $return['sambaDomains'][$i]['samba_domain_sid'] = $entry[$i]['sambasid'][0]; 1219 $return['sambaDomains'][$i]['samba_domain_name'] = $entry[$i]['sambadomainname'][0]; 1220 $return['sambaDomains'][$i]['samba_domain_dn'] = $entry[$i]['dn']; 1221 } 1222 1223 return $return; 1224 } 1225 */ 1226 function exist_sambadomains($context, $sambaDomainName) 1227 { 1228 $justthese = array("dn"); 1229 $filter="(&(objectClass=sambaDomain)(sambaDomainName=$sambaDomainName))"; 1230 $search = ldap_search($this->ldap, $context, $filter, $justthese); 1231 $entry = ldap_get_entries($this->ldap, $search); 1232 1233 if ($entry['count']) 1234 return true; 1235 else 1236 return false; 1237 } 1238 1239 // Primeiro nilvel de organização. 1240 function exist_sambadomains_in_context($params) 1241 { 1242 $dn = $GLOBALS['phpgw_info']['server']['ldap_context']; 1243 $array_dn = ldap_explode_dn ( $dn, 0 ); 1244 1245 $context = $params['context']; 1246 $array_context = ldap_explode_dn ( $context, 0 ); 1247 1248 // Pego o setor no caso do contexto ser um sub-setor. 1249 if (($array_dn['count']+1) < ($array_context['count'])) 1250 { 1251 // inverto o array_dn para poder retirar o count 1252 $array_dn_reverse = array_reverse ( $array_dn, false ); 1253 1254 //retiro o count 1255 array_pop($array_dn_reverse); 1256 1257 //incluo o setor no dn 1258 array_push ( $array_dn_reverse, $array_context[ $array_context['count'] - 1 - $array_dn['count']]); 1259 1260 // Volto a ordem natural 1261 $array_dn = array_reverse ( $array_dn_reverse, false ); 1262 1263 // Implodo 1264 $context = implode ( ",", $array_dn ); 1265 } 1266 1267 $justthese = array("dn","sambaDomainName"); 1268 $filter="(objectClass=sambaDomain)"; 1269 $search = ldap_list($this->ldap, $context, $filter, $justthese); 1270 $entry = ldap_get_entries($this->ldap, $search); 1271 1272 for ($i=0; $i<$entry['count']; $i++) 1273 { 1274 $return['sambaDomains'][$i] = $entry[$i]['sambadomainname'][0]; 1275 } 1276 1277 if ($entry['count']) 1278 $return['status'] = true; 1279 else 1280 $return['status'] = false; 1281 1185 1282 return $return; 1186 1283 } -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r32 r33 178 178 function add_users() 179 179 { 180 $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); 181 //$GLOBALS['phpgw']->js->set_onload('get_sectors(document.forms[0].context.value);'); 180 $GLOBALS['phpgw']->js->validate_file('jscode','users','expressoAdmin1_2'); 182 181 $GLOBALS['phpgw']->js->set_onload('get_available_groups(document.forms[0].context.value);'); 183 182 $GLOBALS['phpgw']->js->set_onload('get_available_maillists(document.forms[0].context.value);'); 184 183 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 184 $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_user\');'); 185 185 186 $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 186 187 $tmp = $this->functions->read_acl($manager_lid); … … 220 221 foreach ($a_sambadomains as $a_sambadomain) 221 222 { 222 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 223 // So mostra os sambaDomainName do contexto do manager 224 if ($this->ldap_functions->exist_sambadomains($manager_context, $a_sambadomain['samba_domain_name'])) 225 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 223 226 } 224 227 } … … 234 237 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uiaccounts.list_users'), 235 238 'display_samba_suport' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 239 'disabled_access_button'=> 'disabled', 236 240 237 241 // First ABA -
trunk/expressoAdmin1_2/inc/class.uidomains.inc.php
r27 r33 78 78 else 79 79 { 80 81 80 foreach($sambadomains_info as $domains) 82 81 { … … 119 118 120 119 // Pega combo das organizações e seleciona, caso seja um post, o setor que o usuario selecionou. 121 $organizations = $this->functions->get_ organizations($manager_context, $_POST['context']);122 120 $organizations = $this->functions->get_sectors($_POST['context'], false, false); 121 123 122 unset($GLOBALS['phpgw_info']['flags']['noheader']); 124 123 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); -
trunk/expressoAdmin1_2/inc/class.uigroups.inc.php
r24 r33 23 23 var $group; 24 24 var $functions; 25 var $ldap_functions; 26 var $db_functions; 25 27 26 28 function uigroups() … … 29 31 $this->nextmatchs = createobject('phpgwapi.nextmatchs'); 30 32 $this->functions = CreateObject('expressoAdmin1_2.functions'); 33 $this->ldap_functions = CreateObject('expressoAdmin1_2.ldap_functions'); 34 $this->db_functions = CreateObject('expressoAdmin1_2.db_functions'); 31 35 32 36 $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); … … 167 171 { 168 172 $GLOBALS['phpgw']->js->set_onload('get_available_users(document.forms[0].org_context.value, document.forms[0].ea_check_allUsers.checked);'); 169 173 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 174 $GLOBALS['phpgw']->js->set_onload('get_available_sambadomains(document.forms[0].context.value, \'create_group\');'); 175 170 176 $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; 171 177 $acl = $this->functions->read_acl($account_lid); … … 193 199 // Chama funcao para criar lista de aplicativos disponiveis. 194 200 $apps = $this->functions->make_list_app($account_lid, $manager_context, ''); 201 202 // Cria combo de dominio samba 203 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 204 { 205 $a_sambadomains = $this->db_functions->get_sambadomains_list(); 206 $sambadomainname_options = ''; 207 if (count($a_sambadomains)) 208 { 209 foreach ($a_sambadomains as $a_sambadomain) 210 { 211 // So mostra os sambaDomainName do contexto do manager 212 if ($this->ldap_functions->exist_sambadomains($manager_context, $a_sambadomain['samba_domain_name'])) 213 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 214 } 215 } 216 } 195 217 196 218 // Seta variaveis utilizadas pelo tpl. … … 201 223 'cn' => '', 202 224 'restrictionsOnGroup' => $this->current_config['expressoAdmin_restrictionsOnGroup'], 225 'type' => 'create_group', 203 226 'ldap_context' => $GLOBALS['phpgw_info']['server']['ldap_context'], 204 227 'lang_back' => lang('Back'), … … 212 235 'lang_all_users' => lang('Select users from all sub-organizations'), 213 236 'apps' => $apps, 214 'use_attrs_samba_checked' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? 'CHECKED' : '', 237 //'use_attrs_samba_checked' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? 'CHECKED' : '', 238 'use_attrs_samba_checked' => '', 239 'disabled_samba' => 'disabled', 240 'display_samba_options' => $this->current_config['expressoAdmin_samba_support'] == 'true' ? '' : '"display:none"', 241 'sambadomainname_options' => $sambadomainname_options, 215 242 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.list_groups'), 216 243 'combo_manager_org' => $combo_manager_org, … … 283 310 // Chama funcao para criar lista de aplicativos disponiveis. 284 311 $apps = $this->functions->make_list_app($account_lid, $manager_context, $group_info['apps']); 312 313 // Cria combo de dominios do samba 314 if ($this->current_config['expressoAdmin_samba_support'] == 'true') 315 { 316 $a_sambadomains = $this->db_functions->get_sambadomains_list(); 317 $sambadomainname_options = ''; 318 if (count($a_sambadomains)) 319 { 320 foreach ($a_sambadomains as $a_sambadomain) 321 { 322 if ($a_sambadomain['samba_domain_sid'] == $group_info['sambasid']) 323 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "' SELECTED>" . $a_sambadomain['samba_domain_name'] . "</option>"; 324 else 325 $sambadomainname_options .= "<option value='" . $a_sambadomain['samba_domain_sid'] . "'>" . $a_sambadomain['samba_domain_name'] . "</option>"; 326 } 327 } 328 } 285 329 286 330 // Seta variaveis utilizadas pelo tpl. … … 306 350 'apps' => $apps, 307 351 'use_attrs_samba_checked' => $group_info['sambaGroup'] ? 'CHECKED' : '', 352 'disabled_samba' => $group_info['sambaGroup'] ? '' : 'disabled', 353 'sambadomainname_options' => $sambadomainname_options, 308 354 'phpgwaccountvisible_checked' => $group_info['phpgwaccountvisible'] == '-1' ? 'CHECKED' : '', 309 355 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.list_groups'), -
trunk/expressoAdmin1_2/inc/class.uisectors.inc.php
r32 r33 191 191 'lang_context' => lang('Context'), 192 192 'lang_sector_name' => lang('Sector name'), 193 'lang_ visible' => lang('Visible'),193 'lang_occult_ou' => lang('Occult Sector'), 194 194 'error_messages' => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", 195 195 ); -
trunk/expressoAdmin1_2/inc/class.user.inc.php
r32 r33 119 119 $user_info['loginShell'] = '/bin/bash'; 120 120 121 //$user_info['sambaSID'] = $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $id)+1000);122 //$user_info['sambaPrimaryGroupSID'] = $this->current_config['expressoAdmin_sambaSID'] . '-' . ((2 * $user_info['gidNumber'])+1001);123 121 $user_info['sambaSID'] = $params['sambadomain'] . '-' . ((2 * $id)+1000); 124 122 $user_info['sambaPrimaryGroupSID'] = $params['sambadomain'] . '-' . ((2 * $user_info['gidNumber'])+1001); -
trunk/expressoAdmin1_2/js/jscode/groups.js
r2 r33 277 277 } 278 278 } 279 280 function use_samba_attrs(value) 281 { 282 document.forms[0].sambadomain.disabled = !value; 283 } 284 285 function get_available_sambadomains(context, type) 286 { 287 if ((type == 'create_group') && (document.getElementById('ea_div_display_samba_options').style.display != 'none')) 288 { 289 var handler_get_available_sambadomains = function(data) 290 { 291 document.forms[0].use_attrs_samba.checked = data.status; 292 use_samba_attrs(data.status); 293 294 if (data.status) 295 { 296 combo_sambadomains = document.getElementById('ea_combo_sambadomains'); 297 for (i=0; i<data.sambaDomains.length; i++) 298 { 299 for (j=0; j<combo_sambadomains.length; j++) 300 { 301 if (combo_sambadomains.options[j].text == data.sambaDomains[i]) 302 { 303 combo_sambadomains.options[j].selected = true; 304 break; 305 } 306 } 307 } 308 309 } 310 } 311 cExecute ('$this.ldap_functions.exist_sambadomains_in_context&context='+context, handler_get_available_sambadomains); 312 } 313 } -
trunk/expressoAdmin1_2/js/jscode/users.js
r32 r33 199 199 } 200 200 201 /*202 function get_sectors(organization, user_context, user_sector)203 {204 return;205 var handler_get_sectors = function(data)206 {207 select_sector = document.getElementById('ea_select_sectors');208 //Limpa o select209 for(var i=0; i<select_sector.options.length; i++)210 {211 if(select_sector.options[i].selected == true)212 {213 select_sector.options[i] = null;214 i--;215 }216 }217 218 if (data.length > 0)219 {220 option_seleted = false;221 222 new_option = new Option('Sem Setor','',false,false);223 select_sector.options[0] = new_option;224 225 for (i=0; i<data.length; i++)226 {227 new_option = new Option(data[i].sector,data[i].sector,false,false);228 select_sector.options[i+1] = new_option;229 if ((user_sector == data[i].sector) && (user_context == organization))230 {231 select_sector.options[i+1].selected = true;232 option_seleted = true;233 }234 }235 select_sector.disabled = false;236 if (!option_seleted)237 select_sector.options[0].selected = true;238 }239 else240 {241 new_option = new Option('Nenhum setor cadastrado para esta organização.','',false,false);242 select_sector.options[0] = new_option;243 select_sector.options[0].selected = true;244 }245 }246 cExecute ('$this.db_functions.get_sectors&organization='+organization, handler_get_sectors);247 }248 */249 250 201 function get_available_groups(context) 251 202 { … … 253 204 { 254 205 select_available_groups = document.getElementById('ea_select_available_groups'); 255 //Limpa o select 256 for(var i=0; i<select_available_groups.options.length; i++) 257 { 258 select_available_groups.options[i] = null; 259 i--; 260 } 261 262 if (data.length > 0) 263 { 264 for (i=0; i<data.length; i++) 265 { 266 new_option = new Option(data[i].cn[0],data[i].gidnumber[0],false,false); 267 select_available_groups.options[i] = new_option; 268 } 269 //select_available_groups.disabled = false; 270 select_available_groups.options[0].selected = true; 206 207 if ((data) && (data.length > 0)) 208 { 209 // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 210 select_available_groups.innerHTML = '#' + data; 211 select_available_groups.outerHTML = select_available_groups.outerHTML; 271 212 select_available_groups_clone = select_available_groups.cloneNode(true); 272 213 document.getElementById('ea_input_searchGroup').value = ''; 273 214 } 215 else 216 { 217 // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 218 select_available_groups.innerHTML = '#'; 219 select_available_groups.outerHTML = select_available_groups.outerHTML; 274 220 } 275 221 } 276 222 277 cExecute ('$this.ldap_functions.get_available_groups&context='+context, handler_get_available_groups); 278 } 279 280 223 cExecute ('$this.ldap_functions.get_available_groups&context='+context, handler_get_available_groups); 224 } 225 281 226 function add_user2group() 282 227 { … … 348 293 } 349 294 } 350 351 //return;352 /*353 //Refaz combo do primary group354 for(var i=0; i<combo_primary_user_group.options.length; i++)355 {356 if(combo_primary_user_group.options[i].selected == true)357 {358 var user_primary_group = combo_primary_user_group.options[i].value;359 alert(user_primary_group);360 }361 362 combo_primary_user_group.options[i] = null;363 i--;364 }365 366 for(var i = 0;i < select_user_groups.options.length; i++)367 {368 new_option = document.createElement('option');369 new_option.value= select_user_groups.options[i].value;370 new_option.text = select_user_groups.options[i].text;371 372 if (user_primary_group == select_user_groups.options[i].value)373 new_option.selected = true;374 375 combo_primary_user_group.options[i] = new_option;376 }*/377 295 } 378 296 … … 382 300 { 383 301 select_available_maillists = document.getElementById('ea_select_available_maillists'); 384 //Limpa o select 385 for(var i=0; i<select_available_maillists.options.length; i++) 386 { 387 select_available_maillists.options[i] = null; 388 i--; 389 } 390 391 if (data.length > 0) 392 { 393 for (i=0; i<data.length; i++) 394 { 395 new_option = new Option(data[i].uid[0]+' ('+data[i].mail[0]+')', data[i].uidnumber[0], false, false); 396 select_available_maillists.options[i] = new_option; 397 } 398 select_available_maillists.disabled = false; 399 select_available_maillists.options[0].selected = true; 302 303 if ((data) && (data.length > 0)) 304 { 305 // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 306 select_available_maillists.innerHTML = '#' + data; 307 select_available_maillists.outerHTML = select_available_maillists.outerHTML; 400 308 select_available_maillists_clone = select_available_maillists.cloneNode(true); 401 309 document.getElementById('ea_input_searchMailList').value = ''; 402 310 } 403 } 404 311 else 312 { 313 // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 314 select_available_maillists.innerHTML = '#'; 315 select_available_maillists.outerHTML = select_available_maillists.outerHTML; 316 } 317 } 405 318 cExecute ('$this.ldap_functions.get_available_maillists&context='+context, handler_get_available_maillists); 406 319 } … … 663 576 } 664 577 oWait.innerHTML = ' '; 665 } 578 } 579 580 function get_available_sambadomains(context, type) 581 { 582 if ((type == 'create_user') && (document.getElementById('tabcontent6').style.display != 'none')) 583 { 584 var handler_get_available_sambadomains = function(data) 585 { 586 document.forms[0].use_attrs_samba.checked = data.status; 587 use_samba_attrs(data.status); 588 589 if (data.status) 590 { 591 combo_sambadomains = document.getElementById('ea_combo_sambadomains'); 592 for (i=0; i<data.sambaDomains.length; i++) 593 { 594 for (j=0; j<combo_sambadomains.length; j++) 595 { 596 if (combo_sambadomains.options[j].text == data.sambaDomains[i]) 597 { 598 combo_sambadomains.options[j].selected = true; 599 break; 600 } 601 } 602 } 603 604 } 605 } 606 cExecute ('$this.ldap_functions.exist_sambadomains_in_context&context='+context, handler_get_available_sambadomains); 607 } 608 } -
trunk/expressoAdmin1_2/templates/default/accounts_form.tpl
r32 r33 42 42 <tr bgcolor={row_on}> 43 43 <td>{lang_organizations}:</td> 44 <td><select {disabled} id="ea_combo_org_info" name="context" onchange="javascript:sinc_combos_org(this.value); get_available_groups(this.value); get_available_maillists(this.value); ">{sectors}</select></td>44 <td><select {disabled} id="ea_combo_org_info" name="context" onchange="javascript:sinc_combos_org(this.value); get_available_groups(this.value); get_available_maillists(this.value); get_available_sambadomains(this.value, '{type}')">{sectors}</select></td> 45 45 </tr> 46 46 … … 106 106 107 107 <tr bgcolor={row_on}> 108 <td><input type='button' {disabled} value='Exibir registros de acesso' onclick="document.location.href='./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_access_log&account_id={uidnumber}';"></td>108 <td><input type='button' {disabled} {disabled_access_button} value='Exibir registros de acesso' onclick="document.location.href='./index.php?menuaction=expressoAdmin1_2.uiaccounts.show_access_log&account_id={uidnumber}';"></td> 109 109 </tr> 110 110 </table> … … 290 290 <td>{lang_sambadomain}:</td> 291 291 <td> 292 <select {disabled_samba} name="sambadomain" >292 <select {disabled_samba} name="sambadomain" id="ea_combo_sambadomains"> 293 293 {sambadomainname_options} 294 294 </select> -
trunk/expressoAdmin1_2/templates/default/groups_form.tpl
r24 r33 22 22 <td width="25%" bgcolor="#DDDDDD"> 23 23 Organização do Grupo:<br> 24 <select name="context" onchange="javascript:sinc_combos_org(this.value, ea_check_allUsers.checked); ">{combo_manager_org}</select><br>24 <select name="context" onchange="javascript:sinc_combos_org(this.value, ea_check_allUsers.checked); get_available_sambadomains(this.value, '{type}')">{combo_manager_org}</select><br> 25 25 {lang_group_name}: <font color="blue">Ex: grupo-celepar-rh</font> 26 26 <input name="cn" size="35" value="{cn}" autocomplete="off"><br> 27 27 Descrição:<br> 28 28 <input name="description" size="60" value="{description}" autocomplete="off"><br> 29 Usar atributos Samba: <input type="checkbox" {use_attrs_samba_checked} name="use_attrs_samba"><br> 29 <div id="ea_div_display_samba_options" style={display_samba_options}> 30 <table border="0"> 31 <tr bgcolor={row_on}> 32 <td>Usar atributos Samba:</td> 33 <td> 34 <input type="checkbox" {use_attrs_samba_checked} name="use_attrs_samba" onChange="javascript:use_samba_attrs(this.checked)"> 35 </td> 36 </tr> 37 <tr> 38 <td>Domínio:</td> 39 <td> 40 <select {disabled_samba} name="sambadomain" id="ea_combo_sambadomains"> 41 {sambadomainname_options} 42 </select> 43 </td> 44 </tr> 45 </table> 46 </div> 30 47 Ocultar este grupo no Expresso? <input type="checkbox" {phpgwaccountvisible_checked} name="phpgwaccountvisible"><br> 31 48 -
trunk/instant_messenger/docs/change_log.txt
r32 r33 6 6 27/04/2007 [0.001] 7 7 - Vcard, corrigido para a visualização de caracteres e acentos. 8 9 8 10/05/2007 [0.001] 10 9 - Busca de ids no ldap 11 10 - O envio de autorização, está dentro do menu do botão direito, quando clicado em cima do 12 11 nome do contato. 13 - A montagem da lista de contatos é feit odireto no elemento da página.12 - A montagem da lista de contatos é feita direto no elemento da página. 14 13 - Correção para cadastro dos contatos com acentos. 15 14 23/05/2007 [0.001] 16 15 - Na tela de autorização do contato, é mostrado o nome, email e a foto do contato que estão no LDAP 17 16 - Correção na Hora que aparece ao lado da mensagem. 17 13/06/2007 [0.001] 18 - Criação da opção preferências, onde por padrão ja existem marcadas as opções : Mostrar marcação de tempo e Aviso de 19 Mensagens recebidas => Normal. -
trunk/instant_messenger/inc/class.Socket.inc.php
r32 r33 12 12 private $socket; 13 13 14 protected final function open($pRemoteSocket, $pTimeOut = 1, $pBlockingMode = 1)14 protected final function open($pRemoteSocket, $pTimeOut = 1, $pBlockingMode = 0 ) 15 15 { 16 16 if ( ($this->socket = stream_socket_client($pRemoteSocket, $errno, $errstr)) ) … … 18 18 //$this->socket = stream_socket_client($pRemoteSocket, $errno, $errstr);//, 1, STREAM_CLIENT_CONNECT+STREAM_CLIENT_PERSISTENT); 19 19 //stream_set_write_buffer($this->socket, 0); 20 stream_set_timeout( $this->socket, 1 );//$pTimeOut); 21 stream_set_blocking( $this->socket, true ); 22 20 stream_set_blocking($this->socket, $pBlockingMode); 21 stream_set_timeout($this->socket, 1);//$pTimeOut); 23 22 return true; 24 23 } -
trunk/instant_messenger/inc/class.Ujabber.inc.php
r32 r33 253 253 254 254 $this->sendIq('get',$id,$pJid,NULL,"vcard-temp","<vCard xmlns='vcard-temp'/>"); 255 256 while(($result = $this->readSocketFromServer()) == NULL ){ 257 usleep(40); 258 } 255 usleep(50000); 256 $result = $this->readSocketFromServer(); 259 257 260 258 if( trim($result['iq'][0]['@']['type']) === trim("result") ){ -
trunk/instant_messenger/inc/class.contacts_im.inc.php
r32 r33 6 6 class contacts_im 7 7 { 8 private $ldap _users;8 private $ldap; 9 9 private $db_user; 10 10 11 11 function __construct() 12 12 { 13 $this->ldap _users= new ldap_im();13 $this->ldap = new ldap_im(); 14 14 $this->db_user = new db_im(); 15 15 } 16 17 function set_session_ldap_users() 18 { 19 if(!isset($_SESSION['instant_messenger']['users_ldap'])) 20 $this->users_auth_im(); 21 22 } 23 24 function users_auth_im() 16 17 private function users_auth_im() 25 18 { 26 19 $db_acls = $this->db_user->get_accounts_acl(); 27 20 28 // UidNumbers db;21 $search_uids = "|"; 29 22 foreach($db_acls as $tmp) 30 $uid_users .= "(uidNumber=".$tmp['acl_account'].")"; 23 $search_uids .= "(uidNumber=".$tmp['acl_account'].")"; 24 25 // Busca Usuarios 26 $uids = $this->ldap->list_users_ldap($search_uids); 31 27 28 $search_groups = "|"; 32 29 foreach($db_acls as $tmp) 33 $ uid_groups .= "(gidNumber=".$tmp['acl_account'].")";30 $search_groups .= "(gidNumber=".$tmp['acl_account'].")"; 34 31 35 // usuários;36 $ result_users = $this->ldap_users->list_users_ldap($uid_users);32 // Busca Grupos 33 $groups = $this->ldap->list_groups_ldap($search_groups); 37 34 38 // grupos; 39 $result_groups = $this->ldap_users->list_groups_ldap($uid_groups); 40 41 foreach($result_groups as $group_tmp){ 42 $tmp = $group_tmp['members']; 43 foreach($tmp as $value) 44 $uid_members_group .= "(uid=".$value.")"; 35 $search_uids = "|"; 36 foreach($groups as $tmp){ 37 $members = $tmp['members']; 38 foreach($members as $mb) 39 $search_uids .= "(uid=".$mb.")"; 45 40 } 46 41 47 $uid_members = $this->ldap_users->list_users_ldap($uid_members_group); 48 $count = count($result_users); 49 50 for($i = 0; $i < count($uid_members); $i++){ 51 $result_users[$count] = $uid_members[$i]; 52 $count++; 53 } 54 55 foreach($result_users as $rs){ 56 $uid[] = $rs['cn'].";".$rs['mail'].";".$rs['ou']; 57 } 58 59 natsort($uid); 60 $uid_un = @array_values(@array_unique($uid)); 42 $uids_members = $this->ldap->list_users_ldap($search_uids); 61 43 62 $t = 0; 63 foreach($uid_un as $utmp){ 64 $array = explode(";",$utmp); 65 $list_ldap[$t]['cn'] = $array[0]; 66 $list_ldap[$t]['mail'] = $array[1]; 67 $list_ldap[$t]['ou'] = $array[2]; 68 $t++; 69 } 70 71 $_SESSION['instant_messenger']['users_ldap'] = $list_ldap; 44 foreach($uids_members as $tmp) 45 $uids[] = $tmp; 46 47 return $uids; 72 48 73 49 } … … 75 51 function list_contacts($param) 76 52 { 77 $result_users = array(); 78 $org_ldap = $param['ou']; 53 $users = $this->users_auth_im(); 54 $ordenar = array(); 55 $return = array(); 79 56 $i = 0; 80 $this->set_session_ldap_users();81 57 82 foreach($_SESSION['instant_messenger']['users_ldap'] as $users){ 83 if($users['ou'] == ("OU=".$org_ldap)){ 84 $result_users[$i]['cn'] = $users['cn']; 85 $result_users[$i]['mail'] = $users['mail']; 58 foreach($users as $tmp) 59 $ordenar[] = $tmp['cn'].";".$tmp['mail'].";".$tmp['uid'].";".$tmp['dn']; 60 61 natsort($ordenar); 62 $uid_unique = @array_values(@array_unique($ordenar)); 63 64 foreach($uid_unique as $tmp){ 65 $result = explode(";",$tmp); 66 if($result[3] == $param['ou']){ 67 $return[$i]['cn'] = $result[0]; 68 $return[$i]['mail'] = $result[1]; 69 $return[$i]['uid'] = $result[2]; 86 70 $i++; 87 71 } 88 } 89 90 if(count($result_users) > 0) 91 return $result_users; 72 unset($result); 73 } 74 75 if(count($return) > 0) 76 return $return; 92 77 else 93 78 return 0; -
trunk/instant_messenger/inc/class.db_im.inc.php
r24 r33 83 83 return true; 84 84 } 85 86 function set_preferences($param) 87 { 88 $preferences = $param['preferences']; 89 $user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 90 $app_name = "instant_messenger"; 91 92 $query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')"; 93 94 if($this->query_db($query)){ 95 return 1; 96 }else{ 97 //$query = "insert into phpgw_preferences values('".$user_id."','".$app_name."','".serialize($preferences)."')"; 98 $query = "update phpgw_preferences set preference_value = '".serialize($preferences)."' where preference_app='".$app_name."' and preference_owner='".$user_id."'"; 99 if($this->query_db($query)) 100 return 1; 101 else 102 return 0; 103 } 104 } 105 106 function get_preferences() 107 { 108 $result = array(); 109 $user_id = $_SESSION['phpgw_info']['instant_messenger']['user_id']; 110 $app_name = "instant_messenger"; 111 112 $query = "select * from phpgw_preferences where preference_owner = '".$user_id."' and preference_app = '".$app_name."'"; 113 114 if (!$this->db->query($query)) 115 return NULL; 116 117 while($this->db->next_record()) 118 $result[] = $this->db->row(); 119 120 if(count($result) > 0) 121 return unserialize($result[0]['preference_value']); 122 else 123 return "ch_time:true;ch_offline:true;ch_contacts:true;rd_nm:true;rd_al:false;rd_ch:false"; 124 125 } 85 126 } 86 127 ?> -
trunk/instant_messenger/inc/class.ldap_im.inc.php
r32 r33 14 14 $this->user = $_SESSION['phpgw_info']['instant_messenger']['user_ldap_jabber']; 15 15 $this->password = $_SESSION['phpgw_info']['instant_messenger']['password_ldap_jabber']; 16 $this->connect_ldap( true);16 $this->connect_ldap(false); 17 17 } 18 18 … … 35 35 function get_photo_ldap($user,$getPhoto) 36 36 { 37 $result = "";38 37 if ($this->conn) { 39 $filter=" uid=".$user;38 $filter="(&(uid=".$user.")(phpgwAccountType=u))"; 40 39 $justthese = array("jpegphoto"); 41 40 $search = ldap_search($this->conn,$this->ldap_context, $filter, $justthese); 42 41 $entry = ldap_first_entry($this->conn, $search); 43 if($entry != 'undefined'){ 44 $jpeg_data = @ldap_get_values_len($this->conn, $entry, "jpegphoto"); 42 $jpeg_data = @ldap_get_values_len($this->conn, $entry, "jpegphoto"); 43 44 if( count($jpeg_data) > 1){ 45 45 46 $photo = imagecreatefromstring($jpeg_data[0]); 46 47 if($photo){ … … 72 73 } 73 74 74 function list_users_ldap($ filter)75 function list_users_ldap($search) 75 76 { 76 77 if( $this->conn){78 $filter = "(&( |".$filter.")(phpgwAccountType=u))";79 $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn"); 80 $search = ldap_search($this->conn,$this->ldap_context, $filter,$justthese);77 78 if($this->conn){ 79 $filter = "(&(".$search.")(phpgwAccountType=u))"; 80 $justthese = array("uid","uidNumber","cn","mail","phpgwAccountVisible","dn"); 81 $search = ldap_search($this->conn,$this->ldap_context,$filter,$justthese); 81 82 $entry = ldap_get_entries($this->conn,$search); 82 83 } 83 84 84 85 if( $entry['count'] > 0){ 85 86 $i = 0; 87 $result_user = array(); 86 88 foreach($entry as $tmp) 87 89 { 88 if($tmp['uidnumber'][0] != "" ){90 if($tmp['uidnumber'][0] != "" && $tmp['phpgwaccountvisible'][0] != "-1"){ 89 91 $result_user[$i]['uidnumber'] = $tmp['uidnumber'][0]; 90 92 $result_user[$i]['mail'] = $tmp['mail'][0]; 91 93 $result_user[$i]['uid'] = $tmp['uid'][0]; 92 94 $result_user[$i]['cn'] = $tmp['cn'][0]; 93 $dn = explode(",dc=",$tmp['dn']); 94 $ou = explode(",",$dn[0]); 95 $result_user[$i]['ou'] = strtoupper(array_pop($ou)); 95 $ou = explode("dc=",$tmp['dn']); 96 $ou = explode("ou=",$ou[0]); 97 $ou = array_pop($ou); 98 $result_user[$i]['dn'] = strtoupper(substr($ou,0,strlen($ou)-1)); 96 99 $i++; 97 100 } … … 102 105 } 103 106 104 function list_groups_ldap($ filter)107 function list_groups_ldap($search) 105 108 { 106 109 107 110 if( $this->conn ){ 108 $filter = "(&( |".$filter.")(phpgwAccountType=g))";111 $filter = "(&(".$search.")(phpgwAccountType=g))"; 109 112 $justthese = array("gidnumber","cn","memberuid"); 110 113 $search = ldap_search($this->conn,$this->ldap_context, $filter, $justthese); … … 112 115 } 113 116 114 if( $entry['count'] > 0){117 if($entry['count'] > 0){ 115 118 $i = 0; 116 foreach($entry as $tmp) 117 { 118 if($tmp['gidnumber'][0] != ""){ 119 $result_groups[$i]['gidnumber'] = $tmp['gidnumber'][0]; 120 $org = explode(",",$tmp['dn']); 121 $result_groups[$i]['ou'] = strtoupper($org[1]); 122 array_shift($tmp['memberuid']); 123 foreach($tmp['memberuid'] as $mb) 124 $result_groups[$i]['members'][] = $mb; 119 $result_groups = array(); 120 foreach($entry as $tmpg){ 121 if($tmpg['gidnumber'] != ""){ 122 $result_groups[$i]['gidnumber'] = $tmpg['gidnumber'][0]; 123 array_shift($tmpg['memberuid']); 124 foreach($tmpg['memberuid'] as $tmp) 125 $result_groups[$i]['members'][] = $tmp; 125 126 $i++; 126 127 } 127 } 128 } 128 129 return $result_groups; 129 130 } 130 131 return 0; 131 132 132 } 133 133 … … 149 149 } 150 150 } 151 152 151 sort($result_org); 153 154 152 return $result_org; 155 153 } … … 157 155 function info_user($user) 158 156 { 159 $uid = $user['uid']; 160 $filter = "(uid=".$uid.")"; 157 $uid = "uid=".$user['uid']; 161 158 $i= 0; 162 159 163 $entry = $this->list_users_ldap($ filter);160 $entry = $this->list_users_ldap($uid); 164 161 165 if( count($entry) > 0 ) {162 if( count($entry) > 0 ) 166 163 return $entry; 167 }else{164 else 168 165 return false; 169 }170 166 } 171 167 } -
trunk/instant_messenger/js/im_functions.js
r32 r33 7 7 this.array_users = new Array(); 8 8 this.vcard_user = new Array(); 9 this.array_prefe = new Array(); 10 this.array_prefe['ch_offline'] = true; 9 11 this.load_photo = false; 10 12 } … … 67 69 } 68 70 } 69 /*70 * Monta Lista de Contatos 71 */ 72 73 IM.prototype.mount_list = function(pList) 74 { 75 71 72 /* 73 * Manutenção 74 */ 75 76 IM.prototype.Manutencao = function() 77 { 76 78 // Manutencao 77 79 // … … 81 83 // 82 84 // 83 85 } 86 87 /* 88 * Monta Lista de Contatos 89 */ 90 91 IM.prototype.mount_list = function(pList) 92 { 84 93 var _this = this; 85 94 var group = ""; … … 95 104 96 105 var div_agroups = document.getElementById("all_groups"); 106 var div_group = document.createElement('DIV'); 97 107 group = decodeURI(pList[i].group); 98 108 group = group.rm_space(); … … 103 113 104 114 if(group != 'sem_grupo'){ 105 var div_group = document.createElement('DIV');106 115 div_group.id = group; 107 116 if(pList[i].subscription.rm_space() == "both") … … 111 120 div_agroups.appendChild(div_group); 112 121 }else{ 113 var div_group = document.createElement('DIV');114 122 div_group.id = group; 115 123 div_group.innerHTML += '<div id="'+pList[i].jid+'" onclick=Preferences.updateLoad("'+pList[i].jid+'") style="cursor:pointer;padding-left:32px;">'+ … … 134 142 } 135 143 } 144 145 // Contatos Offline; 146 _this.ContactsOffline(); 147 148 // Usuários Não Autorizados; 136 149 setTimeout("Templates.Users_Not_Auth()",2500); 150 151 } 152 153 /* 154 * Deixar contatos Offline 155 */ 156 157 IM.prototype.ContactsOffline = function() 158 { 159 var _this = this; 160 var display = "block"; 161 162 if(!_this.array_prefe['ch_offline']){ 163 display = "none"; 164 } 165 166 for(var i = 1; i < _this.array_users.length; i++){ 167 var div_child = document.getElementById(_this.array_users[i].jid); 168 var img_src = div_child.firstChild.src 169 if(img_src === img_offline.src){ 170 div_child.style.display = display; 171 } 172 } 137 173 } 138 174 … … 201 237 202 238 im_win.get_photo_ldap(decodeURI(data['VCARD_JID'])); 239 Preferences.GetPreferences(); 203 240 _this.load_photo = true; 204 241 } … … 295 332 jid = data[i].from; 296 333 body_message = data[i].body; 297 TimeStamp = data[i].timestamp;334 TimeStamp = (_this.array_prefe['ch_time']) ? "[" + data[i].timestamp + "] " : " "; 298 335 299 336 jid = jid.substr(0,jid.indexOf('/')); … … 312 349 if ( window_message ) 313 350 { 314 window_message.innerHTML += '<strong>' + '['+ TimeStamp +'] '+ nickname + '</strong> ' + IM.get_lang('speak') + ':<br/> ' + _this.emotions_icons(body_message) + '<br/><br/>';351 window_message.innerHTML += '<strong>' + TimeStamp + nickname + '</strong> ' + IM.get_lang('speak') + ':<br/> ' + _this.emotions_icons(body_message) + '<br/><br/>'; 315 352 if ( windowItems[jid].state != WINDOW_STATE_REGULAR && windowItems[jid].state != WINDOW_STATE_MAXIMIZED ) 316 353 im_win.showWindowItem(jid); … … 320 357 im_win.open_chat(jid); 321 358 window_message = document.getElementById(jid + '_chatMessages'); 322 window_message.innerHTML += '<strong>' + '['+ TimeStamp +'] '+ nickname + '</strong> ' + IM.get_lang('speak') + ':<br/> ' + _this.emotions_icons(body_message) + '<br/><br/>';359 window_message.innerHTML += '<strong>' + TimeStamp + nickname + '</strong> ' + IM.get_lang('speak') + ':<br/> ' + _this.emotions_icons(body_message) + '<br/><br/>'; 323 360 } 324 361 } -
trunk/instant_messenger/js/im_preferences.js
r32 r33 39 39 Preferences.prototype.SearchContacts = function() 40 40 { 41 42 41 var select_org = document.getElementById('ImSelOrg'); 43 42 var select_contact = document.getElementById('ImSelAddContact'); … … 63 62 for(var i in data){ 64 63 if(data[i].cn != ""){ 65 var options = new Option(data[i].cn + " ( "+ data[i].mail + " )", data[i].mail , false, false);64 var options = new Option(data[i].cn + " ( "+ data[i].mail + " )", data[i].mail + ";" + data[i].uid, false, false); 66 65 select_contact[select_contact.length] = options; 67 66 } … … 81 80 for(var i=0; i < select.options.length; i++){ 82 81 if(select.options[i].selected == true){ 83 document.getElementById('text0').value = select.options[i].value; 84 document.getElementById('text1').value = select.options[i].value.substr(0,select.options[i].value.indexOf('@')); 82 var email = select.options[i].value.substr(0,select.options[i].value.indexOf(';')); 83 var uid = select.options[i].value.substr((select.options[i].value.indexOf(';')+1),select.options[i].value.length); 84 document.getElementById('text0').value = email; 85 document.getElementById('text1').value = email.substr(0,email.indexOf('@')); 85 86 document.getElementById('text2').focus(); 87 document.getElementById('text3').value = uid; 86 88 } 87 89 } … … 94 96 var text1 = document.getElementById('text1'); 95 97 var text2 = document.getElementById('text2'); 98 var text3 = (document.getElementById('text3') != null) ? document.getElementById('text3') : false ; 99 96 100 var _this = this; 97 101 var jid = text0.value; … … 116 120 else 117 121 subscription = "to"; 118 cIM.cExecute("$this.Ujabber.AddNewContacts",handler_add_contact,"email="+text0.value+"&name="+name+"&group="+group+"&subscription="+subscription); 122 if(text3) 123 var email = text3.value + "@" + text0.value.substr((text0.value.indexOf('@')+1),text0.value.length); 124 else 125 var email = text0.value; 126 cIM.cExecute("$this.Ujabber.AddNewContacts",handler_add_contact,"email="+email+"&name="+name+"&group="+group+"&subscription="+subscription); 119 127 }else{ 120 128 alert("Informe todos os campos!"); … … 344 352 var pElement = "teste"; 345 353 var uid = pJid.substr(0,pJid.indexOf('@')); 346 347 354 348 355 var handler_ldap = function(data){ 349 350 var form_details = '<table cellpadding="0" cellspacing="0" style="background-color:#cbdae4;width:80%;border:1px solid #809aa9">' + 351 '<tr><td style="vertical-align:top;width:80%">' + 352 '<div style="padding-bottom">' + 353 '<span><label>'+IM.get_lang('Name')+'</label></br>'+ data[0].cn + '</span></br></br>' + 354 '<span><label>'+IM.get_lang('E-mail')+'</label></br>'+ data[0].mail + '</span></br>' + 355 '</div></td>' + 356 '<td style="vertical-align:top"><img id="' + pJid + '_avatar" src="' + img_photo.src + '" style="height:65px;width:60px;align:right">' + 357 '</td></tr>'+ 358 '</table>'; 359 360 im_menu_action.menu(element, form_details); 361 362 // Foto Ldap; 363 im_win.get_photo_ldap(pJid); 356 357 if(data){ 358 var form_details = '<table cellpadding="0" cellspacing="0" style="background-color:#cbdae4;width:80%;border:1px solid #809aa9">' + 359 '<tr><td style="vertical-align:top;width:80%">' + 360 '<div style="padding-bottom">' + 361 '<span><label>'+IM.get_lang('Name')+'</label></br>'+ data[0].cn + '</span></br></br>' + 362 '<span><label>'+IM.get_lang('E-mail')+'</label></br>'+ data[0].mail + '</span></br>' + 363 '</div></td>' + 364 '<td style="vertical-align:top"><img id="' + pJid + '_avatar" src="' + img_photo.src + '" style="height:65px;width:60px;align:right">' + 365 '</td></tr>'+ 366 '</table>'; 367 368 im_menu_action.menu(element, form_details); 369 370 // Foto Ldap; 371 im_win.get_photo_ldap(pJid); 372 } 364 373 } 365 374 cIM.cExecute("$this.ldap_im.info_user",handler_ldap,"uid="+uid); … … 395 404 Preferences.prototype.yourPreferences = function() 396 405 { 397 398 //Templates.yourPreferences(); 399 406 Templates.yourPreferences(); 407 if( IM.array_prefe['sizeof'] > 0 ){ 408 document.getElementById('ch_time').checked = eval(IM.array_prefe['ch_time']); 409 document.getElementById('ch_offline').checked = eval(IM.array_prefe['ch_offline']); 410 document.getElementById('ch_contacts').checked = eval(IM.array_prefe['ch_contacts']); 411 document.getElementById('rd_nm').checked = eval(IM.array_prefe['rd_nm']); 412 document.getElementById('rd_al').checked = eval(IM.array_prefe['rd_al']); 413 document.getElementById('rd_ch').checked = eval(IM.array_prefe['rd_ch']); 414 }else{ 415 this.GetPreferences(); 416 } 417 418 } 419 420 Preferences.prototype.SetPreferences = function() 421 { 422 var EcheckBox = new Array(); 423 EcheckBox[0] = 'ch_time'; 424 EcheckBox[1] = 'ch_offline'; 425 EcheckBox[2] = 'ch_contacts'; 426 var Eradio = new Array() 427 Eradio[0] = 'rd_nm'; 428 Eradio[1] = 'rd_al'; 429 Eradio[2] = 'rd_ch'; 430 var preferences = ''; 431 var _this = this; 432 433 for(var i in EcheckBox){ 434 if(document.getElementById(EcheckBox[i]).checked){ 435 preferences += EcheckBox[i] + ':' + true + ';'; 436 IM.array_prefe[EcheckBox[i]] = true; 437 }else{ 438 preferences += EcheckBox[i] + ':' + false + ';'; 439 IM.array_prefe[EcheckBox[i]] = false; 440 } 441 IM.array_prefe['sizeof'] = i; 442 } 443 444 for(var i in Eradio){ 445 if(document.getElementById(Eradio[i]).checked){ 446 preferences += Eradio[i] + ':' + true + ';'; 447 IM.array_prefe[Eradio[i]] = true; 448 }else{ 449 preferences += Eradio[i] + ':' + false + ';'; 450 IM.array_prefe[Eradio[i]] = false; 451 } 452 IM.array_prefe['sizeof'] = IM.array_prefe['sizeof'] = i + 1; 453 } 454 455 var handler_set_preferences = function(data) 456 { 457 if(data) 458 alert('Preferências cadastradas com sucesso!'); 459 IM.ContactsOffline(); 460 } 461 cIM.cExecute("$this.db_im.set_preferences",handler_set_preferences,"preferences="+preferences); 462 463 } 464 465 Preferences.prototype.GetPreferences = function() 466 { 467 var handler_get_preferences = function(data){ 468 var opt = data.split(";"); 469 for(var i in opt){ 470 if(opt[i] != ""){ 471 var el = opt[i].split(":"); 472 if(document.getElementById(el[0]) != null){ 473 var id_el = document.getElementById(el[0]); 474 id_el.checked = eval(el[1]); 475 } 476 IM.array_prefe[el[0]] = eval(el[1]); 477 IM.array_prefe['sizeof'] = i; 478 } 479 } 480 } 481 cIM.cExecute("$this.db_im.get_preferences",handler_get_preferences); 482 400 483 } 401 484 -
trunk/instant_messenger/js/im_templates.js
r32 r33 50 50 "<tr><td><b>"+IM.get_lang('Nickname')+".:</b></td><td><input id='text1' type='text' size='20' maxlength='20'></td></tr>"+ 51 51 "<tr><td><b>"+IM.get_lang('Group')+".:</b></td><td><input id='text2' type='text' size='20' maxlength='20'></td></tr>"+ 52 "<tr><td><input id='text3' type='hidden' size='30' maxlength='30'></td></tr>"+ 52 53 "<tr><td colspan='2'><input type='button' value='"+IM.get_lang('Add')+"' onclick='Preferences.Add_user(\"divAddUser_im\")'></td></tr>"+ 53 54 "</table>" 54 _this.conf_form("divAddUser",500,2 85,form_add_user,":: " + IM.get_lang('Add New Contact') + " - Expresso ::");55 _this.conf_form("divAddUser",500,250,form_add_user,":: " + IM.get_lang('Add New Contact') + " - Expresso ::"); 55 56 } 56 57 … … 94 95 var auth_user = ""; 95 96 96 auth_user = '<table border="0" cellpadding="0" cellspacing="0" width="99%">' + 97 '<tr style="background-color:#cccccc;font-weight:bold;height:20px"><td> Contato</td><td align="center">Detalhes</td><td align="center">Aceitar S/N</td></tr>'; 98 99 for(var i=0 ; i < IM.array_users.length; i++){ 100 if(IM.array_users[i].group == 'sem_grupo'){ 101 auth_user += '<tr id="_cell_'+IM.array_users[i].jid+'">'+ 102 '<td><img src="' + img_not_authorized.src + '">' + decodeURI(IM.array_users[i].name).substr(0,decodeURI(IM.array_users[i].name).indexOf('@')) + '<span id="_span_not_' + IM.array_users[i].jid + '"></span></td>'+ 103 '<td align="center"><a href="javascript:void(0);" onclick=Preferences.Info_Contact("'+IM.array_users[i].jid+'")> ? </a></td>'+ 104 '<td align="center"><a href="javascript:void(0);" onclick=Preferences.updateLoad("'+IM.array_users[i].jid+'")> Sim </a>/<a href="javascript:void(0);" onclick=Preferences.Remove_Contact("'+IM.array_users[i].jid+'")> Não </a></td>'+ 105 '</tr>'; 106 count++; 97 if(!IM.array_prefe['ch_contacts']) 98 { 99 auth_user = '<table border="0" cellpadding="0" cellspacing="0" width="99%">' + 100 '<tr style="background-color:#cccccc;font-weight:bold;height:20px"><td> Contato</td><td align="center">Detalhes</td><td align="center">Aceitar S/N</td></tr>'; 101 102 for(var i=0 ; i < IM.array_users.length; i++){ 103 if(IM.array_users[i].group == 'sem_grupo'){ 104 auth_user += '<tr id="_cell_'+IM.array_users[i].jid+'">'+ 105 '<td><img src="' + img_not_authorized.src + '">' + decodeURI(IM.array_users[i].name).substr(0,decodeURI(IM.array_users[i].name).indexOf('@')) + '<span id="_span_not_' + IM.array_users[i].jid + '"></span></td>'+ 106 '<td align="center"><a href="javascript:void(0);" onclick=Preferences.Info_Contact("'+IM.array_users[i].jid+'")> ? </a></td>'+ 107 '<td align="center"><a href="javascript:void(0);" onclick=Preferences.updateLoad("'+IM.array_users[i].jid+'")> Sim </a>/<a href="javascript:void(0);" onclick=Preferences.Remove_Contact("'+IM.array_users[i].jid+'")> Não </a></td>'+ 108 '</tr>'; 109 count++; 110 } 107 111 } 108 }109 110 auth_user += '</table>';111 112 if( count > 0 ){113 var form_auth_user = '<div style="margin-left:5px;margin-top:2px">'+114 '</br>'+115 '<b>O(s) contato(s) abaixo aguarda(m) sua autorização.' +116 '</br>Para adicionar este(s) novo(s) contato(s), basta dar um' +117 'clique em cima do contato.' +118 '<p>Contato(s) :' +119 '</b></br>' +120 '<div id="divChildrenFormAuthUser">';121 form_auth_user += auth_user + '</div></div>';122 _this.conf_form("divFormAuthUser",360,250,form_auth_user, ":: Contatos sem Cadastro - Expresso ::");123 112 113 auth_user += '</table>'; 114 115 if( count > 0 ){ 116 var form_auth_user = '<div style="margin-left:5px;margin-top:2px">' + 117 '</br>'+ 118 '<b>O(s) contato(s) abaixo aguarda(m) sua autorização.' + 119 '</br>Para adicionar este(s) novo(s) contato(s), basta dar um ' + 120 'clique em cima do contato.' + 121 '<p>Contato(s) :' + 122 '</b></br>' + 123 '<div id="divChildrenFormAuthUser">'; 124 form_auth_user += auth_user + '</div></div>'; 125 _this.conf_form("divFormAuthUser",360,250,form_auth_user, ":: Contatos sem Cadastro - Expresso ::"); 126 127 } 124 128 } 125 129 } … … 370 374 Templates.prototype.yourPreferences = function() 371 375 { 372 /*************373 Preferências374 Marcação de tempo375 Exibir amigos desconectados376 Desativar aviso de novos contatos377 Ativar aviso de mensagens recebidas378 - Aviso Normal379 - Aviso Médio380 - Aviso Chato381 Bloquear recebimento de mensagens382 Cadastro de novos grupos;383 /*************/384 385 376 var form_your_prefe = '<div style="margin-left:10px;margin-top:5px"><dl>' + 386 '<dt><input type="checkbox"> Mostar marcação de tempo </dt> ' + 387 '<dt><input type="checkbox"> Exibir amigos desconectados </dt> ' + 388 '<dt><input type="checkbox"> Desativar aviso de novos contatos </dt> ' + 389 '<dt><input type="checkbox"> Cadastro de novos grupos </dt> ' + 390 '<dl></div>' + 391 '<div style="margin-top:10px;margin-left:15px"> Ativar aviso de mensagens recebidas </div>' + 392 '<div style="margin-left:20px;margin-top:5px">' + 393 '<input type="radio" id="rd_normal" value="normal"> Modo Normal</br>' + 394 '<input type="radio" id="rd_medio" value="alerta"> Modo com Alertas</br>' + 395 '<input type="radio" id="rd_chato" value="chato"> Modo Chato' + 396 '</div>' ; 397 398 this.conf_form("divYourPrefe",340,200,form_your_prefe,":: " + IM.get_lang('Preferences') + " - Expresso ::"); 377 '<fieldset><legend> Opções :</legend>'+ 378 '<dt><input id="ch_time" type="checkbox"> Mostar marcação de tempo </dt> ' + 379 '<dt><input id="ch_offline" type="checkbox"> Exibir amigos desconectados </dt> ' + 380 '<dt><input id="ch_contacts" type="checkbox"> Desativar aviso de novos contatos </dt> ' + 381 '<dl></fieldset></div>' + 382 '<div style="margin-left:10px;margin-top:5px">' + 383 '<fieldset><legend> Ativar aviso de mensagens recebidas :</legend>'+ 384 '<input id="rd_nm" type="radio" name="rd_aviso"> Normal <i>(Função Indisponível)</i></br>' + 385 '<input id="rd_al" type="radio" name="rd_aviso"> Com Alertas <i>(Função Indisponível)</i></br>' + 386 '<input id="rd_ch" type="radio" name="rd_aviso"> Treme Tela <i>(Função Indisponível)</i>' + 387 '</fieldset>'+ 388 '</div>'+ 389 '<div style="margin-left:10px;margin-top:5px">'+ 390 '<font style="size:8pt;color:red">* É necessário salvar as opções *</p>'+ 391 '<input type="button" value="Salvar" onclick="javascript:Preferences.SetPreferences()">'+ 392 '<input type="button" value="Cancelar" onclick="javascript:im_win.windowClose(\'divYourPrefe_im_window\')">'+ 393 '</div>'; 394 395 this.conf_form("divYourPrefe",345,230,form_your_prefe,":: " + IM.get_lang('Preferences') + " - Expresso ::"); 399 396 } 400 397
Note: See TracChangeset
for help on using the changeset viewer.