Changeset 180 for trunk/expressoAdmin1_2/inc
- Timestamp:
- 02/26/08 17:04:07 (16 years ago)
- Location:
- trunk/expressoAdmin1_2/inc
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoAdmin1_2/inc/class.db_functions.inc.php
r64 r180 672 672 return $result; 673 673 } 674 675 function manager_lid_exist($manager_lid) 676 { 677 $query = "SELECT manager_lid FROM phpgw_expressoadmin WHERE manager_lid = '" . $manager_lid . "'"; 678 $this->db->query($query); 679 while($this->db->next_record()) 680 $result[] = $this->db->row(); 681 if (count($result) > 0) 682 return true; 683 else 684 return false; 685 } 686 687 function create_manager($params, $manager_acl) 688 { 689 //Escrevre no Banco a ACL do gerente 690 $sql = "INSERT INTO phpgw_expressoadmin (manager_lid, context, acl) " 691 . "VALUES('" . $params['ea_select_manager'] . "','" . $params['context'] . "','" . $manager_acl . "')"; 692 $this->db->query($sql); 693 694 //Escrevre no Banco as aplicações que o gerente tem direito de disponibilizar aos seus usuarios. 695 if (count($_POST['applications_list'])) 696 { 697 foreach($_POST['applications_list'] as $app=>$value) 698 { 699 $sql = "INSERT INTO phpgw_expressoadmin_apps (manager_lid, context, app) " 700 . "VALUES('" . $_POST['manager_lid'] . "','" . $_POST['context'] . "','" . $app . "')"; 701 $this->db->query($sql); 702 } 703 } 704 705 return; 706 } 707 708 function save_manager($params, $manager_acl) 709 { 710 $params['manager_lid'] = $params['hidden_manager_lid']; 711 712 //Executa update na tabela para atualizar ACL 713 $sql = "UPDATE phpgw_expressoadmin SET context = '" . $params['context'] . "',acl = '" . $manager_acl 714 . "' WHERE manager_lid = '" . $params['manager_lid'] ."'"; 715 $this->db->query($sql); 716 717 //Deleta as aplicações e adiciona as novas. 718 //Deleta 719 $sql = "DELETE FROM phpgw_expressoadmin_apps WHERE manager_lid = '" . $params['manager_lid'] . "'"; 720 $this->db->query($sql); 721 722 // Adiciona 723 if (count($params['applications_list'])) 724 { 725 foreach($params['applications_list'] as $app=>$value) 726 { 727 $sql = "INSERT INTO phpgw_expressoadmin_apps (manager_lid, context, app) " 728 . "VALUES('" . $params['manager_lid'] . "','" . $params['context'] . "','" . $app . "')"; 729 $this->db->query($sql); 730 } 731 } 732 733 return; 734 } 735 674 736 } 675 737 ?> -
trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r81 r180 433 433 $denied_uidnumber = $params['denied_uidnumber']; 434 434 435 $justthese = array("cn", "uidNumber"); 435 $justthese = array("cn", "uidNumber", "mail"); 436 436 437 $users_filter="(phpgwAccountType=u)"; 437 438 $lists_filter = $denied_uidnumber == '' ? "(phpgwAccountType=l)" : "(&(phpgwAccountType=l)(!(uidnumber=$denied_uidnumber)))"; … … 440 441 $lists = Array(); 441 442 443 /* folling referral connection */ 444 $ldap_conn_following_ref = ldap_connect($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['host']); 445 if ($ldap_conn_following_ref) 446 { 447 ldap_set_option($ldap_conn_following_ref, LDAP_OPT_PROTOCOL_VERSION, 3); 448 ldap_set_option($ldap_conn_following_ref, LDAP_OPT_REFERRALS, 1); 449 450 if ( ($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] != '') && ($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['pw'] != '') ) 451 ldap_bind($ldap_conn_following_ref, $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'], $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['pw']); 452 } 453 else 454 return false; 455 442 456 if ($recursive == 'true') 443 457 { 444 $lists_search = ldap_search($this->ldap, $context, $lists_filter, $justthese); 445 $users_search = ldap_search($this->ldap, $context, $users_filter, $justthese); 446 } 447 else 448 { 449 $lists_search = ldap_list($this->ldap, $context, $lists_filter, $justthese); 450 $users_search = ldap_list($this->ldap, $context, $users_filter, $justthese); 451 } 452 453 $lists_entries = ldap_get_entries($this->ldap, $lists_search); 458 $lists_search = ldap_search($ldap_conn_following_ref, $context, $lists_filter, $justthese); 459 $users_search = ldap_search($ldap_conn_following_ref, $context, $users_filter, $justthese); 460 } 461 else 462 { 463 $lists_search = ldap_list($ldap_conn_following_ref, $context, $lists_filter, $justthese); 464 $users_search = ldap_list($ldap_conn_following_ref, $context, $users_filter, $justthese); 465 } 466 467 /* email lists */ 468 $lists_entries = ldap_get_entries($ldap_conn_following_ref, $lists_search); 469 454 470 for ($i=0; $i<$lists_entries["count"]; $i++) 455 471 { 456 $l_tmp[$lists_entries[$i][" uidnumber"][0]] = $lists_entries[$i]["cn"][0];472 $l_tmp[$lists_entries[$i]["mail"][0]] = $lists_entries[$i]["cn"][0]; 457 473 } 458 474 … … 466 482 if (count($l_tmp)) 467 483 { 468 foreach ($l_tmp as $ uidnumber=> $cn)469 { 470 $options .= "<option value=$ uidnumber>$cn</option>";484 foreach ($l_tmp as $mail => $cn) 485 { 486 $options .= "<option value=$mail>$cn</option>"; 471 487 } 472 488 unset($l_tmp); 473 489 } 474 490 475 $users_entries = ldap_get_entries($this->ldap, $users_search); 491 /* users */ 492 $users_entries = ldap_get_entries($ldap_conn_following_ref, $users_search); 476 493 for ($i=0; $i<$users_entries["count"]; $i++) 477 494 { 478 $u_tmp[$users_entries[$i][" uidnumber"][0]] = $users_entries[$i]["cn"][0];495 $u_tmp[$users_entries[$i]["mail"][0]] = $users_entries[$i]["cn"][0]; 479 496 } 480 497 … … 488 505 if (count($u_tmp)) 489 506 { 490 foreach ($u_tmp as $ uidnumber=> $cn)491 { 492 $options .= "<option value=$ uidnumberclass='line-above'>$cn</option>";507 foreach ($u_tmp as $mail => $cn) 508 { 509 $options .= "<option value=$mail class='line-above'>$cn</option>"; 493 510 } 494 511 unset($u_tmp); 495 512 } 496 513 514 ldap_close($ldap_conn_following_ref); 497 515 return $options; 498 516 } … … 957 975 function get_maillist_info($uidnumber) 958 976 { 977 978 /* folling referral connection */ 979 $ldap_conn_following_ref = ldap_connect($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['host']); 980 if ($ldap_conn_following_ref) 981 { 982 ldap_set_option($ldap_conn_following_ref, LDAP_OPT_PROTOCOL_VERSION, 3); 983 ldap_set_option($ldap_conn_following_ref, LDAP_OPT_REFERRALS, 1); 984 985 if ( ($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] != '') && ($_SESSION['phpgw_info']['expresso']['cc_ldap_server']['pw'] != '') ) 986 ldap_bind($ldap_conn_following_ref, $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'], $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['pw']); 987 } 988 959 989 foreach ($this->manager_contexts as $index=>$context) 960 990 { … … 975 1005 $result['context'] = $sector_dn; 976 1006 $result['uidnumber'] = $entry[0]['uidnumber'][0]; 977 $result['uid'] = $entry[0]['uid'][0];1007 $result['uid'] = strtolower($entry[0]['uid'][0]); 978 1008 $result['cn'] = $entry[0]['cn'][0]; 979 1009 $result['mail'] = $entry[0]['mail'][0]; … … 986 1016 $justthese = array("cn", "uidnumber", "uid", "phpgwaccounttype", "mail"); 987 1017 988 // Montagem dinamica do filtro 1018 // Montagem dinamica do filtro, para nao ter muitas conexoes com o ldap 989 1019 $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(|"; 990 1020 for ($k=0; (($k<10) && ($i<$entry[0]['mailforwardingaddress']['count'])); $k++) … … 996 1026 $filter .= "))"; 997 1027 998 $search = ldap_search($ this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);999 $user_entry = ldap_get_entries($ this->ldap, $search);1000 1028 $search = ldap_search($ldap_conn_following_ref, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 1029 $user_entry = ldap_get_entries($ldap_conn_following_ref, $search); 1030 1001 1031 for ($j=0; $j<$user_entry['count']; $j++) 1002 1032 { 1003 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['uid'] = $user_entry[$j]['uid'][0]; 1004 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['cn'] = $user_entry[$j]['cn'][0]; 1005 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['type'] = $user_entry[$j]['phpgwaccounttype'][0]; 1006 $result['members_info'][$user_entry[$j]['uidnumber'][0]]['mail'] = $user_entry[$j]['mail'][0]; 1007 $result['members'][] = $user_entry[$j]['uidnumber'][0]; 1033 $result['mailForwardingAddress_info'][$user_entry[$j]['mail'][0]]['uid'] = $user_entry[$j]['uid'][0]; 1034 $result['mailForwardingAddress_info'][$user_entry[$j]['mail'][0]]['cn'] = $user_entry[$j]['cn'][0]; 1035 $result['mailForwardingAddress_info'][$user_entry[$j]['mail'][0]]['type'] = $user_entry[$j]['phpgwaccounttype'][0]; 1036 $result['mailForwardingAddress'][] = $user_entry[$j]['mail'][0]; 1008 1037 } 1009 1038 } 1010 1039 1011 // Retira o count do array 1012 array_shift($entry[0]['mailforwardingaddress']); 1013 1014 // Checamos e-mails que não fazem parte do expresso. 1015 // Criamos um array temporario 1016 $tmp_array = array(); 1017 foreach ($result['members_info'] as $uid => $user_data) 1040 // Emails não encontrados no ldap 1041 array_shift($entry[0]['mailforwardingaddress']); //Retira o count do array 1042 $missing_emails = array_diff($entry[0]['mailforwardingaddress'], $result['mailForwardingAddress']); 1043 1044 // Incluimos estes no resultado 1045 foreach ($missing_emails as $index=>$mailforwardingaddress) 1018 1046 { 1019 $tmp_array[] = $user_data['mail']; 1047 $result['mailForwardingAddress_info'][$mailforwardingaddress]['uid'] = $mailforwardingaddress; 1048 $result['mailForwardingAddress_info'][$mailforwardingaddress]['cn'] = 'E-Mail nao encontrado'; 1049 $result['mailForwardingAddress'][] = $mailforwardingaddress; 1020 1050 } 1021 1022 // Vemos a diferença 1023 $array_diff = array_diff($entry[0]['mailforwardingaddress'], $tmp_array); 1024 1025 // Incluimos no resultado 1026 foreach ($array_diff as $index=>$mailforwardingaddress) 1027 { 1028 $result['members_info'][$mailforwardingaddress]['uid'] = $mailforwardingaddress; 1029 $result['members_info'][$mailforwardingaddress]['cn'] = 'E-Mail nao encontrado'; 1030 $result['members_info'][$mailforwardingaddress]['mailforwardingaddress'] = $mailforwardingaddress; 1031 $result['members'][] = $mailforwardingaddress; 1032 } 1051 1052 ldap_close($ldap_conn_following_ref); 1033 1053 return $result; 1034 1054 } … … 1292 1312 } 1293 1313 1294 function delete_maillist($uidnumber )1314 function delete_maillist($uidnumber, $mail) 1295 1315 { 1296 1316 $return['status'] = true; 1297 1317 1298 1318 $justthese = array("dn"); 1319 1320 // remove listas dentro de listas 1321 $filter="(&(phpgwAccountType=l)(mailForwardingAddress=".$mail."))"; 1322 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 1323 $entry = ldap_get_entries($this->ldap, $search); 1324 $attrs['mailForwardingAddress'] = $mail; 1325 for ($i=0; $i<=$entry['count']; $i++) 1326 { 1327 $dn = $entry[$i]['dn']; 1328 @ldap_mod_del ( $this->ldap, $dn, $attrs); 1329 } 1330 1299 1331 $filter="(&(phpgwAccountType=l)(uidnumber=".$uidnumber."))"; 1300 1332 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); … … 1519 1551 return $return; 1520 1552 } 1553 1554 function search_user($params) 1555 { 1556 $search = $params['search']; 1557 $justthese = array("cn","uid", "mail"); 1558 $users_list=ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], "(&(phpgwAccountType=u) (|(cn=*$search*)(mail=$search*)) )", $justthese); 1559 1560 if (ldap_count_entries($this->ldap, $users_list) == 0) 1561 { 1562 $return['status'] = 'false'; 1563 $return['msg'] = 'Nenhum resultado encontrado.'; 1564 return $return; 1565 } 1566 1567 ldap_sort($this->ldap, $users_list, "cn"); 1568 1569 $entries = ldap_get_entries($this->ldap, $users_list); 1570 1571 $options = ''; 1572 for ($i=0; $i<$entries['count']; $i++) 1573 { 1574 $options .= "<option value=" . $entries[$i]['uid'][0] . ">" . $entries[$i]['cn'][0] . " (".$entries[$i]['mail'][0].")" . "</option>"; 1575 } 1576 1577 return $options; 1578 } 1579 1580 1521 1581 } 1522 1582 ?> -
trunk/expressoAdmin1_2/inc/class.maillist.inc.php
r86 r180 50 50 $return['status'] = true; 51 51 52 //Retira os uids duplicados se existir52 //Retira os mailForwardingAddress duplicados, se existir algum. 53 53 $array_tmp = array(); 54 $array_tmp = array_unique($params['m embers']);55 $params['m embers'] = $array_tmp;54 $array_tmp = array_unique($params['mailForwardingAddress']); 55 $params['mailForwardingAddress'] = $array_tmp; 56 56 57 57 // Leio o ID a ser usado na criação do objecto. … … 67 67 $id = $next_id['id']; 68 68 } 69 // Pega ID do BD e incrementa de 1.70 //$id = (($this->db_functions->get_next_id()) + 1);71 // Incrementa o id no BD.72 //$this->db_functions->increment_id($id,'accounts');73 69 74 70 // Cria array para incluir no LDAP … … 105 101 $maillist_info['phpgwAccountVisible'] = '-1'; 106 102 103 /* 107 104 foreach($params['members'] as $index=>$uidnumber) 108 105 { … … 111 108 $this->db_functions->write_log("Adicionado usuario $mail a lista ".$params['cn']." no momento da criação",$dn,$uidnumber,'',''); 112 109 } 110 */ 111 112 $maillist_info['mailForwardingAddress'] = $params['mailForwardingAddress']; 113 113 114 114 $result = $this->ldap_functions->ldap_add_entry($dn, $maillist_info); … … 119 119 } 120 120 121 /* log */ 121 122 if ($return['status'] == true) 122 123 { 123 124 $this->db_functions->write_log('Criado lista de email','',$dn,'',''); 125 126 foreach($params['mailForwardingAddress'] as $index=>$mail) 127 { 128 $this->db_functions->write_log("Adicionado email $mail a lista ".$params['cn']." no momento da criação",$dn,'','',''); 129 } 124 130 } 125 131 … … 138 144 139 145 $return['status'] = true; 140 141 //Retira os uids duplicados se existir 142 $array_tmp = array(); 143 $array_tmp = array_unique($new_values['members']); 144 $new_values['members'] = $array_tmp; 145 146 146 147 $old_values = $this->get_info($new_values['uidnumber'], $new_values['manager_context']); 147 148 $diff = array_diff($new_values, $old_values); … … 233 234 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 234 235 // USERS 235 236 if (!$new_values['members']) 237 $new_values['members'] = array(); 238 if (!$old_values['members']) 239 $old_values['members'] = array(); 240 241 $add_users = array_diff($new_values['members'], $old_values['members']); 242 $remove_users = array_diff($old_values['members'], $new_values['members']); 236 if (!$new_values['mailForwardingAddress']) 237 $new_values['mailForwardingAddress'] = array(); 238 if (!$old_values['mailForwardingAddress']) 239 $old_values['mailForwardingAddress'] = array(); 240 241 $add_users = array_diff($new_values['mailForwardingAddress'], $old_values['mailForwardingAddress']); 242 $remove_users = array_diff($old_values['mailForwardingAddress'], $new_values['mailForwardingAddress']); 243 244 /* echo '<pre>'; 245 print_r($new_values);*/ 243 246 244 247 if (count($add_users)>0) 245 248 { 246 $array_emails_add = array(); 247 foreach($add_users as $uidnumber) 248 { 249 if ($uidnumber != -1) 249 sort($add_users); 250 $result = $this->ldap_functions->add_user2maillist($new_values['uidnumber'], $add_users); 251 252 /* log */ 253 if (!$result['status']) 254 { 255 $return['status'] = false; 256 $return['msg'] .= $result['msg']; 257 } 258 else 259 { 260 foreach($add_users['mailForwardingAddress'] as $index=>$mail) 250 261 { 251 $mail = $this->ldap_functions->uidnumber2mail($uidnumber); 252 $array_emails_add[] = $mail; 253 $this->db_functions->write_log("Adicionado usuario $mail a lista",$dn,$uidnumber,'',''); 262 $this->db_functions->write_log("Adicionado usuario $mail a lista de email $dn",$dn,'','',''); 254 263 } 255 264 } 256 $this->ldap_functions->add_user2maillist($new_values['uidnumber'], $array_emails_add);257 }265 } 266 258 267 if (count($remove_users)>0) 259 268 { 260 $array_emails_remove = array(); 261 foreach($remove_users as $uidnumber) 262 { 263 if ($uidnumber != -1) 269 sort($remove_users); 270 $result = $this->ldap_functions->remove_user2maillist($new_values['uidnumber'], $remove_users); 271 272 /* log */ 273 if (!$result['status']) 274 { 275 $return['status'] = false; 276 $return['msg'] .= $result['msg']; 277 } 278 else 279 { 280 foreach($remove_users as $index=>$mail) 264 281 { 265 $mail = $this->ldap_functions->uidnumber2mail($uidnumber); 266 267 // Não achei o email do usuário no ldap. 268 if (empty($mail)) 269 $mail = $uidnumber; 270 271 $array_emails_remove[] = $mail; 272 $this->db_functions->write_log("Removido usuario $mail da lista",$dn,$uidnumber,'',''); 282 $this->db_functions->write_log("Removido usuario $mail da lista de email $dn",$dn,'','',''); 273 283 } 274 284 } 275 $this->ldap_functions->remove_user2maillist($new_values['uidnumber'], $array_emails_remove);276 285 } 277 286 … … 431 440 $uidnumber = $params['uidnumber']; 432 441 $uid = $this->ldap_functions->uidnumber2uid($uidnumber); 442 $mail = $this->ldap_functions->uidnumber2mail($uidnumber); 433 443 434 444 //LDAP 435 $result_ldap = $this->ldap_functions->delete_maillist($uidnumber );445 $result_ldap = $this->ldap_functions->delete_maillist($uidnumber, $mail); 436 446 if (!$result_ldap['status']) 437 447 { -
trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
r107 r180 281 281 'photo_bin' => $GLOBALS['phpgw_info']['server']['webserver_url'].'/expressoAdmin1_2/templates/default/images/photo_celepar.png', 282 282 'display_picture' => $this->functions->check_acl($manager_lid,'edit_users_picture') ? '' : 'none', 283 'disabled_delete_photo' => 'disabled',284 283 'display_tr_default_password' => 'none', 285 284 'minimumSizeLogin' => $this->current_config['expressoAdmin_minimumSizeLogin'], … … 363 362 $disabled_password = 'disabled'; 364 363 $disabled_samba = 'disabled'; 364 $disabled_edit_photo = 'disabled'; 365 $display_picture = 'none'; 365 366 if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && 366 367 (!$this->functions->check_acl($manager_account_lid,'change_users_password')) && … … 402 403 $disabled_quote = 'readonly'; 403 404 405 if ($this->functions->check_acl($manager_account_lid,'edit_users_picture')) 406 { 407 $disabled_edit_photo = ''; 408 $display_picture = ''; 409 } 404 410 // GET all infomations about the user. 405 411 $user_info = $this->user->get_user_info($_GET['account_id']); … … 625 631 'telephonenumber' => $user_info['telephonenumber'], 626 632 'photo_bin' => $photo_bin, 627 'disabled_delete_photo' => $disabled_delete_photo, 628 'display_picture' => $this->functions->check_acl($manager_account_lid,'edit_users_picture') ? '' : 'none', 633 'disabled_edit_photo' => $disabled_edit_photo, 634 //'display_picture' => $this->functions->check_acl($manager_account_lid,'edit_users_picture') ? '' : 'none', 635 'display_picture' => $display_picture, 629 636 630 637 'display_tr_default_password' => $this->functions->check_acl($manager_account_lid,'set_user_default_password') ? '' : 'none', -
trunk/expressoAdmin1_2/inc/class.uigroups.inc.php
r73 r180 289 289 $p->set_file(Array('create_group' => 'groups_form.tpl')); 290 290 291 // Pega combo das organizações e seleciona a org do grupo. 292 //$combo_manager_org = $this->functions->get_organizations($manager_context, trim(strtolower($group_info['context']))); 291 // Obtem combo das organizações e seleciona a org do grupo. 293 292 foreach ($manager_contexts as $index=>$context) 294 293 $combo_manager_org .= $this->functions->get_organizations($context, trim(strtolower($group_info['context']))); -
trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php
r73 r180 186 186 $p->set_file(Array('create_maillist' => 'maillists_form.tpl')); 187 187 188 // Pega combodas organizações.188 // Obtem combos das organizações. 189 189 foreach ($manager_contexts as $index=>$context) 190 $sectors .= $this->functions->get_organizations($context); 191 190 $combo_manager_org .= $this->functions->get_organizations($context); 191 $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', true, true); 192 192 193 // Seta variaveis utilizadas pelo tpl. 193 194 $var = Array( … … 203 204 'lang_maillist_organization'=> lang('Maillist Organization'), 204 205 'lang_search_organization' => lang('Search Organiztion'), 205 'lang_org' => lang('Organizations'), 206 'lang_search_user' => lang('Search user'), 207 'lang_organizations' => lang('Organizations'), 206 208 'lang_maillist_uid' => lang('Maillist login'), 207 209 'lang_maillist_mail' => lang('Maillist Mail'), … … 212 214 'lang_all_users' => lang('Show users from all sub-organizations'), 213 215 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), 214 'combo_org' => $sectors 216 'combo_manager_org' => $combo_manager_org, 217 'combo_all_orgs' => $combo_all_orgs, 218 'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'] 215 219 ); 216 220 $p->set_var($var); … … 245 249 $p->set_file(Array('edit_maillist' => 'maillists_form.tpl')); 246 250 247 // Pega combo das organizações e seleciona a org da lista. 248 foreach ($manager_contexts as $index=>$context) 249 $sectors .= $this->functions->get_organizations($context, trim(strtolower($maillist_info['context'])) ); 251 // Obtem combos das organizações. 252 foreach ($manager_contexts as $index=>$context) 253 $combo_manager_org .= $this->functions->get_organizations($context, trim(strtolower($maillist_info['context']))); 254 $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], trim(strtolower($maillist_info['context'])), true, true); 250 255 251 256 // Usuarios da lista. 252 257 $user_count = 0; 253 if (count($maillist_info['m embers_info']) > 0)254 { 255 foreach ($maillist_info['m embers_info'] as $uidnumber=>$userinfo)256 { 257 $array_users[$ uidnumber] = $userinfo['cn'];258 $array_users_uid[$ uidnumber] = $userinfo['uid'];259 $array_users_type[$ uidnumber] = $userinfo['type'];258 if (count($maillist_info['mailForwardingAddress_info']) > 0) 259 { 260 foreach ($maillist_info['mailForwardingAddress_info'] as $mail=>$userinfo) 261 { 262 $array_users[$mail] = $userinfo['cn']; 263 $array_users_uid[$mail] = $userinfo['uid']; 264 $array_users_type[$mail] = $userinfo['type']; 260 265 } 261 266 natcasesort($array_users); 262 foreach ($array_users as $ uidnumber=>$cn)267 foreach ($array_users as $mail=>$cn) 263 268 { 264 269 $user_count++; 265 if ($array_users_type[$ uidnumber] == 'u')266 { 267 $users .= "<option value=" . $ uidnumber . ">" . $cn . " [" . $array_users_uid[$uidnumber] . "]</option>";268 } 269 elseif ($array_users_type[$ uidnumber] == 'l')270 { 271 $lists .= "<option value=" . $ uidnumber . ">" . $cn . " [" . $array_users_uid[$uidnumber] . "]</option>";270 if ($array_users_type[$mail] == 'u') 271 { 272 $users .= "<option value=" . $mail . ">" . $cn . " [" . $array_users_uid[$mail] . "]</option>"; 273 } 274 elseif ($array_users_type[$mail] == 'l') 275 { 276 $lists .= "<option value=" . $mail . ">" . $cn . " [" . $array_users_uid[$mail] . "]</option>"; 272 277 } 273 278 else 274 279 { 275 $ unknow .= "<option value=" . $uidnumber . ">" . $cn . " [" . $array_users_uid[$uidnumber] . "]</option>";280 $mail_not_found .= "<option value=" . $mail . ">" . $cn . " [" . $array_users_uid[$mail] . "]</option>"; 276 281 } 277 282 } 278 283 279 if ($ unknow!= '')280 { 281 $opt_tmp_ unknow= '<option value="-1" disabled>-------------------- E-mails não encontrados ------------------ </option>'."\n";282 $ea_select_usersInMaillist .= $opt_tmp_ unknow . $unknow;284 if ($mail_not_found != '') 285 { 286 $opt_tmp_mail_not_found = '<option value="-1" disabled>-------------------- E-mails não encontrados ------------------ </option>'."\n"; 287 $ea_select_usersInMaillist .= $opt_tmp_mail_not_found . $mail_not_found; 283 288 } 284 289 if ($lists != '') … … 299 304 'lang_back' => lang('Back'), 300 305 'lang_save' => lang('save'), 301 'lang_maillist_organization'=> lang('Maillist Organization'), 302 'lang_search_organization' => lang('Search Organiztion'), 303 'lang_org' => lang('Organizations'), 306 'lang_maillist_organization' => lang('Maillist Organization'), 307 'lang_search_organization' => lang('Search Organiztion'), 308 'lang_search_user' => lang('Search user'), 309 'lang_organizations' => lang('Organizations'), 304 310 'lang_maillist_uid' => lang('Maillist login'), 305 311 'lang_maillist_mail' => lang('Maillist Mail'), … … 310 316 'lang_all_users' => lang('Select users from all sub-organizations'), 311 317 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.list_maillists'), 312 'combo_org' => $sectors, 318 'combo_manager_org' => $combo_manager_org, 319 'combo_all_orgs' => $combo_all_orgs, 313 320 'uidnumber' => $_GET['uidnumber'], 314 321 'uid' => $maillist_info['uid'], … … 318 325 'accountStatus_checked' => $maillist_info['accountStatus'] == 'active' ? 'CHECKED' : '', 319 326 'phpgwAccountVisible_checked' => $maillist_info['phpgwAccountVisible'] == '-1' ? 'CHECKED' : '', 320 'ea_select_usersInMaillist' => $ea_select_usersInMaillist 327 'ea_select_usersInMaillist' => $ea_select_usersInMaillist, 328 'defaultDomain' => $this->current_config['expressoAdmin_defaultDomain'] 321 329 ); 322 330 $p->set_var($var); -
trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php
r107 r180 151 151 $applications_list = $this->make_app_list(''); 152 152 153 /* 153 154 if ($_POST['context']) 154 155 { … … 158 159 } 159 160 else 160 $input_context_fields = '<input type="text" size=60></input><br>'; 161 $input_context_fields = '<input type="text" size=60></input><br>'; 162 */ 163 164 $options_context = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', false, true); 161 165 162 166 // Seta variaveis que estao no TPL 163 167 $var = Array( 164 168 'scripts_java' => $scripts_java, 165 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 169 //'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 170 //'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.bomanagers.add_managers'), 166 171 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 167 172 'type' => "add", … … 174 179 'manager_lid' => $_POST['manager_lid'], 175 180 'context' => $_POST['context'], 176 'app_list' => $applications_list 181 'app_list' => $applications_list, 182 'options_contexts' => $options_context 177 183 ); 178 184 $p->set_var($var); … … 236 242 $_POST['manager_lid'] = $_GET['manager_lid']; 237 243 $_POST['context'] = $_GET['context']; 238 $old_manager_lid = $_GET['manager_lid']; 239 $old_context = $_GET['context']; 244 $hidden_manager_lid = $_GET['manager_lid']; 240 245 } 241 246 elseif ($_POST['manager_lid'] != '') 242 247 { 243 248 $first_time = false; 244 $old_manager_lid = $_POST['old_manager_lid']; 245 $old_context = $_POST['old_context']; 249 $hidden_manager_lid = $_POST['old_manager_lid']; 246 250 } 247 251 … … 287 291 $a_context = split("%", $_POST['context']); 288 292 foreach ($a_context as $context) 289 $input_context_fields .= '<input type="text" value="'.$context.'" size=60></input><br>'; 293 $input_context_fields .= '<div><input disabled type="text" value="'.$context.'" size=60></input><span onclick="this.parentNode.parentNode.removeChild(this.parentNode);" style="cursor:pointer"> -</span></div>'; 294 $options_context = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', false, true); 290 295 291 296 $var = Array( 292 'scripts_java' => $scripts_java, 293 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 294 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 295 'color_bg1' => "#E8F0F0", 296 'color_bg2' => "#D3DCE3", 297 'color_font1' => "#DDDDDD", 298 'color_font2' => "#EEEEEE", 299 'type' => "edit", 300 'error_messages'=> $_POST['error_messages'] == '' ? '' : '<script language="JavaScript1.3">alert("'.$_POST['error_messages'].'");</script>', 301 'manager_lid' => $_POST['manager_lid'], 302 'context' => $_POST['context'], 297 'scripts_java' => $scripts_java, 298 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), 299 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', 300 'color_bg1' => "#E8F0F0", 301 'color_bg2' => "#D3DCE3", 302 'color_font1' => "#DDDDDD", 303 'color_font2' => "#EEEEEE", 304 'type' => "edit", 305 'display_manager_select' => 'none', 306 'input_manager_lid_disabled'=> 'disabled', 307 'error_messages' => $_POST['error_messages'] == '' ? '' : '<script language="JavaScript1.3">alert("'.$_POST['error_messages'].'");</script>', 308 'manager_lid' => $_POST['manager_lid'], 309 'hidden_manager_lid' => $_POST['manager_lid'], 310 'context' => $_POST['context'], 303 311 304 'input_context_fields' => $input_context_fields, 312 'input_context_fields' => $input_context_fields, 313 'options_contexts' => $options_context, 305 314 306 // Para o update no banco, preciso saber oq foi alterado e para que. 307 // Talvez so o manager e o contexto. 308 'old_manager_lid' => $old_manager_lid, 309 'old_context' => $old_context, 310 'app_list' => $applications_list 315 'hidden_manager_lid' => $hidden_manager_lid, 316 'app_list' => $applications_list 311 317 ); 312 318 $p->set_var($var); … … 335 341 } 336 342 343 /* 337 344 function validate() 338 { 345 { 346 return 'OK'; 347 339 348 $accounts = CreateObject('phpgwapi.accounts'); 340 349 $errors = array(); 341 350 351 342 352 // verifica se o manager existe. caso retorne 1 existe e eh uma conta de usuario. 343 $manager_lid_exists = $accounts->exists($_POST[' manager_lid']);353 $manager_lid_exists = $accounts->exists($_POST['ea_select_managers']); 344 354 if ($manager_lid_exists != 1) 345 355 { … … 351 361 return; 352 362 } 363 353 364 354 365 // Verifica se o contexto existe. … … 367 378 if (!$sr) 368 379 { 369 $_POST['error_messages'] = lang("Context don't exist") . ": $context"; 380 $_POST['error_messages'] = lang("Context don't exist") . ": $context"; 370 381 ldap_close($ldap_conn); 371 382 if ($_POST['type'] == 'add') … … 380 391 { 381 392 //Verifica se ja existe o manager com aquele contexto cadastrado 382 $query = "SELECT manager_lid FROM phpgw_expressoadmin WHERE manager_lid = '" . $_POST[' manager_lid'] . "' AND context = '" . $_POST['context'] . "'";393 $query = "SELECT manager_lid FROM phpgw_expressoadmin WHERE manager_lid = '" . $_POST['ea_select_manager'] . "' AND context = '" . $_POST['context'] . "'"; 383 394 $GLOBALS['phpgw']->db->query($query); 384 395 $num_registros = 0; … … 403 414 return true; 404 415 } 416 */ 405 417 406 418 function make_lang($ram_lang) -
trunk/expressoAdmin1_2/inc/class.user.inc.php
r107 r180 469 469 // ADD or REMOVE some attributes 470 470 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 471 472 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 473 // PHOTO 474 if ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users_picture')) 475 { 476 if ($new_values['delete_photo']) 477 { 478 $this->ldap_functions->ldap_remove_photo($dn); 479 $this->db_functions->write_log("removido jpegphoto do usuario",'',$dn,'',''); 480 } 481 elseif ($_FILES['photo']['name'] != '') 482 { 483 if ($new_values['photo_exist']) 484 { 485 $photo_exist = true; 486 $this->db_functions->write_log("substituido jpegphoto do usuario",'',$dn,'',''); 487 } 488 else 489 { 490 $photo_exist = false; 491 $this->db_functions->write_log("adicionado jpegphoto ao usuario",'',$dn,'',''); 492 } 493 $this->ldap_functions->ldap_save_photo($dn, $_FILES['photo']['tmp_name'], $new_values['photo_exist'], $photo_exist); 494 } 495 } 471 496 472 497 // Verifica o acesso ára adicionar ou remover tais atributos … … 532 557 $ldap_remove['phpgwaccountvisible'] = array(); 533 558 $this->db_functions->write_log("removido phpgwaccountvisible ao usuario",'',$dn,'',''); 534 }535 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////536 // PHOTO537 if ( ($new_values['delete_photo']) && ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users_picture')) )538 {539 $this->ldap_functions->ldap_remove_photo($dn);540 $this->db_functions->write_log("removido jpegphoto do usuario",'',$dn,'','');541 }542 elseif ( ($_FILES['photo']['name'] != '') && ($this->functions->check_acl($_SESSION['phpgw_session']['session_lid'], 'edit_users_picture')) )543 {544 if ($new_values['photo_exist'])545 $photo_exist = true;546 else547 $photo_exist = false;548 $this->ldap_functions->ldap_save_photo($dn, $_FILES['photo']['tmp_name'], $new_values['photo_exist'], $photo_exist);549 $this->db_functions->write_log("adicionado jpegphoto ao usuario",'',$dn,'','');550 559 } 551 560 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.