Ignore:
Timestamp:
03/28/11 15:09:35 (13 years ago)
Author:
thiagoaos
Message:

Ticket #1684 - Corrigido mecanismo de ordenação do mobile.

Location:
branches/2.2/mobile/inc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/mobile/inc/class.common_functions.inc.php

    r3609 r3923  
    11<?php 
    2         /**************************************************************************\ 
    3         * eGroupWare                                                               * 
    4         * http://www.egroupware.org                                                * 
    5         * The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    * 
    6         * --------------------------------------------                             * 
    7         *  This program is free software; you can redistribute it and/or modify it * 
    8         *  under the terms of the GNU General Public License as published by the   * 
    9         *  Free Software Foundation; either version 2 of the License, or (at your  * 
    10         *  option) any later version.                                              * 
    11         \**************************************************************************/ 
     2/**************************************************************************\ 
     3* eGroupWare                                                               * 
     4* http://www.egroupware.org                                                * 
     5* The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    * 
     6* --------------------------------------------                             * 
     7*  This program is free software; you can redistribute it and/or modify it * 
     8*  under the terms of the GNU General Public License as published by the   * 
     9*  Free Software Foundation; either version 2 of the License, or (at your  * 
     10*  option) any later version.                                              * 
     11\**************************************************************************/ 
    1212 
    13         class common_functions 
     13class common_functions 
     14{ 
     15        function borkb($size, $enclosed = NULL)  
    1416        { 
    15             function borkb($size, $enclosed = NULL)  
    16             { 
    17                         if (!$size) 
     17                if (!$size) 
    1818                        $size = 0; 
    19          
    20                         if ($enclosed) 
    21                         { 
    22                                 $left = '('; 
    23                                 $right = ')'; 
     19 
     20                if ($enclosed) 
     21                { 
     22                        $left = '('; 
     23                        $right = ')'; 
     24                } 
     25 
     26                if ($size < 1024) 
     27                        $rstring = $left . $size . ' B' . $right; 
     28                else if ($size < 1048576) 
     29                        $rstring = $left . round($size/1024) . ' KB' . $right; 
     30                else if ($size < 1073741824) 
     31                        $rstring = $left . round($size/1024/1024) . ' MB' . $right; 
     32                else 
     33                        $rstring = $left . round($size/1024/1024/1024) . ' GB' . $right; 
     34 
     35                return $rstring; 
     36        } 
     37 
     38        function complete_string($str = "", $length = 10, $align = "R", $char = " ") { 
     39                if( $str == null ) 
     40                        $str = ""; 
     41                else  
     42                if( strlen($str) > $length ) { 
     43                        return substr($str, 0, $length); 
     44                } else if( strlen($str) == $length ) { 
     45                        return $str; 
     46                }                        
     47 
     48                $char = substr($char, 0, 1); 
     49                $complete_str = ""; 
     50 
     51                while( strlen($str) + strlen($complete_str) < $length  ) 
     52                        $complete_str .= $char; 
     53 
     54                if( $align == "L" ) 
     55                        return $str . $complete_str; 
     56                else 
     57                        return $complete_str . $str; 
     58        }                
     59 
     60        function strach_string($string,$size) { 
     61                return strlen($string)>$size ? substr($string,0,$size)."...": 
     62                $string; 
     63        } 
     64 
     65        /** 
     66        * Fixes the odd indexing of multiple file uploads from the format: 
     67        * 
     68        * $_FILES['field']['key']['index'] 
     69        * 
     70        * To the more standard and appropriate: 
     71        * 
     72        * $_FILES['field']['index']['key'] 
     73        * 
     74        * @param array $files 
     75        * @author Corey Ballou 
     76        * @link http://www.jqueryin.com 
     77        */ 
     78        function fixFilesArray(&$files) 
     79        { 
     80                $names = array( 'name' => 1, 'type' => 1, 'tmp_name' => 1, 'error' => 1, 'size' => 1); 
     81 
     82                foreach ($files as $key => $part) { 
     83                        // only deal with valid keys and multiple files 
     84                        $key = (string) $key; 
     85                        if (isset($names[$key]) && is_array($part)) { 
     86                                foreach ($part as $position => $value) { 
     87                                        $files[$position][$key] = $value; 
     88                                } 
     89                                // remove old key reference 
     90                                unset($files[$key]); 
    2491                        } 
    25          
    26                         if ($size < 1024) 
    27                                 $rstring = $left . $size . ' B' . $right; 
    28                         else if ($size < 1048576) 
    29                                 $rstring = $left . round($size/1024) . ' KB' . $right; 
    30                         else if ($size < 1073741824) 
    31                                 $rstring = $left . round($size/1024/1024) . ' MB' . $right; 
    32                         else 
    33                                 $rstring = $left . round($size/1024/1024/1024) . ' GB' . $right; 
    34          
    35                         return $rstring; 
    3692                } 
    37                  
    38                 function complete_string($str = "", $length = 10, $align = "R", $char = " ") { 
    39                         if( $str == null ) 
    40                                 $str = ""; 
    41                         else  
    42                                 if( strlen($str) > $length ) { 
    43                                         return substr($str, 0, $length); 
    44                                 } else if( strlen($str) == $length ) { 
    45                                         return $str; 
    46                                 }                        
    47          
    48                         $char = substr($char, 0, 1); 
    49                         $complete_str = ""; 
    50          
    51                 while( strlen($str) + strlen($complete_str) < $length  ) 
    52                     $complete_str .= $char; 
    53          
    54                 if( $align == "L" ) 
    55                         return $str . $complete_str; 
    56                 else 
    57                         return $complete_str . $str; 
    58                 }                
    59                  
    60                 function strach_string($string,$size) { 
    61                         return strlen($string)>$size ? substr($string,0,$size)."...": 
    62                                                                                 $string; 
    63                 } 
    64                  
    65                 /** 
    66                  * Fixes the odd indexing of multiple file uploads from the format: 
    67                  * 
    68                  * $_FILES['field']['key']['index'] 
    69                  * 
    70                  * To the more standard and appropriate: 
    71                  * 
    72                  * $_FILES['field']['index']['key'] 
    73                  * 
    74                  * @param array $files 
    75                  * @author Corey Ballou 
    76                  * @link http://www.jqueryin.com 
    77                  */ 
    78                 function fixFilesArray(&$files) 
    79                 { 
    80                     $names = array( 'name' => 1, 'type' => 1, 'tmp_name' => 1, 'error' => 1, 'size' => 1); 
    81                  
    82                     foreach ($files as $key => $part) { 
    83                         // only deal with valid keys and multiple files 
    84                         $key = (string) $key; 
    85                         if (isset($names[$key]) && is_array($part)) { 
    86                             foreach ($part as $position => $value) { 
    87                                 $files[$position][$key] = $value; 
    88                             } 
    89                             // remove old key reference 
    90                             unset($files[$key]); 
    91                         } 
    92                     } 
    93                 } 
    94                  
    95         } //end common class 
    96          
     93        } 
     94 
     95} //end common class 
     96 
    9797 
    9898?> 
  • branches/2.2/mobile/inc/class.ui_home.inc.php

    r3829 r3923  
    232232                                        $p->set_var('next_max_msgs',$mail_params['max_msgs']+10); 
    233233                                        $p->set_var('max_msgs',$mail_params['max_msgs']); 
    234  
     234                                         
    235235                                        $messages = $imap_functions->mobile_search($mail_params); 
    236                                         if($mail_params['max_msgs']>=$messages["total_msgs"]) 
     236                                        if($messages["has_more_msg"]) 
     237                                                $p->set_var('show_more_messages',"block"); 
     238                                        else 
    237239                                                $p->set_var('show_more_messages',"none"); 
    238                                         else 
    239                                                 $p->set_var('show_more_messages',"block"); 
    240                                         $p->set_var('mails',$ui_mobilemail->print_mails_list($messages)); 
     240                                        $p->set_var('mails',$ui_mobilemail->print_mails_list($messages['msgs'])); 
    241241                                } 
    242242                                else { 
  • branches/2.2/mobile/inc/class.ui_mobilemail.inc.php

    r3907 r3923  
    502502                                foreach($messages as $id => $message) { 
    503503                                         
    504                                         if(($id==='num_msgs') ||($id==='total_msgs')) 
     504                                        if(($id==='num_msgs') ||($id==='total_msgs') || ($id==='has_more_msg')) 
    505505                                                continue; 
    506506                                        if($message['from']['name']) 
Note: See TracChangeset for help on using the changeset viewer.