Changeset 752
- Timestamp:
- 04/17/09 16:34:36 (14 years ago)
- Files:
-
- 2 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/expressoMail1_2/1.233/inc/class.db_functions.inc.php
r673 r752 10 10 var $db; 11 11 var $user_id; 12 var $related_ids; 12 13 13 14 function db_functions(){ … … 30 31 $result = array(); 31 32 $stringDropDownContacts = ''; 32 // Traz primeiro os usuarios que compartilharam com o usuario logado: 33 $query = 'select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1'; 34 // Somente do usuario logado 35 $query_related = 'A.id_owner ='.$this -> user_id; 36 if (!$this->db->query($query)) 37 return null; 38 while($this->db->next_record()){ 39 $row = $this->db->row(); 40 $result[] = $row['id_related']; 41 } 42 $ids_related = implode(",",$result); 43 44 // Se houver contatos compartilhados então altera a query. 45 if($ids_related) 46 $query_related = '(A.id_owner ='.$this -> user_id.' or A.id_owner in ('.$ids_related.'))'; 33 34 $query_related = $this->get_query_related('A.id_owner'); // field name for owner 47 35 48 36 // Traz os contatos pessoais e compartilhados … … 50 38 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. 51 39 'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 52 'and B.id_typeof_contact_connection = 1 and '.$query_related.'group by '.53 'A.names_ordered,C.connection_value order by A.names_ordered';54 40 'and B.id_typeof_contact_connection = 1 and ('.$query_related.') group by '. 41 'A.names_ordered,C.connection_value order by lower(A.names_ordered)'; 42 55 43 if (!$this->db->query($query)) 56 44 return null; … … 71 59 return $stringDropDownContacts; 72 60 } 73 61 // Get Related Ids for sharing contacts or groups. 62 function get_query_related($field_name){ 63 $query_related = $field_name .'='.$this -> user_id; 64 // Only at first time, it gets all related ids... 65 if(!$this->related_ids) { 66 $query = 'select id_related from phpgw_cc_contact_rels where id_contact='.$this -> user_id.' and id_typeof_contact_relation=1'; 67 if (!$this->db->query($query)){ 68 return $query_related; 69 } 70 71 while($this->db->next_record()){ 72 $row = $this->db->row(); 73 $result[] = $row['id_related']; 74 } 75 if($result) 76 $this->related_ids = implode(",",$result); 77 } 78 if($this->related_ids) 79 $query_related .= ' or '.$field_name.' in ('.$this->related_ids.')'; 80 81 return $query_related; 82 } 74 83 function get_cc_groups() 75 84 { … … 77 86 $stringDropDownContacts = ''; 78 87 $result = array(); 79 $query = 'select title, short_name from phpgw_cc_groups where owner ='.$this -> user_id.' order by title'; 88 $query_related = $this->get_query_related('owner'); // field name for 'owner' 89 $query = 'select title, short_name, owner from phpgw_cc_groups where '.$query_related.' order by lower(title)'; 90 80 91 // Executa a query 81 92 if (!$this->db->query($query)) … … 84 95 while($this->db->next_record()) 85 96 $result[] = $this->db->row(); 86 // Se houver grupos .... 97 98 // Se houver grupos .... 87 99 if (count($result) != 0) 88 { 89 foreach($result as $group) 90 $stringDropDownContacts .= $group['title']. ';' . $group['short_name'] . ','; 100 { 101 // Create Ldap Object, if exists related Ids for sharing groups. 102 if($this->related_ids){ 103 $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids']= array(); 104 include_once("class.ldap_functions.inc.php"); 105 $ldap = new ldap_functions(); 106 } 107 foreach($result as $group){ 108 // Searching uid (LDAP), if exists related Ids for sharing groups. 109 // Save into user session. It will used before send mail (verify permission). 110 if(!$_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']] && $ldap){ 111 $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']] = $ldap -> uidnumber2uid($group['owner']); 112 } 113 if($this->user_id != $group['owner']) 114 $owneruid = "::".$_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids'][$group['owner']]; 115 116 $stringDropDownContacts .= $group['title']. ';' . ($group['short_name'].$owneruid) . ','; 117 } 91 118 //Retira ultima virgula. 92 119 $stringDropDownContacts = substr($stringDropDownContacts,0,(strlen($stringDropDownContacts) - 1)); 93 120 } 94 121 else 95 return null; 96 122 return null; 97 123 return $stringDropDownContacts; 98 124 } … … 100 126 function getContactsByGroupAlias($alias) 101 127 { 128 list($alias,$uid) = explode("::",$alias); 129 $cc_related_ids = $_SESSION['phpgw_info']['expressomail']['user']['cc_related_ids']; 130 // Explode personal group, If exists related ids (the user has permission to send email). 131 if(is_array($cc_related_ids) && $uid){ 132 $owner = array_search($uid,$cc_related_ids); 133 } 102 134 103 135 $query = "select C.id_connection, A.names_ordered, C.connection_value from phpgw_cc_contact A, ". … … 105 137 "A.id_contact = B.id_contact and B.id_connection = C.id_connection ". 106 138 "and B.id_typeof_contact_connection = 1 and ". 107 "A.id_owner =". $this -> user_id." and ".139 "A.id_owner =".($owner ? $owner : $this->user_id)." and ". 108 140 "D.id_group = E.id_group and ". 109 "D.id_connection = C.id_connection and E.short_name = '".$alias. 110 "' order by A.names_ordered"; 141 "D.id_connection = C.id_connection and E.short_name = '".$alias."'"; 111 142 112 143 if (!$this->db->query($query)) … … 136 167 137 168 $alias = substr($array_addrs[$i], strpos($array_addrs[$i],'<'), strpos($array_addrs[$i],'>')); 138 $alias = str_replace('<','', str_replace('>','',$alias)); 169 $alias = str_replace('<','', str_replace('>','',$alias)); 170 139 171 $arrayContacts = $this -> getContactsByGroupAlias($alias); 140 172 -
tags/expressoMail1_2/1.233/inc/class.ldap_functions.inc.php
r657 r752 612 612 return false; 613 613 } 614 function uidnumber2uid($uidnumber) 615 { 616 // do not follow the referral 617 $this->ldapRootConnect(false); 618 if ($this->ds) 619 { 620 $filter="(&(phpgwAccountType=u)(uidnumber=$uidnumber))"; 621 $justthese = array("uid"); 622 $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 623 if(!$sr) 624 return false; 625 $info = ldap_get_entries($this->ds, $sr); 626 return $info[0]["uid"][0]; 627 } 628 return false; 629 } 614 630 function getSharedUsersFrom($params){ 615 631 $filter = ''; -
trunk/contactcenter/inc/class.bo_contactcenter.inc.php
r498 r752 350 350 if($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['shared_contacts']){ 351 351 $this->tree[2] = array('type' => 'sql'); 352 $this->tree['branches'][2] = array('name' => lang('Shared'), 353 'type' => 'catalog', 354 'class' => 'bo_shared_catalog_manager', 352 $this->tree['branches'][2] = array( 353 'name' => lang('Shared'), 354 'type' => 'mixed_catalog_group', 355 'class' => 'bo_shared_people_manager', 355 356 'icon' => 'people-mini.png', 356 'sub_branch' => false); 357 'sub_branch' => array( 358 0 => array( 359 'name' => lang('People'), 360 'type' => 'catalog', 361 'class' => 'bo_shared_people_manager', 362 'icon' => 'people-mini.png', 363 'sub_branch' => False 364 ), 365 1 => array( 366 'name' => lang('Groups'), 367 'type' => 'catalog', 368 'class' => 'bo_shared_group_manager', 369 'icon' => 'people-mini.png', 370 'sub_branch' => False 371 ) 372 ) 373 ); 357 374 unset($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['shared_contacts']); 358 375 } … … 419 436 $i++; 420 437 } 421 } 422 438 } 423 439 $GLOBALS['phpgw']->session->appsession('bo_contactcenter.tree','contactcenter',$this->tree); 424 440 return $this->tree['branches']; … … 599 615 $level = $this->get_level_by_branch($catalog, $this->tree['branches']); 600 616 $catalog =& $this->get_catalog_tree($level); 601 617 602 618 case 'catalog': 603 619 case 'catalog_group': -
trunk/contactcenter/inc/class.so_group.inc.php
r702 r752 26 26 function select($id = '') 27 27 { 28 $query = 'SELECT id_group,title,short_name FROM phpgw_cc_groups WHERE owner = '.$this->owner; 29 28 $query = 'SELECT id_group,title,short_name FROM phpgw_cc_groups '; 30 29 if($id != '') 31 $query .= ' ANDid_group ='.$id;30 $query .= 'WHERE id_group ='.$id; 32 31 33 32 $query .= ' ORDER BY title'; … … 44 43 $return[] = $this->db->row(); 45 44 } 46 47 45 48 46 return $return; … … 189 187 'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 190 188 'and B.id_typeof_contact_connection = 1 and '. 191 'A.id_owner ='.$this->owner.' and D.id_connection = C.id_connection and D.id_group = '.$idGroup. 189 //'A.id_owner ='.$this->owner.' and'. 190 ' D.id_connection = C.id_connection and D.id_group = '.$idGroup. 192 191 ' order by A.names_ordered'; 193 192 -
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 -
trunk/contactcenter/js/cc.js
r503 r752 188 188 function editSharedContact (id){ 189 189 openFullAdd(); 190 populateFullEdit(id,'bo_shared_ catalog_manager');190 populateFullEdit(id,'bo_shared_people_manager'); 191 191 } 192 192 /************ Edit Group *************/ … … 194 194 populateEditGroup(id); 195 195 } 196 197 function editSharedGroup(id){ 198 populateEditGroup(id, 'shared'); 199 } 200 196 201 /* 197 202 Updates all the constant fields in the … … 317 322 options_contact_list.innerHTML = select_contact_list; 318 323 319 if(data['id_group']) { 320 324 if(data['id_group']) { 325 Element('title').value = data['title']; 321 326 if(data['contact_in_list']) { 322 327 for(i = 0; i < data['contact_in_list'].length; i++) { … … 325 330 option.text = data['contact_in_list'][i]['names_ordered']+' ('+data['contact_in_list'][i]['connection_value']+')'; 326 331 Element('contact_in_list').options[Element('contact_in_list').options.length] = option; 327 } 328 } 329 330 Element('title').value = data['title']; 332 } 333 } 331 334 } 332 335 … … 341 344 id = typeof(id) == 'undefined' ? id = 0 : id; 342 345 343 ccAddGroup.clear(true); 346 ccAddGroup.clear(true); 344 347 Connector.newRequest('populateEditGroup', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_group&id='+id, 'GET', handler); 345 348 } … … 1850 1853 } 1851 1854 1852 if(type == 'groups' )1853 return populateGroupsInCards(data );1855 if(type == 'groups' || type == 'shared_groups') 1856 return populateGroupsInCards(data,type); 1854 1857 1855 1858 var pos = 0; … … 1904 1907 Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 1905 1908 } 1909 if(data[3][pos][9]) 1910 Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][9]+"</i></font></span>"; 1906 1911 break; 1907 1912 … … 1973 1978 } 1974 1979 } 1975 } 1976 if (type == "shared ") {1980 } 1981 if (type == "shared_contacts") { 1977 1982 if (data[3][pos][8] & 4) 1978 1983 eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedContact(Element('"+id+"' + ':cc_id').value);};"); … … 1988 1993 }; 1989 1994 } 1995 1996 1997 1990 1998 if (--ncards == 0) 1991 1999 { … … 2000 2008 } 2001 2009 2002 function populateGroupsInCards(data )2010 function populateGroupsInCards(data,type) 2003 2011 { 2004 2012 var pos = 0; … … 2032 2040 Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 2033 2041 } 2042 if(data[3][pos][5]) 2043 Element(id+':'+data[2][k]).innerHTML += "<br><span style='margin-left:30px'><font size='-2' color='#808080'><i>"+data[3][pos][5]+"</i></font></span>"; 2034 2044 break; 2035 2045 … … 2037 2047 if (data[3][pos][k].length > (CC_visual == 'table' ? 50 : 20)) 2038 2048 { 2039 Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k] +'\')">'+adjustString(data[3][pos][k], (CC_visual == 'table' ? 50 : 20))+'</span>';2049 Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k]+'::'+data[3][pos][6] +'\')">'+adjustString(data[3][pos][k], (CC_visual == 'table' ? 50 : 20))+'</span>'; 2040 2050 Element(id+':'+data[2][k]).title = data[3][pos][k]; 2041 2051 } 2042 2052 else 2043 2053 { 2044 Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k] + '\')">'+data[3][pos][k]+'</span>';2054 Element(id+':'+data[2][k]).innerHTML = data[5] + ''+data[3][pos][k]+(data[3][pos][6] ? '::'+data[3][pos][6] : "") + '\')">'+data[3][pos][k]+'</span>'; 2045 2055 } 2046 2056 break; … … 2073 2083 } 2074 2084 2085 if (type == "shared_groups") { 2086 /* Edição de grupos compartilhados está com problema. Desabilitado temporariamente. 2087 if (data[3][pos][4] & 4) 2088 eval("document.getElementById(id + ':cc_card_edit').onclick = function(){editSharedGroup(Element('"+id+"' + ':cc_id').value);};"); 2089 else 2090 */ 2091 document.getElementById(id + ':cc_card_edit').onclick = function(){ alert(Element('cc_msg_unavailable').value); }; 2092 2093 if (data[3][pos][4] & 8) 2094 eval("document.getElementById(id + ':cc_card_remove').onclick = function(){removeEntry(Element('" + id + "' + ':cc_id').value,'groups');};"); 2095 else 2096 document.getElementById(id + ':cc_card_remove').onclick = function(){ 2097 alert(Element('cc_msg_not_allowed').value); 2098 }; 2099 } 2100 2101 2075 2102 if (--ncards == 0) 2076 2103 { … … 2139 2166 function getCardHTML (id, type) 2140 2167 { 2141 if(type == 'groups' ) {2168 if(type == 'groups' || type == 'shared_groups') { 2142 2169 html_card = '<td id="' + id + '" style="width: ' + CC_card_image_width + 'px; height: ' + CC_card_image_height + '">' + 2143 2170 '<div style="border: 0px solid #999; position: relative;">' + … … 2147 2174 '<span id="' + id + ':cc_title" style="position: absolute; top: 30px; left: 75px; width: 135px; border: 0px solid #999; font-weight: bold; font-size: 10px; text-align: center; height: 10px;" onmouseover="//Element(\''+id+':cc_name_full\').style.visibility=\'visible\'" onmouseout="//Element(\''+id+':cc_name_full\').style.visibility=\'hidden\'"></span>' + 2148 2175 '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1;position: absolute; top: 15px; left: 15px"></span>' + 2149 '<span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_title\').innerHTML" id="' + id + ':cc_short_name" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' +2176 '<span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_short_name" style="position: absolute; top: 105px; left: 75px; width: 135px; border: 0px solid #999; font-weight: normal; font-size: 10px; text-align: center; height: 10px;"></span>' + 2150 2177 '<input id="' + id + ':cc_id" type="hidden">' + 2151 2178 '</div>' + '</td>'; … … 2184 2211 else 2185 2212 bg = "this.style.background=\'#EEEEEE\'"; 2186 if(type == 'groups' ) {2213 if(type == 'groups' || type == 'shared_groups') { 2187 2214 html_card = '<tr width="40%" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' + 2188 2215 '<span id="' + id + ':cc_participantes" style="cursor: pointer; cursor: hand; z-index: 1"></span>' + 2189 2216 '<span id="' + id + ':cc_title"></span></td>' + 2190 '<td width="40%" style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_title\').innerHTML" id="' + id + ':cc_short_name"></span></td>' +2217 '<td width="40%" style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_short_name"></span></td>' + 2191 2218 '<td align="left" width="55px">'+ 2192 2219 '<img title="'+Element('cc_msg_group_edit').value+'" id="' + id + ':cc_card_edit" style=" cursor: pointer; cursor: hand; z-index: 1;width: 18px; height: 18px;" onclick="editGroup(Element(\'' + id + ':cc_id\').value);" src="templates/default/images/cc_card_edit.png">' + … … 2201 2228 html_card = '<tr style="height:20px" id="' + id + '" onmouseout="'+bg+'" onmouseover="this.style.background=\'LIGHTYELLOW\'" bgcolor="EEEEEE"><td width="auto" style="font-weight: normal; font-size: 10px; text-align: left; height: 10px;">' + 2202 2229 '<span valign="bottom" id="' + id + ':cc_icon_group"> </span><span id="' + id + ':cc_name"></span></td>' + 2203 '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+' => '+'\'+document.getElementById(\''+id + ':cc_name\').innerHTML" id="' + id + ':cc_mail"></span></td>' +2230 '<td style="solid #999; font-weight: normal; font-size: 10px; text-align: left; height: 10px"><span onMouseOver="this.title = \''+Element('cc_send_mail').value+'\'" id="' + id + ':cc_mail"></span></td>' + 2204 2231 '<td align="center" nowrap><span style="solid #999; font-weight: normal; font-size: 10px;height: 10px" id="' + id + ':cc_phone"></span></td>' + 2205 2232 ( ccTree.catalog_perms == 1 ? … … 2245 2272 html_cards += ''; 2246 2273 } 2247 if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared')2274 if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 2248 2275 html_cards += '<tr><td colspan=4 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 2249 2276 } … … 2284 2311 html_cards += '</tr>'; 2285 2312 } 2286 if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared')2313 if((ccTree.catalog_perms & 2) && type != 'groups' && type !='shared_contacts' && type !='shared_groups') 2287 2314 html_cards += '<tr><td colspan=3 align="right"><button id="cc_button_tools" value="" type="button" onclick="javascript:removeAllEntries()">Remover Todos</button></td></tr>'; 2288 2315 } -
trunk/contactcenter/templates/default/index.tpl
r499 r752 14 14 <!-- JS MESSAGES --> 15 15 <input id="cc_msg_not_allowed" type="hidden" value="{cc_msg_not_allowed}"> 16 <input id="cc_msg_unavailable" type="hidden" value="{cc_msg_unavailable}"> 16 17 <input id="cc_msg_no_cards" type="hidden" value="{cc_msg_no_cards}"> 17 18 <input id="cc_msg_err_no_room" type="hidden" value="{cc_msg_err_no_room}">
Note: See TracChangeset
for help on using the changeset viewer.