Changeset 1709


Ignore:
Timestamp:
11/26/09 10:27:48 (14 years ago)
Author:
eduardoalex
Message:

Ticket #787 - Adicionada funcao mobile_search em imapfunctions para busca de emails no mobile

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r1707 r1709  
    29342934                return $return; 
    29352935        } 
     2936         
     2937         
     2938        function mobile_search($params) 
     2939        { 
     2940                include("class.imap_attachment.inc.php"); 
     2941                $imap_attachment = new imap_attachment(); 
     2942                $criterias = array ("TO","SUBJECT","FROM","CC"); 
     2943                $return = array(); 
     2944                $folders = $this->get_folders_list(); 
     2945                $num_msgs = 0; 
     2946                                           
     2947                foreach($folders as $id =>$folder) 
     2948                { 
     2949                        if(strpos($folder['folder_id'],'user')===false && is_array($folder)) { 
     2950                                foreach($criterias as $criteria_fixed) 
     2951                    { 
     2952                        $_filter = $criteria_fixed . ' "'.$params['filter'].'"'; 
     2953                                        $mbox_stream = $this->open_mbox($folder['folder_name']); 
     2954         
     2955                                        $messages = imap_search($mbox_stream, $_filter, SE_UID); 
     2956                                         
     2957                                        if ($messages == ''){ 
     2958                                                if($mbox_stream) 
     2959                                                        imap_close($mbox_stream); 
     2960                                                continue;        
     2961                                        } 
     2962                                                                         
     2963                                        foreach($messages as $msg_number) 
     2964                                        {                                        
     2965                                                $temp = $this->get_info_head_msg($msg_number); 
     2966                                                if(!$temp) 
     2967                                                        return false; 
     2968                 
     2969                                                $return[$num_msgs] = $temp; 
     2970                                                $num_msgs++; 
     2971                                        } 
     2972                                        $return['num_msgs'] = $num_msgs; 
     2973                                         
     2974                                        if($mbox_stream) 
     2975                                                imap_close($mbox_stream); 
     2976                                } 
     2977                        } 
     2978                                 
     2979                } 
     2980                return $return; 
     2981        } 
    29362982 
    29372983        function delete_and_show_previous_message($params) 
  • trunk/mobile/inc/class.mobiletemplate.inc.php

    r1499 r1709  
    8181                                'account_lid'   => $GLOBALS['phpgw_info']['user']['account_lid'], 
    8282                                'lang_logout'   => lang('Logout'), 
    83                                 'template_set'  => $GLOBALS['phpgw_info']['server']['template_set'] 
     83                                'template_set'  => $GLOBALS['phpgw_info']['server']['template_set'], 
     84                                'lang_search'   => lang('Search')                                
    8485                        );               
    8586                        $this->template->set_var($var);          
  • trunk/mobile/inc/class.ui_mobilemail.inc.php

    r1474 r1709  
    428428                        $this->pages = ceil($this->number_of_messages/$this->messages_per_page); 
    429429                        $page = $this->current_page; 
    430  
    431                         $params = array( 
    432                                 'folder'                        => $this->folders[$this->current_folder]['folder_id'], 
    433                                 'msg_range_begin'       => $this->current_page * $this->messages_per_page - ($this->messages_per_page - 1), 
    434                                 'msg_range_end'         => $this->current_page * $this->messages_per_page, 
    435                                 'sort_box_type'         => 'SORTARRIVAL', 
    436                                 'sort_box_reverse'      => 1 
    437                         ); 
    438  
    439                         $messages = $this->imap_functions->get_range_msgs2($params); 
     430                         
     431                        if($_POST["searchEmail"]){ 
     432                                $params = array( 
     433                                        'filter'                        => $_POST["searchEmail"] 
     434                                        ); 
     435 
     436                                $messages = $this->imap_functions->mobile_search($params); 
     437                        }else{ 
     438                                $params = array( 
     439                                        'folder'                        => $this->folders[$this->current_folder]['folder_id'], 
     440                                        'msg_range_begin'       => $this->current_page * $this->messages_per_page - ($this->messages_per_page - 1), 
     441                                        'msg_range_end'         => $this->current_page * $this->messages_per_page, 
     442                                        'sort_box_type'         => 'SORTARRIVAL', 
     443                                        'sort_box_reverse'      => 1 
     444                                ); 
     445 
     446                                $messages = $this->imap_functions->get_range_msgs2($params); 
     447                        } 
    440448                        $this->print_mails_list($messages); 
    441449                        $this->print_page_navigation($this->pages, $this->current_page); 
  • trunk/mobile/templates/celepar/home.tpl

    r623 r1709  
    1010<body style="background-color:white !important"> 
    1111<p>&nbsp;&nbsp;<strong>{fullname}: [{account_lid}]</strong></p> 
     12<form action="index.php?menuaction=mobile.ui_mobilemail.mail_list" method="post"> 
     13<p>&nbsp;&nbsp;<input type="text" size="15" name="searchEmail"/><br/> 
     14&nbsp;&nbsp;<input type="submit" id="btnSearch" value="{lang_search}"/></p> 
     15</form> 
    1216<hr /> 
    1317<p> 
  • trunk/mobile/templates/default/home.tpl

    r1474 r1709  
    1212<!-- END mobile_home_content --> 
    1313<p>&nbsp;&nbsp;<strong>{fullname}: [{account_lid}]</strong></p> 
     14<form action="index.php?menuaction=mobile.ui_mobilemail.mail_list" method="post"> 
     15<p>&nbsp;&nbsp;<input type="text" size="15" name="searchEmail"/><br/> 
     16&nbsp;&nbsp;<input type="submit" id="btnSearch" value="{lang_search}"/></p> 
     17</form> 
    1418<hr /> 
    1519<!-- TODO: Yep! Deveria ser flexível, não hardcoded do jeito que tá --> 
Note: See TracChangeset for help on using the changeset viewer.