Changeset 1500


Ignore:
Timestamp:
10/07/09 16:34:46 (14 years ago)
Author:
eduardoalex
Message:

Ticket #681 - Criada a função para delegar evento

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/inc/class.bocalendar.inc.php

    r1492 r1500  
    379379                        $this->xmlrpc = is_object($GLOBALS['server']) && $GLOBALS['server']->last_method; 
    380380                } 
     381 
     382                function delegar($idDelegador,$idDelegado,$idEvento) { 
     383 
     384                        $this->so->cal->stream->lock(array("phpgw_cal_user")); 
     385                        $sql = "update phpgw_cal_user set cal_login = $idDelegado,cal_status='U' where cal_id=$idEvento  
     386                                        and cal_login=$idDelegador"; 
     387 
     388                        $this->so->cal->stream->query($sql,__LINE__,__FILE__,0,-1,true); 
     389 
     390                        $this->so->cal->stream->unlock(); 
     391                        $event = $this->so->read_entry($idEvento); 
     392                        /*foreach($event as $id=>$value) 
     393                                echo "<br>".$id."  --  ".$value; 
     394                        exit(0);*/ 
     395                        $this->send_update(MSG_ADDED,array($idDelegado => 'U'),$event,$event); 
     396                } 
     397 
    381398 
    382399          function load_lang() { 
     
    30213038                                                                                                                                                                  <input type='hidden' name='cal_id' value=$event[id]> 
    30223039                                                                                                                                                                   </form>"; 
     3040                                                                                                                                                                    
     3041                                                                                                                $lang5 = lang("To Delegate"); 
     3042                                                                                                                $varbuttom4 = "<form action='".$GLOBALS['phpgw_info']['server']['webserver_url']."/index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=$event[id]&date=$newall3&delegator=$tmpuid' method='POST'> 
     3043                                                                                                                                                                  <input type='submit' value='$lang5'> 
     3044                                                                                                                                                                   </form>"; 
    30233045                                                                                                        } 
    30243046                                                                                                        else 
     
    30283050                                                                                                                        $varbuttom2 = ""; 
    30293051                                                                                                                        $varbuttom3 = ""; 
     3052                                                                                                                        $varbuttom4 = ""; 
    30303053                                                                                                        } 
    30313054                                                                                        } 
     
    30753098                                                                'varbuttom1'            => $varbuttom1, 
    30763099                                                                'varbuttom2'            => $varbuttom2, 
    3077                                                                 'varbuttom3'            => $varbuttom3  
     3100                                                                'varbuttom3'            => $varbuttom3, 
     3101                                                                'varbuttom4'            => $varbuttom4 
    30783102                                                                 
    30793103                                                        ); 
  • trunk/calendar/inc/class.uicalendar.inc.php

    r1447 r1500  
    5757 
    5858                var $public_functions = array( 
     59                        'screen_delegate_event' => True, 
     60                        'delegate_event' => True, 
    5961                        'mini_calendar' => True, 
    6062                        'index' => True, 
     
    163165                } 
    164166 
     167                function screen_delegate_event($params=NULL) { 
     168                        $module_name = 'expressoMail'.(str_replace("1.","1_",$GLOBALS['phpgw_info']['server']['cal_expressoMail'])); 
     169 
     170                        $sb = CreateObject('phpgwapi.sbox2'); 
     171                        $jscal = CreateObject('phpgwapi.jscalendar');   // before phpgw_header() !!! 
     172                        unset($GLOBALS['phpgw_info']['flags']['noheader']); 
     173                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 
     174                        $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 
     175                        $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 
     176                        $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Calendar - Edit') : lang('Calendar - Add'); 
     177                        $GLOBALS['phpgw']->common->phpgw_header(); 
     178                         
     179                        $ldap_manager = CreateObject('contactcenter.bo_ldap_manager'); 
     180                        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; 
     181                        $_SESSION['phpgw_info']['expressomail']['user']['owner'] = $event['owner']; 
     182                        $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server']; 
     183                        $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null;          
     184                        $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 
     185                        $user_context = array(); 
     186                        foreach(explode(",",$GLOBALS['phpgw_info']['user']['account_dn']) as $i => $dn_part){ 
     187                                if($i) 
     188                                        $user_context[] = $dn_part; 
     189                        } 
     190                        // Prepara o contexto do usuario com sua OU raiz, pois ele pode pertencer a uma OU de nivel N. 
     191                        $user_ou = explode(",",str_replace($context,"",implode(",",$user_context)));                                                             
     192                        $user_context = trim(strtolower($user_ou[count($user_ou) - 2].",".$context)); 
     193                        // Fim           
     194                        // Verifica o tipo da visualização da árvore LDAP, configurado no admin da Agenda 
     195                        $recursive = $GLOBALS['phpgw_info']['server']['cal_type_tree_participants'] == '1' ? true : false; 
     196                        $combo_org = $this->get_organizations(trim(strtolower($context)),$user_context, $recursive); 
     197 
     198                        $var = array( 
     199                                "module_name" => $module_name, 
     200                                "lang_loading" => lang("Loading"), 
     201                                "lang_searching" => lang("Searching"), 
     202                                "lang_users" => lang("Users"), 
     203                                "lang_groups" => lang("Groups"), 
     204                                "recursive" => ($recursive)?"":"search", 
     205                                "options" => $combo_org , 
     206                                "id_event" => $_REQUEST["id_event"], 
     207                                "delegator" => $_REQUEST["delegator"], 
     208                                "lang_avaliable_users" => lang("Available Users and Groups"), 
     209                                "lang_search_for" => lang("Search for"), 
     210                                "lang_ou" => lang("Organization"), 
     211                                "date" => $_REQUEST["date"], 
     212                                "Delegate" => lang("Delegate"), 
     213                                'url_template' => 'calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'] 
     214                        );       
     215                         
     216                        if(isset($_REQUEST["error"])) 
     217                                $var['error_msg'] = lang("Problems delegating. Make sure you haven't delegated to a person that was also invited to the meeting"); 
     218                                 
     219                        $template = CreateObject('phpgwapi.Template',$this->template_dir); 
     220                        $template->set_file( 
     221                                                                array( 
     222                                                                        "screen"=>"delegate.tpl" 
     223                                                                        ) 
     224                                                           ); 
     225                        $template->set_var($var); 
     226                        print $template->fp('out','screen'); 
     227                } 
     228 
     229 
     230                function delegate_event($params=NULL) { 
     231                        $ldap = CreateObject('expressoMail1_2.ldap_functions'); 
     232                        $delegated = $ldap->uid2uidnumber($_REQUEST['delegated']); 
     233                        try { 
     234                                $this->bo->delegar($_REQUEST['delegator'], 
     235                                                $delegated,$_REQUEST['event']); 
     236                                header("Location: index.php?menuaction=calendar.uicalendar.day&date=".$_REQUEST['date']);                                                                
     237                        }catch(Exception $e) { 
     238                                header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1"); 
     239                        } 
     240 
     241                         
     242                } 
     243 
    165244                /* Public functions */ 
    166245 
     
    42364315                                { 
    42374316                                        $vars['participants']['data'][$user] = $parts[1].' (<a href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)'; 
     4317                                        $vars['participants']['data'][$user].='&nbsp;(<a href=\'index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event='.$event['id'].'&delegator='.$user.'&date='.$_REQUEST["date"].'\'>'.lang("Delegate event").'</a>)'; 
    42384318                                } 
    42394319                        } 
  • trunk/calendar/templates/classic/js/edit_exmail.js

    r1267 r1500  
    2121var agt = navigator.userAgent.toLowerCase(); 
    2222var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false; 
    23   
     23 
     24function optionFinderTimeout(obj) 
     25{ 
     26        clearTimeout(finderTimeout);     
     27        var oWait = document.getElementById("cal_span_searching"); 
     28        oWait.innerHTML = document.getElementById("txt_searching").value + '...'; 
     29        var finderTimeout = setTimeout("optionFinder('"+obj.id+"')",500); 
     30} 
     31function optionFinder(id) { 
     32        var oWait = document.getElementById("cal_span_searching"); 
     33        var oText = document.getElementById(id);                         
     34        var select_available_users_tmp = document.getElementById('user_list_in') 
     35        for(var i = 0;i < select_available_users_tmp.options.length; i++) 
     36                select_available_users_tmp.options[i--] = null; 
     37 
     38        var RegExp_name = new RegExp("\\b"+oText.value, "i"); 
     39 
     40        for(i = 0; i < select_available_users_clone.length; i++){ 
     41                if (RegExp_name.test(select_available_users_clone[i].text) || select_available_users_clone[i].value =="-1") 
     42                { 
     43                        sel = select_available_users_tmp.options; 
     44                        option = new Option(select_available_users_clone[i].text,select_available_users_clone[i].value); 
     45                        if( select_available_users_clone[i].value == "-1") option.disabled = true; 
     46                        sel[sel.length] = option; 
     47                } 
     48        }        
     49        oWait.innerHTML = '&nbsp;'; 
     50}        
     51         
     52/* 
     53        Semelhante a função get_avaiable_users, porém trás apenas usuários, ignorando os grupos... 
     54*/ 
     55function get_available_only_users(path,context,type) { 
     56        var handler_get_available_users2 = function(data) 
     57        {        
     58                select_available_users = document.getElementById('user_list_in'); 
     59                 
     60                for(var i=0; i<select_available_users.options.length; i++){ 
     61                        select_available_users.options[i] = null; 
     62                        i--; 
     63                } 
     64                var options = '###'; 
     65                if (data) { 
     66                         
     67                        options += '<option  value="-1" disabled>------------------- '+document.getElementById("txt_users").value+' ------------------ </option>' + data; 
     68                         
     69                        if(is_firefox_0) 
     70                                fixBugInnerSelect(select_available_users,options); 
     71                        else 
     72                                select_available_users.innerHTML = options; 
     73 
     74                        select_available_users.outerHTML = select_available_users.outerHTML; 
     75                        select_available_users.disabled = false; 
     76                        select_available_users_clone = document.getElementById('user_list_in').cloneNode(true); 
     77                        document.getElementById('cal_input_searchUser').value = ''; 
     78                } 
     79        }        
     80 
     81        document.getElementById('combo_org').value = context; 
     82        cExecute (path+'.ldap_functions.get_available_users2&valueAsUidNum=1&context='+context+'&type='+type, handler_get_available_users2);     
     83} 
     84 
    2485function get_available_users(filter,autoSearch) 
    2586//function get_available_users(path,context,type) 
     
    210271        loadScript(path+"/js/common_functions.js"); 
    211272        loadScript(path+"/js/QuickCatalogSearch.js"); 
    212         loadScript("calendar/templates/classic/js/over_fn_exmail.js"); 
     273        loadScript("calendar/templates/default/js/over_fn_exmail.js"); 
    213274        if(!contacts) 
    214275                cExecute (path+'.db_functions.get_dropdown_contacts', save_contacts); 
     
    389450        } 
    390451}; 
     452 
  • trunk/calendar/templates/default/js/edit_exmail.js

    r1268 r1500  
    2121var agt = navigator.userAgent.toLowerCase(); 
    2222var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false; 
    23   
     23         
     24/* 
     25        Semelhante a função get_avaiable_users, porém trás apenas usuários, ignorando os grupos... 
     26*/ 
     27function get_available_only_users(path,context,type) { 
     28        var handler_get_available_users2 = function(data) 
     29        {        
     30                select_available_users = document.getElementById('user_list_in'); 
     31                 
     32                for(var i=0; i<select_available_users.options.length; i++){ 
     33                        select_available_users.options[i] = null; 
     34                        i--; 
     35                } 
     36                var options = '###'; 
     37                if (data) { 
     38                         
     39                        options += '<option  value="-1" disabled>------------------- '+document.getElementById("txt_users").value+' ------------------ </option>' + data; 
     40                         
     41                        if(is_firefox_0) 
     42                                fixBugInnerSelect(select_available_users,options); 
     43                        else 
     44                                select_available_users.innerHTML = options; 
     45 
     46                        select_available_users.outerHTML = select_available_users.outerHTML; 
     47                        select_available_users.disabled = false; 
     48                        select_available_users_clone = document.getElementById('user_list_in').cloneNode(true); 
     49                        document.getElementById('cal_input_searchUser').value = ''; 
     50                } 
     51        }        
     52 
     53        document.getElementById('combo_org').value = context; 
     54        cExecute (path+'.ldap_functions.get_available_users2&valueAsUidNum=1&context='+context+'&type='+type, handler_get_available_users2);     
     55} 
     56 
    2457function get_available_users(filter,autoSearch) 
    2558//function get_available_users(path,context,type) 
     
    389422        } 
    390423}; 
     424 
  • trunk/expressoMail1_2/inc/class.ldap_functions.inc.php

    r1495 r1500  
    772772                return null; 
    773773        } 
     774         
     775        function uid2uidnumber($uid) 
     776        { 
     777                // do not follow the referral 
     778                $this->ldapRootConnect(false); 
     779                if ($this->ds) 
     780                { 
     781                        $filter="(&(phpgwAccountType=u)(uid=$uid))"; 
     782                        $justthese = array("uidnumber"); 
     783                        $sr=@ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 
     784                        if(!$sr) 
     785                                return false; 
     786                        $info = ldap_get_entries($this->ds, $sr); 
     787                        return $info[0]["uidnumber"][0]; 
     788                } 
     789                return false; 
     790        } 
    774791} 
    775792?> 
Note: See TracChangeset for help on using the changeset viewer.