Changeset 1496


Ignore:
Timestamp:
10/06/09 10:27:46 (14 years ago)
Author:
wmerlotto
Message:

Ticket #628 - Implementada a funcionalidade de adição no catálogo compartilhado.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/contactcenter/inc/class.bo_shared_people_manager.inc.php

    r752 r1496  
    5050                        $array_map = array(); 
    5151                        $rules_inicio = $rules; 
    52                          
     52         
    5353                        foreach($relacionados as $uid_relacionado => $tipo_relacionamento) { 
    5454                                $aclTemp = CreateObject("phpgwapi.acl",$uid_relacionado);  
    5555                                $aclTemp->read(); 
    5656                                $perms_relacao = $aclTemp->get_specific_rights($GLOBALS['phpgw_info']['user']['account_id'],'contactcenter'); //Preciso verificar as permissões que o contato relacionado deu para o atual 
    57                                                          
     57                                 
    5858                                if(!($perms_relacao&1)) //Se não tiver permissão de leitura, nem se preocupe em listá-los 
    5959                                        continue; 
     
    931931                        @return integer $id The Contact ID 
    932932                */       
    933                 function add_single_entry ( $data ) 
     933                function add_single_entry ( $data , $owner) 
    934934                { 
    935935                        $permissions = $this->security->get_permissions(); 
     
    10541054                        if ($altered) 
    10551055                        { 
    1056                                 $contact->set_field('id_owner',$GLOBALS['phpgw_info']['user']['account_id']); 
     1056                                if ($owner) 
     1057                                {        
     1058                                        $contact->set_field('id_owner',$owner); 
     1059                                }else 
     1060                                        $contact->set_field('id_owner',$GLOBALS['phpgw_info']['user']['account_id']); 
    10571061                                return $contact->commit(); 
    10581062                        } 
  • trunk/contactcenter/inc/class.ui_api.inc.php

    r1494 r1496  
    4141                        $template->set_var('cc_msg_err_timeout',lang('Operation Timed Out.')); 
    4242                        $template->set_var('cc_msg_err_serialize_data_unknown',lang('Data to be serialized is of unknown type!')); 
     43                        $template->set_var('cc_msg_err_shared',lang('No shared catalog that has permission to add.')); 
    4344                        /* End Messages */ 
    4445 
     
    229230                        $template->set_var('emails_telephones', lang("E-Mails and Telephones")); 
    230231                        $template->set_var('cc_default', lang("Default")); 
     232 
     233                        $template->set_var('cc_contact_shared',lang('Add to catalog')); 
     234                        $template->set_var('cc_contact_shared_types',lang('Choose in wich catalog you would like to add...')); 
    231235 
    232236                        /* End Contact */ 
  • trunk/contactcenter/inc/class.ui_data.inc.php

    r1419 r1496  
    123123                         
    124124                        $GLOBALS['phpgw']->template->set_var('cc_full_add_button',lang('Full Add')); 
     125                        $GLOBALS['phpgw']->template->set_var('cc_full_add_button_sh',lang('Full Add Shared')); 
    125126                        $GLOBALS['phpgw']->template->set_var('cc_reset',lang('Reset')); 
    126127                         
     
    175176                        $GLOBALS['phpgw']->template->set_var('cc_msg_group',lang('Group')); 
    176177                        $GLOBALS['phpgw']->template->set_var('cc_msg_contact_full',lang('Contact [Full]')); 
     178                        $GLOBALS['phpgw']->template->set_var('cc_msg_contact_sh',lang('Contact [Shared]')); 
    177179                        $GLOBALS['phpgw']->template->set_var('cc_msg_contact_qa',lang('Contact [Quick Add]')); 
    178180                        $GLOBALS['phpgw']->template->set_var('cc_contact_title',lang('Contact Center').' - '.lang('Contacts')); 
     
    320322                                        return $this->post_full_add(); 
    321323 
     324                                case 'post_full_add_shared' : 
     325                                        return $this->post_full_add_shared(); 
     326 
    322327                                case 'post_photo': 
    323328                                        return $this->post_photo((int) $_GET['id'] ? (int) $_GET['id'] : '_new_'); 
     
    586591                                unset($ids); 
    587592                                $this->page_info['changed'] = false; 
    588  
    589593                                switch ($this->page_info['actual_catalog']['class']) 
    590594                                { 
     
    592596                                        case 'bo_people_catalog': 
    593597                                                $field_name = 'id_contact'; 
    594  
    595598                                                if ($letter !== 'number') 
    596599                                                { 
     
    602605                                                                )                                                                
    603606                                                        ); 
    604                                                         if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog'){                                                          
     607 
     608                                                        //Tratamento de permissão de escrita no compartilhamento de catalogo 
     609                                                        $so_contact = CreateObject('contactcenter.so_contact',  $GLOBALS['phpgw_info']['user']['account_id']); 
     610                                                        $relacionados = $so_contact->get_relations(); 
     611                                                         
     612                                                        $perms_relacao = array();                                
     613 
     614                                                        foreach($relacionados as $uid_relacionado => $tipo_relacionamento) { 
     615                                                                $aclTemp = CreateObject("phpgwapi.acl",$uid_relacionado); 
     616                                                                $aclTemp->read(); 
     617                                                                $perms_relacao[$uid_relacionado] = $aclTemp->get_specific_rights($GLOBALS['phpgw_info']['user']['account_id'],'contactcenter'); //Preciso verificar as permissões que o contato relacionado deu para o atual 
     618                                                        } 
     619 
     620                                                        $validos = array(); 
     621                                                        $count = 0; 
     622                                                        foreach($perms_relacao as $uid_relacionado => $val){ 
     623                                                                if ($perms_relacao[$uid_relacionado]&2) 
     624                                                                { 
     625                                                                        $validos[$uid_relacionado] = $perms_relacao[$uid_relacionado]; 
     626                                                                        $count++; 
     627                                                                } 
     628                                                        } 
     629                                                        $prop_names = array(); 
     630                                                        if($validos) { 
     631                                                                $filtro = "(|"; 
     632                                                                foreach($validos as $i => $prop) { 
     633                                                                        $filtro .= "(uidNumber=".$i.")"; 
     634                                                                } 
     635                                                                $filtro .= ")"; 
     636 
     637                                                                if(!$this->bo->catalog->src_info) { 
     638                                                                        $ldaps = CreateObject('contactcenter.bo_ldap_manager'); 
     639                                                                        $this->bo->catalog->src_info = $ldaps->srcs[1]; 
     640                                                                } 
     641                                                                $s = $GLOBALS['phpgw']->common->ldapConnect($this->bo->catalog->src_info['host'], $this->bo->catalog->src_info['acc'], $this->bo->catalog->src_info['pw'], false); 
     642                                                                $n=$this->bo->catalog->src_info['dn']; 
     643                                                                $apenasThese = array("cn","uidnumber","uid"); 
     644                                                                $r = ldap_search($s,$n, $filtro,$apenasThese);                                         
     645                                                                $infos = ldap_get_entries($s, $r); 
     646                                                                ldap_close($s);                                                                        
     647                                                                for($z = 0; $z < $infos['count']; $z++) { 
     648                                                                        $prop_names[$infos[$z]['uidnumber'][0]] = array("cn" => $infos[$z]['cn'][0], "uid" => $infos[$z]['uid'][0]); 
     649                                                                } 
     650                                                        } 
     651                                                        //-------------------------------------------------------------------------------- 
     652                                                        if($this->page_info['actual_catalog']['class'] == 'bo_people_catalog') 
     653                                                        { 
    605654                                                                $find_restric[0][1] = array( 
    606655                                                                                'field' => 'contact.id_owner', 
     
    9631012 
    9641013                                } 
    965                                  
     1014 
    9661015                                $result = $this->bo->find($find_field[0],$find_restric[0],$find_other[0]); 
    967                                  
    9681016                                $n_entries = count($result); 
    9691017                                 
     
    10841132                                foreach($this->page_info['actual_entries'] as $key=>$tmp){ 
    10851133                                                $array_temp[] = $tmp;                            
    1086                                 }        
    1087                                  
     1134                                } 
     1135                         
    10881136                                for($i = $id_i; $i < $id_f and $i < $n_entries; $i++) 
    10891137                                { 
     
    10981146                                } 
    10991147                                 
    1100                                  
    11011148                                // Carrega o nome completo dos donos dos objetos (contatos e grupos); 
    11021149                                $owner_names = array(); 
     
    11081155                                        } 
    11091156                                        $filter .= ")"; 
    1110                                          
     1157 
    11111158                                        if(!$this->bo->catalog->src_info) { 
    11121159                                                $ldap = CreateObject('contactcenter.bo_ldap_manager'); 
     
    11291176                                //} 
    11301177                                /// 
    1131                                  
    11321178                                $fields = $this->bo->catalog->get_fields(false); 
    11331179                                if( $this->typeContact == 'groups' || $this->typeContact == 'shared_groups') { 
     
    12881334                                $lnk_compose = "location.href=('../expressoMail1_2/index.php?to="; 
    12891335                                $final[5] = '<span class="link" onclick="'.$lnk_compose; 
    1290  
     1336                                $final[6] = $prop_names; 
     1337                                $final[7] = $validos; 
     1338                                $final[8] = $this->page_info['actual_catalog']['class']; 
     1339                                $final[9] = $count; 
    12911340 
    12921341                                $this->page_info['actual_letter'] = $letter; 
     
    20022051                } 
    20032052 
     2053 
     2054                function post_full_add_shared() 
     2055                { 
     2056                        $data =  $_POST['data']; 
     2057                        // Exceptions!!! utf8 special chars.  
     2058                        $data = preg_replace("/\%u2(\d+)(\d+)(\d+)/","-",$data); 
     2059                        $data = unserialize(str_replace('\\"', '"', $data)); 
     2060                        $this -> bo -> catalog = CreateObject('contactcenter.bo_shared_people_manager'); 
     2061 
     2062                        if (!is_array($data)) 
     2063                        { 
     2064                                echo serialize(array( 
     2065                                        'msg' => lang('<p>Some problem receiving data from browser. This is probably a bug in ContactCenter<br>'. 
     2066                                                  'Please go to eGroupWare Bug Reporting page and report this bug.<br>'. 
     2067                                                          'Sorry for the inconvenient!<br><br>'. 
     2068                                                          '<b><i>ContactCenter Developer Team</i></b></p>'), 
     2069                                        'status' => 'fatal' 
     2070                                )); 
     2071                                return; 
     2072                        } 
     2073//                      print_r($data); 
     2074//                      echo '<br><br>'; 
     2075 
     2076                        $replacer = $data['commercialAnd']; 
     2077                        unset($data['commercialAnd']); 
     2078                        if (!is_string($replacer) or strpos($replacer, "'") or strpos($replacer, '"')) 
     2079                        { 
     2080                                echo serialize(array( 
     2081                                        'msg' => lang('Invalid \'&\' replacer! This may be an attempt to bypass Security! Action aborted!'), 
     2082                                        'status' => 'fatal' 
     2083                                )); 
     2084                                 
     2085                                return; 
     2086                        } 
     2087 
     2088                        if ($data['id_contact']) 
     2089                        { 
     2090                                $id = $data['id_contact']; 
     2091                                $id_photo = $id; 
     2092                                unset($data['id_contact']); 
     2093                        } 
     2094                        else 
     2095                        { 
     2096                                $id_photo = '_new_'; 
     2097                        } 
     2098 
     2099                        if ($data['owner']) 
     2100                        { 
     2101                                $owner = $data['owner']; 
     2102                                unset($data['owner']); 
     2103                        } 
     2104                        /*  
     2105                         * Process Photo, if available  
     2106                         */ 
     2107                        $sleep_count = 0; 
     2108                        $photo_ok = $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter'); 
     2109                        while($photo_ok[0]{0} !== 'o' and $photo_ok[1]{0} === 'y') 
     2110                        { 
     2111                                sleep(1); 
     2112                                $photo_ok = $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter'); 
     2113                                $sleep_count++; 
     2114 
     2115                                if ($sleep_count > 35) 
     2116                                { 
     2117                                        // TODO 
     2118                                        return; 
     2119                                } 
     2120                        } 
     2121                        $GLOBALS['phpgw']->session->appsession('ui_data.photo','contactcenter', array('wait', 'n')); 
     2122                         
     2123                        if (isset($this->page_info['photos'][$id_photo])) 
     2124                        { 
     2125                                if (array_search($this->page_info['photos'][$id_photo]['status'], array('changed', 'sync')) === false) 
     2126                                { 
     2127                                        echo serialize(array( 
     2128                                                'msg' => $this->page_info['photos'][$id_photo]['msg'], 
     2129                                                'status' => $this->page_info['photos'][$id_photo]['status'] 
     2130                                        )); 
     2131 
     2132                                        return; 
     2133                                } 
     2134 
     2135                                $data['photo'] = $this->page_info['photos'][$id_photo]['content']; 
     2136                                unset($this->page_info['photos'][$id_photo]); 
     2137                                $this->save_session(); 
     2138                        } 
     2139                         
     2140                        /* 
     2141                         * Arrange Date so it gets inserted correctly 
     2142                         */ 
     2143                          
     2144                        $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']; 
     2145                 
     2146                        $j = 0; 
     2147                        for ($i = 0; $i < 5; $i+=2) 
     2148                        { 
     2149                                switch($dateformat{$i}) 
     2150                                { 
     2151                                        case 'Y': 
     2152                                                $date[$j]['size'] = 4; 
     2153                                                $date[$j]['digit'] = 'Y'; 
     2154                                                break; 
     2155 
     2156                                        case 'm': 
     2157                                        case 'M': 
     2158                                                $date[$j]['size'] = 2; 
     2159                                                $date[$j]['digit'] = 'M'; 
     2160                                                break; 
     2161 
     2162                                        case 'd': 
     2163                                                $date[$j]['size'] = 2; 
     2164                                                $date[$j]['digit'] = 'D'; 
     2165                                } 
     2166                                $j++; 
     2167                        } 
     2168                        $datecount = 0; 
     2169 
     2170                        /* Verify Data and performs insertion/update */ 
     2171                        foreach($data as $field => &$value) 
     2172                        { 
     2173                                if ($value == '' or is_null($value)) 
     2174                                { 
     2175                                        unset($data[$field]); 
     2176                                        continue; 
     2177                                } 
     2178                                 
     2179                                switch($field) 
     2180                                { 
     2181                                        case 'alias': 
     2182                                        case 'given_names': 
     2183                                        case 'family_names': 
     2184                                        case 'names_ordered': 
     2185                                        case 'pgp_key': 
     2186                                        case 'notes': 
     2187                                        case 'photo': 
     2188                                                $value = urldecode( $value ); 
     2189                                                /* Do Nothing. This is just to make sure no invalid field is passed */ 
     2190                                                break; 
     2191                                         
     2192                                        case 'id_status': 
     2193                                        case 'id_prefix': 
     2194                                        case 'id_suffix': 
     2195                                                if ($data[$field] == 0) 
     2196                                                { 
     2197                                                        unset($data[$field]); 
     2198                                                } 
     2199                                                break; 
     2200                                         
     2201                                        case 'birthdate_0': 
     2202                                        case 'birthdate_1': 
     2203                                        case 'birthdate_2': 
     2204                                         
     2205                                                switch($date[$datecount]['digit']) 
     2206                                                { 
     2207                                                        case 'Y': 
     2208                                                                $date['value'][2] = (int) $data[$field]; 
     2209                                                                break; 
     2210 
     2211                                                        case 'M': 
     2212                                                                $date['value'][0] = (int) $data[$field]; 
     2213                                                                break; 
     2214 
     2215                                                        case 'D': 
     2216                                                                $date['value'][1] = (int) $data[$field]; 
     2217                                                                break; 
     2218                                                } 
     2219                                                unset($data[$field]); 
     2220                                                $datecount++; 
     2221 
     2222                                                if ($datecount != 3) 
     2223                                                { 
     2224                                                        break; 
     2225                                                } 
     2226                                                 
     2227                                                if (!checkdate($date['value'][0], $date['value'][1], $date['value'][2])) 
     2228                                                { 
     2229                                                        echo serialize(array( 
     2230                                                                'msg' => lang('Invalid Date'), 
     2231                                                                'status' => 'invalid_data' 
     2232                                                        )); 
     2233                                                        return; 
     2234                                                } 
     2235                                                 
     2236                                                $data['birthdate'] = $date['value'][2].'-'.$date['value'][0].'-'.$date['value'][1]; 
     2237                                                break; 
     2238 
     2239                                        case 'sex': 
     2240                                                if ($data[$field] !== 'M' and $data[$field] !== 'F') 
     2241                                                { 
     2242                                                        echo serialize(array( 
     2243                                                                'msg' => lang('Invalid Sex'), 
     2244                                                                'status' => 'invalid_data' 
     2245                                                        )); 
     2246                                                        return; 
     2247                                                } 
     2248                                                break; 
     2249 
     2250 
     2251                                        case 'addresses': 
     2252                                                /* Insert new cities/states */ 
     2253                                                if (isset($value['new_states'])) 
     2254                                                { 
     2255                                                        foreach($value['new_states'] as $type => $state_info) 
     2256                                                        { 
     2257                                                                $index = 'address'.$type; 
     2258                                                                 
     2259                                                                $id_state = $this->bo->catalog->add_state($state_info); 
     2260                                                                $data['addresses'][$index]['id_state'] = $id_state; 
     2261 
     2262                                                                if ($value['new_cities'][$type]) 
     2263                                                                { 
     2264                                                                        $value['new_cities'][$type]['id_state'] = $id_state; 
     2265                                                                } 
     2266                                                        } 
     2267 
     2268                                                        unset($data['addresses']['new_states']); 
     2269                                                } 
     2270 
     2271                                                if (isset($value['new_cities'])) 
     2272                                                { 
     2273                                                        foreach($value['new_cities'] as $type => $city_info) 
     2274                                                        { 
     2275                                                                $index = 'address'.$type; 
     2276                                                                 
     2277                                                                $id_city = $this->bo->catalog->add_city($city_info); 
     2278                                                                $data['addresses'][$index]['id_city'] = $id_city; 
     2279                                                        } 
     2280 
     2281                                                        unset($data['addresses']['new_cities']); 
     2282                                                } 
     2283 
     2284                                        break; 
     2285 
     2286                                        case 'connections': 
     2287                                                /* Does nothing... */ 
     2288                                                break; 
     2289 
     2290                                        default: 
     2291                                                echo serialize(array( 
     2292                                                        'msg' => lang('Invalid field: ').$field, 
     2293                                                        'status' => 'invalid_data' 
     2294                                                )); 
     2295                                                return; 
     2296                                } 
     2297                        } 
     2298 
     2299                        $code = '$id = $this->bo->catalog->'; 
     2300 
     2301                        if (!is_null($id) and $id !== '') 
     2302                        { 
     2303                                $code .= $code.'update_single_info($id, $data);'; 
     2304                                $result = array( 
     2305                                        'msg' => lang('Updated Successfully!'), 
     2306                                        'status' => 'ok' 
     2307                                ); 
     2308                        } 
     2309                        else 
     2310                        { 
     2311                                $code .= 'add_single_entry($data,'.$owner.');'; 
     2312                                $result = array( 
     2313                                        'msg' => lang('Entry Added Successfully!'), 
     2314                                        'status' => 'ok' 
     2315                                ); 
     2316                        } 
     2317                         
     2318                        eval($code); 
     2319 
     2320                        if (!($id)) 
     2321                        { 
     2322                                $result = array( 
     2323                                        'msg' => lang('Some problem occured when trying to insert/update contact information.<br>'. 
     2324                                                   'Report the problem to the Administrator.'), 
     2325                                        'status' => 'fail' 
     2326                                ); 
     2327                        } 
     2328 
     2329                        echo serialize($result); 
     2330} 
    20042331                /*! 
    20052332                 
  • trunk/contactcenter/js/cc.js

    r1280 r1496  
    3838\***********************************************/ 
    3939 
     40var owners = new Array(); 
     41var flag_compartilhado = false; 
     42var qtd_compartilhado = 0; 
     43 
    4044var CC_visual = 'table'; 
    4145/* Cards Variables */ 
     
    172176        Element("cc_conn_type_sel").disabled = true; 
    173177        Element("cc_conn_type_sel").selectedIndex = 0; 
     178        Element("cc_contact_sharing").style.display = 'none'; 
     179} 
     180 
     181function openFullAddShared(){ 
     182        if (flag_compartilhado) 
     183        { 
     184                if(!fullAddWin && !is_ie) 
     185                        __f(); 
     186 
     187                resetFullAdd(); 
     188                populateFullAddConst(); 
     189                fullAddWin.open(); 
     190                tabs._showTab('cc_contact_tab_0'); 
     191                Element("cc_conn_type_1").checked = false; 
     192                Element("cc_conn_type_2").checked = false; 
     193                Element("cc_conn_type_sel").disabled = true; 
     194                Element("cc_conn_type_sel").selectedIndex = 0; 
     195                Element("cc_contact_sharing").align = 'center'; 
     196                Element("cc_contact_sharing").style.display = 'block'; 
     197                Element("cc_contact_shared_types").disabled = true; 
     198                populateSharingSelect(); 
     199        } else 
     200        { 
     201                if(qtd_compartilhado != 0) 
     202                { 
     203                        ccTree.select(0.2); 
     204                        ccTree.setCatalog(0.2); 
     205                        if(!fullAddWin && !is_ie) 
     206                                __f(); 
     207                        resetFullAdd(); 
     208                        populateFullAddConst(); 
     209                        fullAddWin.open(); 
     210                        tabs._showTab('cc_contact_tab_0'); 
     211                        Element("cc_conn_type_1").checked = false; 
     212                        Element("cc_conn_type_2").checked = false; 
     213                        Element("cc_conn_type_sel").disabled = true; 
     214                        Element("cc_conn_type_sel").selectedIndex = 0; 
     215                        Element("cc_contact_sharing").aling = 'center'; 
     216                        Element("cc_contact_sharing").style.display = 'block'; 
     217                        Element("cc_contact_shared_types").disabled = true; 
     218                        populateSharingSelect(); 
     219                } else 
     220                        showMessage(Element('cc_msg_err_shared').value); 
     221        } 
    174222} 
    175223 
     
    180228function newContact(){ 
    181229        openFullAdd(); 
     230} 
     231function newSharedContact(){ 
     232        openFullAddShared(); 
    182233} 
    183234/************ Edit Contact *************/ 
     
    202253        Updates all the constant fields in the 
    203254        full add window, like Prefixes, Suffixes, 
    204         Countries and Types 
     255        Countries, Types and Shared catalogs 
    205256*/ 
     257 
     258function populateSharingSelect() 
     259{ 
     260        var handler = function(responseText) 
     261        { 
     262                var data = unserialize(responseText); 
     263                var sharers = Element('cc_contact_shared_types'); 
     264 
     265                if (typeof(data) != 'object') 
     266                { 
     267                        showMessage(Element('cc_msg_err_contacting_server').value); 
     268                        return; 
     269                } 
     270                 
     271                if (typeof(data[3]) == 'object') 
     272                { 
     273                        sharers.disabled = false; 
     274                        var i = 1; 
     275                        if (data[6].length != 0) 
     276                        { 
     277                                for (var j in data[6]) 
     278                                { 
     279                                        sharers.options[i] = new Option(data[6][j]['cn'], j); 
     280                                        owners[i] = j; 
     281                                        i++; 
     282                                } 
     283                        } else 
     284                                sharers.disabled = true; 
     285                        return; 
     286                } else 
     287                { 
     288                        showMessage(Element('cc_msg_err_contacting_server').value); 
     289                        fullAddWin.close(); 
     290                        return; 
     291                } 
     292 
     293        }; 
     294        Connector.newRequest('populateSharingSelect', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_cards_data', 'POST', handler); 
     295} 
     296 
    206297function populateFullAddConst() 
    207298{ 
     
    442533                CC_full_add_photo = true; 
    443534        } 
    444  
    445         setTimeout('postFullAddInfo()', 100); 
     535        if (Element('cc_contact_sharing').style.display == 'none') 
     536                setTimeout('postFullAddInfo()', 100); 
     537        else 
     538                setTimeout('postFullAddInfoShared()', 100); 
    446539} 
    447540 
     
    467560                updateCards(); 
    468561        }; 
    469  
    470562        Connector.newRequest('postFullAddInfo', CC_url+'post_full_add', 'POST', handler, getFullAddData()); 
     563} 
     564 
     565function postFullAddInfoShared() 
     566{ 
     567        var handler = function (responseText) 
     568        { 
     569                var data = unserialize(responseText); 
     570                if (typeof(data) != 'object') 
     571                { 
     572                        showMessage(Element('cc_msg_err_contacting_server').value); 
     573                        return; 
     574                } 
     575 
     576                if (data['status'] != 'ok') 
     577                { 
     578                        showMessage(data['msg']); 
     579                        return; 
     580                } 
     581 
     582                fullAddWin.close(); 
     583                updateCards(); 
     584        }; 
     585        Connector.newRequest('postFullAddInfoShared', CC_url+'post_full_add_shared', 'POST', handler, getFullAddData()); 
    471586} 
    472587 
     
    476591        var empty = true; 
    477592        var replacer = '__##AND##__'; 
    478          
     593 
    479594        data['commercialAnd'] = replacer; 
    480595         
     
    484599                data.length++; 
    485600        } 
    486  
     601         
     602        /* Owner do contato (Para o caso de adicao de contato compartilhado) */ 
     603        if (Element('cc_contact_sharing').style.display == 'block') 
     604        { 
     605                var index = Element('cc_contact_shared_types').selectedIndex; 
     606                data['owner'] = replaceComAnd(owners[index], replacer);  
     607                data.length++; 
     608        } 
     609         
    487610        /* Status: Full Added */ 
    488611        data['id_status'] = CC_STATUS_FULL_ADD; 
     
    580703        } 
    581704 
     705        var serial = serialize(data); 
    582706        return 'data=' + escape(serialize(data)); 
    583707} 
     
    585709function checkFullAdd() 
    586710{ 
     711 
     712        /* Checa se o listbox esta desativado ou é nulo, ou seja, não existe catálogos compartilhados com o user atual */ 
     713 
     714        if (!(Element('cc_contact_sharing').style.display == 'none' )) 
     715        { 
     716                if (Element('cc_contact_shared_types').disabled == true) 
     717                {        
     718                        showMessage('Nenhum catálogo compartilhado existente'); 
     719                        return false; 
     720                } 
     721                if (Element('cc_contact_shared_types').selectedIndex == 0) 
     722                { 
     723                        showMessage('Nenhum catálogo selecionado'); 
     724                        return false; 
     725                } 
     726        } 
     727         
    587728        /* Check Personal Data */ 
    588  
    589729        if (Element('cc_pd_given_names').value == '') 
    590730        { 
     
    16331773                return; 
    16341774        } 
    1635          
     1775 
    16361776        var handler = function (responseText) 
    16371777        { 
     
    19142054                                                                        Element(id+':'+data[2][k]).innerHTML = data[3][pos][k]; 
    19152055                                                                } 
    1916                                                                 if(data[3][pos][9]) 
    1917                                                                         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>";   
     2056                                                                if(data[3][pos][9]){ 
     2057                                                                        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>";  } 
    19182058                                                                break; 
    19192059                                                         
     
    23372477{ 
    23382478        var data  = new Array(); 
    2339  
     2479        flag_compartilhado = false; 
    23402480        if ( letter != CC_actual_letter ) 
    23412481        { 
     
    23602500                return; 
    23612501        } 
     2502 
    23622503 
    23632504        var handler = function (responseText) 
     
    23902531                if (typeof(data[3]) == 'object') 
    23912532                { 
     2533                        if (data[8] == 'bo_shared_people_manager') 
     2534                        { 
     2535                                flag_compartilhado = true; 
     2536                        } 
     2537                        else 
     2538                        { 
     2539                                flag_compartilhado = false; 
     2540                        } 
     2541                        qtd_compartilhado = data[9]; 
    23922542                        CC_npages = parseInt(data[0]); 
    23932543                        CC_actual_page = parseInt(data[1]);                      
  • trunk/contactcenter/js/ccMain.js

    r575 r1496  
    9191                submenu = []; 
    9292                textmenu = []; 
    93                          
    94                 textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_group"] 
    95                 textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_add_group_button"];             
     93 
     94                textmenu[0] = ["cc_msg_contact_qa","cc_msg_contact_full","cc_msg_contact_sh","cc_msg_group"]; 
     95                textmenu[1] = ["cc_quick_add", "cc_full_add_button", "cc_full_add_button_sh", "cc_add_group_button"]; 
    9696                function show(){ 
    9797                        clearTimeout(_timeout); 
     
    104104                         
    105105                if(document.getElementById) { 
     106 
    106107                        menu = document.getElementById("Layer1"); 
    107108                                 
     
    126127                ccAddGroup.associateAsButton(Element('cc_add_group_button')); 
    127128                Element("cc_full_add_button").onclick = newContact; 
    128                           
     129                Element("cc_full_add_button_sh").onclick = newSharedContact; 
     130 
    129131                         
    130132                ccQuickAdd.afterSave = function () 
  • trunk/contactcenter/js/ccQuickAddContact.js

    r285 r1496  
    4545                                }                                
    4646                        } 
    47                          
     47 
     48 
    4849                        el.innerHTML +='<div id="ccQAFuncitons" style="border: 0px solid black; width: 220px; height: 20px">' + 
    4950                                '<input title="' + Element('cc_qa_save').value + '"  type="button" onclick="ccQuickAddContact.send(\'' + id + '\');" value="' + Element('cc_qa_save').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 75px; width: 60px" />' + 
  • trunk/contactcenter/templates/default/api_common.tpl

    r1494 r1496  
    1515<input id="cc_msg_err_timeout" type="hidden" value="{cc_msg_err_timeout}" /> 
    1616<input id="cc_msg_err_serialize_data_unknown" type="hidden" value="{cc_msg_err_serialize_data_unknown}" /> 
     17<input id="cc_msg_err_shared" type="hidden" type="hidden" value="{cc_msg_err_shared}" /> 
    1718 
    1819<input id="cc_msg_err_empty_field" type="hidden" value="{cc_msg_err_empty_field}" /> 
  • trunk/contactcenter/templates/default/full_add.tpl

    r1158 r1496  
    162162</div> 
    163163<!-- _BOTTOM BUTTONS --> 
    164 <div align="center" id="cc_contact_tab_buttons" style="position: absolute; visibility: hidden; top: 250px; left: 0px; width: 498px; height: 32px; border: 0px solid black">      
     164<div align="center" id="cc_contact_tab_buttons" style="position: absolute; visibility: hidden; top: 250px; left: 0px; width: 498px; height: 64px; border: 0px solid black"> 
     165        <table class="row_off" align="center" width="498px" cellpadding="2" cellspacing="0" border="0"> 
     166                <tr class="row_off" id="cc_contact_sharing"> 
     167                        <td >{cc_contact_shared}: </td> 
     168                        <td colspan="2"> 
     169                                        <select id="cc_contact_shared_types" name="{cc_contact_shared}" style="width: 390px;"> 
     170                                                <option value="_NONE_">{cc_contact_shared_types}</option> 
     171                                        </select> 
     172                        </td> 
     173                </tr> 
     174        </table> 
    165175        <table class="row_off" align="center" width="498px" cellpadding="2" cellspacing="0" border="0"> 
    166176                <tr> 
     
    223233                                         'win_class': 'row_off', 
    224234                                         'width': '500px', 
    225                                          'height': '273px', 
     235                                         'height': '295px', 
    226236                                         'title_color': '#3978d6', 
    227237                                         'title': Element('cc_contact_title').value, 
     
    246256                        Element('cc_pd_select_photo_b').style.display='none';                    
    247257                } 
    248                  
    249258        }; 
    250259 
  • trunk/contactcenter/templates/default/index.tpl

    r1494 r1496  
    2121<input id="cc_msg_group" type="hidden" value="{cc_msg_group}"> 
    2222<input id="cc_msg_contact_full" type="hidden" value="{cc_msg_contact_full}"> 
     23<input id="cc_msg_contact_sh" type="hidden" value="{cc_msg_contact_sh}"> 
    2324<input id="cc_msg_contact_qa" type="hidden" value="{cc_msg_contact_qa}"> 
    2425<input id="cc_msg_card_remove" type="hidden" value="{cc_msg_card_remove}"> 
  • trunk/preferences/inc/class.uiaclprefs.inc.php

    r1409 r1496  
    200200                         
    201201                        if($acl_app=='contactcenter') { 
    202                                 $this->template->set_var("add_invisible", "style='display:none'"); 
    203202                                $this->template->set_var("private_invisible", "style='display:none'");                           
    204203                        } 
Note: See TracChangeset for help on using the changeset viewer.