Changeset 752 for trunk/contactcenter/inc/class.ui_data.inc.php
- Timestamp:
- 04/17/09 16:34:36 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contactcenter/inc/class.ui_data.inc.php
r702 r752 70 70 if($this->page_info['actual_catalog']['class'] == 'bo_group_manager') 71 71 $this -> typeContact = 'groups'; 72 else if($this->page_info['actual_catalog']['class'] == 'bo_shared_catalog_manager') 73 $this -> typeContact = 'shared'; 72 else if($this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager') 73 $this -> typeContact = 'shared_groups'; 74 else if($this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager') 75 $this -> typeContact = 'shared_contacts'; 74 76 else 75 77 $this -> typeContact = 'contacts'; … … 150 152 /* Messages */ 151 153 $GLOBALS['phpgw']->template->set_var('cc_msg_not_allowed',lang('Not Allowed')); 154 $GLOBALS['phpgw']->template->set_var('cc_msg_unavailable',lang('Unavailable function')); 152 155 $GLOBALS['phpgw']->template->set_var('cc_msg_no_cards',lang('No Cards')); 153 156 $GLOBALS['phpgw']->template->set_var('cc_msg_err_no_room',lang('No Room for Cards! Increase your browser area.')); … … 583 586 switch ($this->page_info['actual_catalog']['class']) 584 587 { 585 case 'bo_shared_catalog_manager': 588 case 'bo_shared_people_manager': 589 case 'bo_people_catalog': 586 590 $field_name = 'id_contact'; 587 591 … … 593 597 'type' => 'iLIKE', 594 598 'value' => $letter !== 'all' ? $letter.'%' : '%' 595 ) 599 ) 596 600 ); 597 } 598 else 599 { 600 $find_restric[0] = array( 601 0 => array( 602 'type' => 'branch', 603 'value' => 'OR', 604 'sub_branch' => array( 605 0 => array( 606 'field' => 'contact.names_ordered', 607 'type' => 'LIKE', 608 'value' => '0%' 609 ), 610 1 => array( 611 'field' => 'contact.names_ordered', 612 'type' => 'LIKE', 613 'value' => '1%' 614 ), 615 2 => array( 616 'field' => 'contact.names_ordered', 617 'type' => 'LIKE', 618 'value' => '2%' 619 ), 620 3 => array( 621 'field' => 'contact.names_ordered', 622 'type' => 'LIKE', 623 'value' => '3%' 624 ), 625 4 => array( 626 'field' => 'contact.names_ordered', 627 'type' => 'LIKE', 628 'value' => '4%' 629 ), 630 5 => array( 631 'field' => 'contact.names_ordered', 632 'type' => 'LIKE', 633 'value' => '5%' 634 ), 635 6 => array( 636 'field' => 'contact.names_ordered', 637 'type' => 'LIKE', 638 'value' => '6%' 639 ), 640 7 => array( 641 'field' => 'contact.names_ordered', 642 'type' => 'LIKE', 643 'value' => '7%' 644 ), 645 8 => array( 646 'field' => 'contact.names_ordered', 647 'type' => 'LIKE', 648 'value' => '8%' 649 ), 650 9 => array( 651 'field' => 'contact.names_ordered', 652 'type' => 'LIKE', 653 'value' => '9%' 654 ) 655 ) 656 ) 657 ); 658 } 659 660 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 661 662 $find_other[0] = array( 663 'order' => 'contact.names_ordered' 664 ); 665 666 break; 667 case 'bo_people_catalog': 668 $field_name = 'id_contact'; 669 670 if ($letter !== 'number') 671 { 672 $find_restric[0] = array( 673 0 => array( 674 'field' => 'contact.names_ordered', 675 'type' => 'iLIKE', 676 'value' => $letter !== 'all' ? $letter.'%' : '%' 677 ), 678 1 => array( 679 'field' => 'contact.id_owner', 680 'type' => '=', 681 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 682 ) 683 ); 601 if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog'){ 602 $find_restric[0][1] = array( 603 'field' => 'contact.id_owner', 604 'type' => '=', 605 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 606 ); 607 } 684 608 } 685 609 else … … 741 665 ), 742 666 ), 743 ), 744 1 => array( 745 'field' => 'contact.id_owner', 746 'type' => '=', 747 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 748 ), 667 ) 749 668 ); 750 669 } 670 671 if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog'){ 672 $find_restric[0][1] = array( 673 'field' => 'contact.id_owner', 674 'type' => '=', 675 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 676 ); 677 } 678 751 679 752 680 $find_field[0] = array('contact.id_contact','contact.names_ordered'); 753 681 754 682 $find_other[0] = array( 755 //'offset' => (($page-1)*$this->page_info['n_cards']),756 //'limit' => $this->page_info['n_cards'],757 683 'order' => 'contact.names_ordered' 758 684 ); … … 985 911 986 912 case 'bo_group_manager': 987 913 case 'bo_shared_group_manager': 914 988 915 $field_name = 'id_group'; 989 916 … … 1009 936 } 1010 937 1011 array_push($find_restric[0], array( 938 if($this->page_info['actual_catalog']['class'] == 'bo_group_manager'){ 939 array_push($find_restric[0], array( 1012 940 'field' => 'group.owner', 1013 941 'type' => '=', 1014 942 'value' => $GLOBALS['phpgw_info']['user']['account_id'] 1015 ) 1016 ); 943 ) 944 ); 945 } 1017 946 1018 947 $find_field[0] = array('group.id_group','group.title','group.short_name'); 1019 948 $find_other[0] = array( 1020 949 'order' => 'group.title' 1021 ); 1022 950 ); 1023 951 break; 1024 952 1025 953 case 'bo_catalog_group_catalog': 1026 954 $this->page_info['actual_entries'] = false; … … 1038 966 1039 967 $result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]); 968 1040 969 $n_entries = count($result); 1041 970 … … 1052 981 if (!$result) 1053 982 { 983 1054 984 $this->page_info['actual_entries'] = false; 1055 985 … … 1068 998 foreach ($result as $id => $value) 1069 999 { 1070 if($this->page_info['actual_catalog']['class'] != 'bo_shared_ catalog_manager')1000 if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 1071 1001 $this->page_info['actual_entries'][] = $value[$field_name]; 1072 1002 else 1073 $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms'] );1003 $this->page_info['actual_entries'][] = array(0=>$value[$field_name],1=>$value['perms'],2=>$value['owner']); 1074 1004 } 1075 1005 //print_r($this->page_info['actual_entries']); … … 1136 1066 5 => 'cc_alias', 1137 1067 6 => 'cc_id', 1138 7 => 'cc_forwarding_address' 1068 7 => 'cc_forwarding_address' 1139 1069 ) 1140 1070 ); … … 1147 1077 //echo 'ID_I: '.$id_i.'<br>'; 1148 1078 //echo 'ID_F: '.$id_f.'<br>'; 1149 ///---------------- Correção Temporária PHP5 -----------------------///1079 1150 1080 $ids = array(); 1151 1081 $perms = array(); 1082 $owners = array(); 1152 1083 $array_temp = array(); 1153 1084 1154 1085 foreach($this->page_info['actual_entries'] as $key=>$tmp){ 1155 1086 $array_temp[] = $tmp; … … 1158 1089 for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 1159 1090 { 1160 if($this->page_info['actual_catalog']['class'] != 'bo_shared_ catalog_manager')1091 if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 1161 1092 $ids[] = $array_temp[$i]; 1162 1093 else { 1163 1094 $ids[] = $array_temp[$i][0]; 1164 1095 $perms[] = $array_temp[$i][1]; 1096 $owners[] = $array_temp[$i][2]; 1165 1097 } 1166 1098 //$perms[] = $array_temp[$i]; 1167 1099 } 1168 1100 1101 1102 // Carrega o nome completo dos donos dos objetos (contatos e grupos); 1103 $owner_names = array(); 1104 1105 if($owners) { 1106 $filter = "(|"; 1107 foreach($owners as $i => $owner) { 1108 $filter .= "(uidNumber=".$owner.")"; 1109 } 1110 $filter .= ")"; 1111 1112 if(!$this->bo->catalog->src_info) { 1113 $ldap = CreateObject('contactcenter.bo_ldap_manager'); 1114 $this->bo->catalog->src_info = $ldap->srcs[1]; 1115 } 1116 $ds = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false); 1117 $dn=$this->bo->catalog->src_info['dn']; 1118 $justThese = array("cn","uidnumber","uid"); 1119 $sr = ldap_search($ds,$dn, $filter,$justThese); 1120 $info = ldap_get_entries($ds, $sr); 1121 ldap_close($ds); 1122 for($z = 0; $z < $info['count']; $z++) { 1123 $owner_names[$info[$z]['uidnumber'][0]] = array("cn" => $info[$z]['cn'][0], "uid" => $info[$z]['uid'][0]); 1124 } 1125 } 1169 1126 /// Original 1170 1127 //for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) … … 1175 1132 1176 1133 $fields = $this->bo->catalog->get_fields(false); 1177 1178 if( $this->typeContact == 'groups') { 1134 if( $this->typeContact == 'groups' || $this->typeContact == 'shared_groups') { 1179 1135 $final = array( 1180 1136 0 => (int)$this->page_info['n_pages'], … … 1187 1143 ) 1188 1144 ); 1189 1190 1145 $groups =& $this->bo->catalog->get_multiple_entries($ids,$fields); 1191 1146 1192 1147 $i = 0; 1193 1148 // contatos do grupo 1194 1149 $boGroups = CreateObject('contactcenter.bo_group'); 1195 1150 $contacts = array(); 1196 foreach($groups as $group) {1197 1151 1152 foreach($groups as $group) { 1198 1153 $final[3][$i][0] = $group['title'] ? $group['title'] : 'none'; 1199 1154 $final[3][$i][1] = $group['short_name'] ? $group['short_name'] : 'none'; … … 1201 1156 $contacts = $boGroups -> get_contacts_by_group($group['id_group']); 1202 1157 $final[3][$i][3] = $contacts; 1158 $final[3][$i][4] = $perms[$i]; 1159 if($this->typeContact == 'shared_groups'){ 1160 $final[3][$i][5] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 1161 $final[3][$i][6] = $owner_names[$owners[$i]]['uid']; 1162 } 1203 1163 $i++; 1204 1164 } … … 1210 1170 $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 1211 1171 1212 $final[5] = '<span class="link" onclick="'.$lnk_compose; 1213 $final[10] = 'groups';1172 $final[5] = '<span class="link" onclick="'.$lnk_compose; 1173 $final[10] = $this->typeContact; 1214 1174 $this->save_session(); 1215 1175 echo serialize($final); … … 1301 1261 $final[3][$i][7] = array(); 1302 1262 1303 if($this->page_info['actual_catalog']['class']=='bo_shared_ catalog_manager') {1263 if($this->page_info['actual_catalog']['class']=='bo_shared_people_manager') { 1304 1264 $final[3][$i][8] = $perms[$i]; 1265 $final[3][$i][9] = lang('Shared').": ".$owner_names[$owners[$i]]['cn']; 1305 1266 } 1306 1267 … … 1373 1334 } 1374 1335 } 1375 $data['contact_list'] = $contact_options; 1376 $data['result'] = 'ok'; 1336 $data['contact_list'] = $contact_options; 1337 $data['result'] = 'ok'; 1338 1377 1339 echo serialize($data); 1378 1340 } … … 2315 2277 if ($this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 2316 2278 $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 2317 $this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 2279 $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 2280 $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 2318 2281 { 2319 2282 … … 2349 2312 if (!$external && $this->page_info['actual_catalog']['class'] != 'bo_people_catalog' && 2350 2313 $this->page_info['actual_catalog']['class'] != 'bo_group_manager' && 2351 $this->page_info['actual_catalog']['class'] != 'bo_shared_catalog_manager') 2314 $this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && 2315 $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager' ) 2352 2316 { 2353 2317 /* … … 2395 2359 if ($external || $this->page_info['actual_catalog']['class'] == 'bo_people_catalog' || 2396 2360 $this->page_info['actual_catalog']['class'] == 'bo_group_manager' || 2397 $this->page_info['actual_catalog']['class'] == 'bo_shared_catalog_manager') 2361 $this->page_info['actual_catalog']['class'] == 'bo_shared_people_manager' || 2362 $this->page_info['actual_catalog']['class'] == 'bo_shared_group_manager' ) 2398 2363 { 2399 2364 // Get only this attributes: dn, cn for external catalogs, … … 2427 2392 foreach ($ids as $e_info) 2428 2393 { 2429 if($this->page_info['actual_catalog']['class'] != 'bo_shared_ catalog_manager')2394 if($this->page_info['actual_catalog']['class'] != 'bo_shared_people_manager' && $this->page_info['actual_catalog']['class'] != 'bo_shared_group_manager') 2430 2395 $ids_f[] = $e_info[$id_field]; 2431 2396 else
Note: See TracChangeset
for help on using the changeset viewer.