Changeset 6474 for branches/2.3


Ignore:
Timestamp:
06/13/12 09:30:36 (12 years ago)
Author:
brunocosta
Message:

Ticket #2853 - Exibição de cotas de sub pastas IMAP.

Location:
branches/2.3/expressoMail1_2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php

    r6340 r6474  
    360360                    //reconstrói o email 
    361361                    $email = implode("", file($params['FILES'][0]['tmp_name'])); 
    362                     $email = preg_replace('/(?<!\r)\n/', "\r\n", $email); 
    363362                    //coloca o email na pasta selecionada 
    364363                    $status = @imap_append($this->mbox, $folder, $email); 
     
    10921091                                                                                $msg->encoding[ $msg_number ][ $values ] = 'quoted-printable';  
    10931092                                                                }  
    1094                                                                 /* 
     1093 
    10951094                                                                $body = $this->decodeBody(  
    1096                                                                                 imap_fetchbody(  
     1095                                                                        imap_fetchbody(  
    10971096                                                                                $this->mbox,  
    10981097                                                                                $msg_number,  
     
    11021101                                                                        $msg->encoding[ $msg_number ][ $values ],  
    11031102                                                                        $msg->charset[ $msg_number ][ $values ]  
    1104                                                                 ); 
    1105                                                                 */ 
    1106                                                                 $body = $this->decodeBody(  
    1107                                                                         imap_fetchbody(  
    1108                                                                                 $this->mbox,  
    1109                                                                                 $msg_number,  
    1110                                                                                 $attachment['part_in_msg'] . ".1",  
    1111                                                                                 FT_UID  
    1112                                                                         ),  
    1113                                                                         $msg->encoding[ $msg_number ][ $values ],  
    1114                                                                         $msg->charset[ $msg_number ][ $values ]  
    1115                                                                 ); 
    1116                                                                  
     1103                                                                );  
     1104 
    11171105                                                                if ( strtolower( $msg->structure[$msg_number]->parts[1]->parts[0]->subtype ) == 'plain' )  
    11181106                                                                {  
     
    15741562                            $this->db = new db_functions(); 
    15751563                             
    1576                             // TODO: testar se existe um certificado no banco e verificar qual ï¿œ o mais atual. 
     1564                            // TODO: testar se existe um certificado no banco e verificar qual é o mais atual. 
    15771565                            if(!$certificado->dados['EXPIRADO'] && !$certificado->dados['REVOGADO'] && count($certificado->erros_ssl) < 1) 
    15781566                                $this->db->insert_certificate(strtolower($certificado->dados['EMAIL']), $certificado->cert_assinante, $certificado->dados['SERIALNUMBER'], $certificado->dados['AUTHORITYKEYIDENTIFIER']); 
     
    18561844                        $i = 0; 
    18571845                        while (list($key, $val) = each($folders_list)) { 
    1858                             $status = imap_status($mbox_stream, $val->name, SA_UNSEEN); 
    1859  
    1860                             //$tmp_folder_id = explode("}", imap_utf7_decode($val->name)); 
    1861                             $tmp_folder_id = explode("}", $val->name ); 
    1862  
    1863                             $tmp_folder_id[1] = mb_convert_encoding( $tmp_folder_id[1], "ISO-8859-1", "UTF7-IMAP" ); 
    1864  
    1865                             if( $tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas') 
     1846                                $status = imap_status($mbox_stream, $val->name, SA_UNSEEN); 
     1847 
     1848                                //$tmp_folder_id = explode("}", imap_utf7_decode($val->name)); 
     1849                                $tmp_folder_id = explode("}", $val->name ); 
     1850 
     1851                                $folderUser = trim( strpos( $tmp_folder_id[1], $this->imap_delimiter , 5 ) ); 
     1852 
     1853                            $folderUser = trim( substr( $tmp_folder_id[1], 0, $folderUser ) ); 
     1854 
     1855                            $Permission = true; 
     1856 
     1857                            if( $folderUser != "INBOX" && $folderUser != "" ) 
    18661858                            { 
    1867                                     continue; 
     1859                               $Permission = imap_getacl( $mbox_stream, $folderUser ); 
    18681860                            } 
    1869                             $result[$i]['folder_unseen'] = $status->unseen; 
    1870                             $folder_id = $tmp_folder_id[1]; 
    1871                             $result[$i]['folder_id'] = $folder_id; 
    1872  
    1873                             $tmp_folder_parent = explode($this->imap_delimiter, $folder_id); 
    1874                             $result[$i]['folder_name'] = array_pop($tmp_folder_parent); 
    1875                             $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name']; 
    1876  
    1877                             if ($uid2cn && substr($folder_id,0,4) == 'user') { 
    1878                                     //$this->ldap = new ldap_functions(); 
    1879                                     if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])) { 
    1880                                             $result[$i]['folder_name'] = $cn; 
    1881                                     } 
    1882                             } 
    1883  
    1884                             $tmp_folder_parent = implode($this->imap_delimiter, $tmp_folder_parent); 
    1885                             $result[$i]['folder_parent'] = $tmp_folder_parent == 'INBOX' ? '' : $tmp_folder_parent; 
    1886  
    1887                             if (($val->attributes == 32) && ($result[$i]['folder_name'] != 'Inbox')) 
    1888                                     $result[$i]['folder_hasChildren'] = 1; 
    1889                             else 
    1890                                     $result[$i]['folder_hasChildren'] = 0; 
    1891  
    1892                             switch ($tmp_folder_id[1]) { 
    1893                                     case $inbox: 
    1894                                     case $sent: 
    1895                                     case $drafts: 
    1896                                     case $spam: 
    1897                                     case $trash: 
    1898                                             $resultDefault[]=$result[$i]; 
    1899                                             break; 
    1900                                     default: 
    1901                                             $resultMine[]=$result[$i]; 
     1861 
     1862                            if( $Permission ) 
     1863                            { 
     1864                                $tmp_folder_id[1] = mb_convert_encoding( $tmp_folder_id[1], "ISO-8859-1", "UTF7-IMAP" ); 
     1865 
     1866                                if( $tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas') 
     1867                                { 
     1868                                        continue; 
     1869                                } 
     1870                                $result[$i]['folder_unseen'] = $status->unseen; 
     1871                                $folder_id = $tmp_folder_id[1]; 
     1872                                $result[$i]['folder_id'] = $folder_id; 
     1873 
     1874                                $tmp_folder_parent = explode($this->imap_delimiter, $folder_id); 
     1875                                $result[$i]['folder_name'] = array_pop($tmp_folder_parent); 
     1876                                $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name']; 
     1877                         
     1878                                if ($uid2cn && substr($folder_id,0,4) == 'user') { 
     1879                                        //$this->ldap = new ldap_functions(); 
     1880                                        if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])) { 
     1881                                                $result[$i]['folder_name'] = $cn; 
     1882                                        } 
     1883                                } 
     1884 
     1885                                $tmp_folder_parent = implode($this->imap_delimiter, $tmp_folder_parent); 
     1886                                $result[$i]['folder_parent'] = $tmp_folder_parent == 'INBOX' ? '' : $tmp_folder_parent; 
     1887 
     1888                                if (($val->attributes == 32) && ($result[$i]['folder_name'] != 'Inbox')) 
     1889                                        $result[$i]['folder_hasChildren'] = 1; 
     1890                                else 
     1891                                        $result[$i]['folder_hasChildren'] = 0; 
     1892 
     1893                                switch ($tmp_folder_id[1]) { 
     1894                                        case $inbox: 
     1895                                        case $sent: 
     1896                                        case $drafts: 
     1897                                        case $spam: 
     1898                                        case $trash: 
     1899                                                $resultDefault[]=$result[$i]; 
     1900                                                break; 
     1901                                        default: 
     1902                                                $resultMine[]=$result[$i]; 
     1903                                } 
     1904 
    19021905                            } 
    19031906                            $i++; 
     
    32413244                else 
    32423245                        $folder_id = "INBOX"; 
    3243  
     3246                 
     3247                $folderQuotas = $this->get_folders_with_quota(); 
     3248                 
    32443249                if(!$this->mbox || !is_resource($this->mbox)) 
    32453250                        $this->mbox = $this->open_mbox(); 
     
    32693274                        $quotaPercent = (($quotaPercent)* 100 + .5 )* .01; 
    32703275                        } 
     3276                         
    32713277                        return array( 
    32723278                                'quota_percent' => floor($quotaPercent), 
    32733279                                'quota_used' => $quota_used, 
    3274                                 'quota_limit' =>  $quota_limit 
     3280                                'quota_limit' =>  $quota_limit, 
     3281                                'quota_folder' => $folderQuotas 
    32753282                        ); 
     3283                         
    32763284                } 
    32773285                else 
    32783286                        return array(); 
    32793287        } 
     3288 
     3289        function get_quotaroot($params){ 
     3290                if(!$this->mbox || !is_resource($this->mbox)) 
     3291                        $this->mbox = $this->open_mbox(); 
     3292 
     3293                $quota = imap_get_quotaroot($this->mbox, $params['folder']); 
     3294                if($this->mbox && is_resource($this->mbox)) 
     3295                        imap_close($this->mbox); 
     3296 
     3297                if (!$quota){ 
     3298                        return array( 
     3299                                'quota_percent' => 0, 
     3300                                'quota_used' => 0, 
     3301                                'quota_limit' =>  0, 
     3302                                'quota_root' => '' 
     3303                        ); 
     3304                } 
     3305 
     3306                // Additional Imap Class for not-implemented functions into PHP-IMAP extension. 
     3307                include_once("class.imapfp.inc.php"); 
     3308                $imapfp = new imapfp(); 
     3309 
     3310                if(!$imapfp->open($this->imap_server,$this->imap_port)) 
     3311                        return $imapfp->get_error(); 
     3312                if (!$imapfp->login($this->username,$this->password)) 
     3313                        return $imapfp->get_error(); 
     3314 
     3315                if ($imapfp->put_line($imapfp->tag." GETQUOTAROOT \"".$params['folder']."\"")) { 
     3316                        $response=$imapfp->get_server_responce(); 
     3317 
     3318                        if(substr($response,strpos($response,"$imapfp->tag ")+strlen($imapfp->tag)+1,2)!="OK") { 
     3319                                $imapfp->error= "Error : $response !<br>"; 
     3320                                return $imapfp->get_error(); 
     3321                        } 
     3322                } 
     3323                else 
     3324                { 
     3325                        $imapfp->error= "Error : Could not send User request. <br>"; 
     3326                        return $imapfp->get_error(); 
     3327                } 
     3328                $response_array = split("\r\n", $response); 
     3329                array_pop($response_array); 
     3330                array_pop($response_array); 
     3331                array_shift($response_array); 
     3332                
     3333                $response_array[0]=substr($response_array[0],strpos($response_array[0],"QUOTAROOT")); 
     3334                $quota['quota_root']=substr(str_replace("\"","",$response_array[0]),/*strlen("QUOTAROOT ... ")=*/11+strlen($params['folder'])); 
     3335                $imapfp->close(); 
     3336 
     3337                if(count($quota) && $quota['limit']) { 
     3338                        $quota_limit = $quota['limit']; 
     3339                        $quota_used  = $quota['usage']; 
     3340                        $quota_root  = $quota['quota_root']; 
     3341                        if($quota_used >= $quota_limit) 
     3342                        { 
     3343                                $quotaPercent = 100; 
     3344                        } 
     3345                        else 
     3346                        { 
     3347                        $quotaPercent = ($quota_used / $quota_limit)*100; 
     3348                        $quotaPercent = (($quotaPercent)* 100 + .5 )* .01; 
     3349                        } 
     3350                        return array( 
     3351                                'quota_percent' => floor($quotaPercent), 
     3352                                'quota_used' => $quota_used, 
     3353                                'quota_limit' =>  $quota_limit, 
     3354                                'quota_root' => $quota_root 
     3355                        ); 
     3356                } 
     3357                else 
     3358                        return array(); 
     3359        } 
    32803360 
    32813361        function send_notification($params){ 
     
    40564136            imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}".$folder)); 
    40574137        } 
    4058          
    4059         // string date ( string $format [, int $timestamp = time() ] ) 
    4060         // bool imap_append ( resource $imap_stream , string $mailbox , string $message [, string $options = NULL [, string $internal_date = NULL ]] ) 
    4061         // 'd-M-Y H:i:s O' 
    4062          
    4063         $return = array(); 
    40644138        if($timestamp){ 
    40654139            $tempDir = $_SESSION['phpgw_info']['server']['temp_dir']; 
     
    40734147            $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$folder, $source, "\\Seen"); 
    40744148        } 
    4075          
    4076         if (!empty($return['command'])) 
    4077         { 
    4078             list ($result, $msg) = explode(':',$return['command']); 
    4079             if (strtoupper($result) === 'NO') 
    4080             { 
    4081                 $return['error'] = $msg; 
    4082                 return $return; 
    4083             } 
    4084         } 
    4085          
    40864149        $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, SA_UIDNEXT); 
    40874150 
     
    41214184            if (version_compare(PHP_VERSION, '5.2.0', '>=')){ 
    41224185                if(!$source = base64_decode($source,true)) 
    4123                     return "error ".$source."Espaï¿œos ".$i; 
     4186                    return "error ".$source."Espaï¿?os ".$i; 
    41244187 
    41254188            } 
    41264189            else { 
    41274190                if(!$source = base64_decode($source)) 
    4128                     return "error ".$source."Espaï¿œos ".$i; 
     4191                    return "error ".$source."Espaï¿?os ".$i; 
    41294192            } 
    41304193 
     
    42124275                { 
    42134276                    $error[] = $ids[$index]; 
    4214                 } 
     4277            } 
    42154278                else  
    42164279                { 
    42174280                    $archived[] = $ids[$index]; 
    4218                 } 
     4281        } 
    42194282            } 
    42204283        } 
     
    42234286        { 
    42244287            $return['error'] = $error; 
    4225         } 
     4288    } 
    42264289        if (!empty($archived)) 
    42274290        { 
    42284291            $return['archived'] = $archived; 
    42294292        } 
    4230          
     4293 
    42314294        return $return; 
    42324295    } 
     
    42574320                    return $imapfp->get_error();  
    42584321 
    4259             $data = array();  
    4260             $quota_root = $this->get_quota(array('folder_id' => "INBOX"));  
    4261             $data["quota_root"] = $quota_root;  
     4322            $data = array(); 
     4323            $quota_root = $this->get_quota(array('folder_id' => "INBOX")); 
     4324            $data["quota_root"] = $quota_root; 
    42624325 
    42634326            foreach ($response_array as $idx=>$line) {  
     
    42664329                    list($folder,$size) = explode(";",$line2);  
    42674330                    $quota_used = str_replace(")","",$size);  
    4268                     $quotaPercent = (($quota_used / 1024) / $data["quota_root"]["quota_limit"])*100;  
     4331                    $quota=$this->get_quotaroot(array('folder' => $folder)); 
     4332                    $hasquota=($quota['quota_root']!=""); 
     4333                    $isroot=(strpos($quota['quota_root'],$folder)!==false); 
     4334                    $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0);  
    42694335                    $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP");  
    42704336                    if(!preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){  
     
    42744340                            $folder = preg_replace('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i','', $folder);  
    42754341 
    4276                     $data[$folder] = array("quota_percent" => sprintf("%.1f",round($quotaPercent,1)), "quota_used" => $quota_used);  
     4342                    $data[$folder] = array("quota_percent" => ($hasquota?sprintf("%.1f",round($quotaPercent,1)):''), "quota_used" => $quota_used, "quota_limit" => ($isroot && $folder!=$this->functions->getLang("Inbox")?$quota['quota_limit']:''));  
    42774343            }  
    42784344            $imapfp->close();  
    42794345            return $data;  
    4280     }   
     4346    } 
     4347        function get_folders_with_quota(){  
     4348 
     4349            // Additional Imap Class for not-implemented functions into PHP-IMAP extension.  
     4350            include_once("class.imapfp.inc.php");             
     4351            $imapfp = new imapfp();  
     4352 
     4353            if(!$imapfp->open($this->imap_server,$this->imap_port))  
     4354                    return $imapfp->get_error();              
     4355            if (!$imapfp->login( $this->username,$this->password ))  
     4356                    return $imapfp->get_error();  
     4357 
     4358            $response_array = $imapfp->get_mailboxes_size();  
     4359            if ($imapfp->error)  
     4360                    return $imapfp->get_error();  
     4361 
     4362            $data = array(); 
     4363 
     4364            foreach ($response_array as $idx=>$line) {  
     4365                    $line2 = str_replace('"', "", $line);  
     4366                    $line2 = str_replace(" /vendor/cmu/cyrus-imapd/size (value.shared ",";",str_replace("* ANNOTATION ","",$line2));  
     4367                    list($folder,$size) = explode(";",$line2);  
     4368                    $quota_used = str_replace(")","",$size);  
     4369                    $quota=$this->get_quotaroot(array('folder' => $folder)); 
     4370                    $hasquota=($quota['quota_limit']!=""); 
     4371                    $isroot=(strpos($quota['quota_root'],$folder)!==false); 
     4372                    if($isroot){ 
     4373                        $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0);  
     4374                        $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP");  
     4375                        if(preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){  
     4376                             $folder = preg_replace('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i','', $folder);  
     4377                             $data[$folder] = array("quota_percent" => ($hasquota?sprintf("%.1f",round($quotaPercent,1)):''), "quota_used" => $quota_used, "quota_limit" => ($isroot && $folder!=$this->functions->getLang("Inbox")?$quota['quota_limit']:''));  
     4378                             return $data; 
     4379                        }  
     4380                         
     4381                    } 
     4382            }  
     4383            $imapfp->close();  
     4384            return false;  
     4385    } 
     4386     
     4387     
    42814388} 
    42824389?> 
  • branches/2.3/expressoMail1_2/js/InfoQuota.js

    r4536 r6474  
    134134                for(var x in data) { 
    135135                        if(x == 'quota_root') continue;                          
    136                         q_used = borkb(data[x]['quota_used']); 
     136                        q_used = borkb(data[x]['quota_used'])+(data[x]['quota_limit']!=''?'/'+borkb(data[x]['quota_limit']*1024):''); 
    137137                        value = data[x]['quota_percent']; 
    138138                        td01 = document.createElement("TD"); 
  • branches/2.3/expressoMail1_2/js/draw_api.js

    r6064 r6474  
    33843384                div.innerHTML = '<span><font size="2" style="color:red"><strong>'+get_lang("Without Quota")+'</strong></font></span>'; 
    33853385        } 
    3386         else{ 
    3387         if(div) 
     3386        else 
     3387            if(div) 
    33883388                div.innerHTML = ''; 
    3389         value = data['quota_percent']; 
     3389         
     3390        value = data['quota_percent']; 
    33903391        q_used = data['quota_used']; 
    33913392        table = document.getElementById("table_quota"); 
    33923393        if(table) 
    33933394                table.parentNode.removeChild(table); 
    3394         table = document.createElement("TABLE"); 
    3395         tbody = document.createElement("TBODY"); 
    3396         table.appendChild(tbody); 
    3397         table.id = "table_quota"; 
    3398         table.width="102"; 
    3399         table.border="0"; 
    3400         table.cellSpacing = 0; 
    3401         table.cellPadding = 0; 
    3402  
    3403         //tr1 = document.createElement("TR"); 
    3404         td11 = document.createElement("TD"); 
    3405         td11.align="center"; 
    3406         td11.setAttribute("noWrap","true"); 
    3407         td11.innerHTML += '&nbsp;<span class="boxHeaderText">' + value+"% ("+borkb(q_used*1024)+"/"+borkb(q_limit*1024)+")</span>"; 
    3408         //tr1.appendChild(td11); 
    3409  
    3410         tr2 = document.createElement("TR"); 
    3411         td21 = document.createElement("TD"); 
    3412         td21.setAttribute("noWrap","true"); 
    3413         td21.height="15"; 
    3414         td22 = document.createElement("TD"); 
    3415         td21.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif"); 
    3416         table221 = document.createElement("TABLE"); 
    3417         tbody221 = document.createElement("TBODY"); 
    3418         table221.appendChild(tbody221); 
    3419         table221.style.width=value+"%"; 
    3420         td21.width="102"; 
    3421         table221.border="0"; 
    3422         table221.cellSpacing = 0; 
    3423         table221.cellPadding = 0; 
    3424         tr221 = document.createElement("TR"); 
    3425         td221 = document.createElement("TD"); 
    3426         td221.height="15"; 
    3427         if(value > 90) { 
    3428                 if(value >= 100) 
    3429                         write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); 
    3430                 else 
    3431                         write_msg(get_lang("Warning: Your Mailbox is almost full!")); 
    3432                 td221.setAttribute("background","templates/"+template+"/images/dsalert.gif"); 
    3433         } 
    3434         else if(value > 80) 
    3435                 td221.setAttribute("background","templates/"+template+"/images/dswarn.gif"); 
    3436         else 
    3437                 td221.className = 'dsused'; 
    3438  
    3439         td221.setAttribute("style","width: 100%"); 
    3440  
    3441         tr221.appendChild(td221); 
    3442         tbody221.appendChild(tr221); 
    3443         td21.appendChild(table221); 
    3444         tr2.appendChild(td21); 
    3445         tr2.appendChild(td11); 
    3446  
    3447         //tr2.appendChild(td1); 
    3448  
    3449         tbody.appendChild(tr2); //Desenho 
    3450         //tbody.appendChild(tr1); //Letras 
    3451         div.appendChild(table); 
    3452         } 
     3395                    table = document.createElement("TABLE"); 
     3396        tbody = document.createElement("TBODY"); 
     3397        table.appendChild(tbody); 
     3398        table.id = "table_quota"; 
     3399        table.width="102"; 
     3400        table.border="0"; 
     3401        table.cellSpacing = 0; 
     3402        table.cellPadding = 0; 
     3403        tr2 = document.createElement("TR");         
     3404 
     3405        if(data['quota_folder']){ 
     3406            td10 = document.createElement("TD"); 
     3407            td10.setAttribute("noWrap","true"); 
     3408            td10.innerHTML += '<span class="boxHeaderText">&nbsp;Raiz&nbsp</span>'; 
     3409            td11 = document.createElement("TD"); 
     3410            td11.setAttribute("noWrap","true"); 
     3411            td11.height="15"; 
     3412            td11.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif"); 
     3413            td11.width="102"; 
     3414            div11 = document.createElement("DIV"); 
     3415            div11.height="15"; 
     3416            if(value > 90) { 
     3417                    if(value >= 100) 
     3418                            write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); 
     3419                    else 
     3420                            write_msg(get_lang("Warning: Your Mailbox is almost full!")); 
     3421                    div11.setAttribute("background","templates/"+template+"/images/dsalert.gif"); 
     3422            } 
     3423            else if(value > 80) 
     3424                    div11.setAttribute("background","templates/"+template+"/images/dswarn.gif"); 
     3425            else 
     3426                    div11.className = 'dsused'; 
     3427            div11.setAttribute("style","width: 100%"); 
     3428            div11.className = 'dsused'; 
     3429            div11.style.width=value+"%"; 
     3430            div11.innerHTML += '&nbsp;'; 
     3431            div11.innerHTML += value+"%"; 
     3432            td11.appendChild(div11); 
     3433            td11.style.textAlign = 'left'; 
     3434            td12 = document.createElement("TD"); 
     3435            td12.align="center"; 
     3436            td12.setAttribute("noWrap","true"); 
     3437            td12.innerHTML += '&nbsp;<span class="boxHeaderText"> de ' + borkb(q_limit*1024)+"</span>"; 
     3438            tr2.appendChild(td10); 
     3439            tr2.appendChild(td11); 
     3440            tr2.appendChild(td12); 
     3441            //---------------- 
     3442            for(folder in data['quota_folder']){ 
     3443                folderName = "Arquivo Remoto"; 
     3444                qFolderUsed = data['quota_folder'][folder]['quota_used']; 
     3445                qFolderLimit = data['quota_folder'][folder]['quota_limit']; 
     3446                qfolderPercent = data['quota_folder'][folder]['quota_percent']; 
     3447            } 
     3448             
     3449            td20 = document.createElement("TD"); 
     3450            td20.setAttribute("noWrap","true"); 
     3451            td20.innerHTML += '<span class="boxHeaderText">&nbsp;-&nbsp;'+folderName+"&nbsp;</span>"; 
     3452             
     3453            td21 = document.createElement("TD"); 
     3454            td21.setAttribute("noWrap","true"); 
     3455            td21.height="15"; 
     3456            td21.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif"); 
     3457            td21.width="102"; 
     3458            div21 = document.createElement("DIV"); 
     3459            div21.height="15"; 
     3460            if(qfolderPercent > 90) { 
     3461                    if(qfolderPercent >= 100) 
     3462                            write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); 
     3463                    else 
     3464                            write_msg(get_lang("Warning: Your Mailbox is almost full!")); 
     3465                    div21.setAttribute("background","templates/"+template+"/images/dsalert.gif"); 
     3466            } 
     3467            else if(qfolderPercent > 80) 
     3468                    div21.setAttribute("background","templates/"+template+"/images/dswarn.gif"); 
     3469            else 
     3470                    div21.className = 'dsused'; 
     3471            div21.setAttribute("style","width: 100%"); 
     3472            div21.className = 'dsused'; 
     3473            div21.style.width=qfolderPercent+"%"; 
     3474            div21.innerHTML += '&nbsp;'; 
     3475            div21.innerHTML += qfolderPercent+"%"; 
     3476            td21.appendChild(div21); 
     3477            td21.style.textAlign = 'left'; 
     3478             
     3479            td22 = document.createElement("TD"); 
     3480            td22.align="center"; 
     3481            td22.setAttribute("noWrap","true"); 
     3482            td22.innerHTML += '&nbsp;<span class="boxHeaderText"> de ' + borkb(qFolderLimit*1024)+"</span>"; 
     3483             
     3484            tr2.appendChild(td20); 
     3485            tr2.appendChild(td21); 
     3486            tr2.appendChild(td22); 
     3487            //---------------- 
     3488         
     3489             
     3490        }else{         
     3491            //tr1 = document.createElement("TR"); 
     3492            td11 = document.createElement("TD"); 
     3493            td11.align="center"; 
     3494            td11.setAttribute("noWrap","true"); 
     3495            td11.innerHTML += '&nbsp;<span class="boxHeaderText">' + value+"% ("+borkb(q_used*1024)+"/"+borkb(q_limit*1024)+")</span>"; 
     3496            //tr1.appendChild(td11); 
     3497            td21 = document.createElement("TD"); 
     3498            td21.setAttribute("noWrap","true"); 
     3499            td21.height="15"; 
     3500            //td22 = document.createElement("TD"); 
     3501            td21.setAttribute("background","../phpgwapi/templates/"+template+"/images/dsunused.gif"); 
     3502            table221 = document.createElement("TABLE"); 
     3503            tbody221 = document.createElement("TBODY"); 
     3504            table221.appendChild(tbody221); 
     3505            table221.style.width=value+"%"; 
     3506            td21.width="102"; 
     3507            table221.border="0"; 
     3508            table221.cellSpacing = 0; 
     3509            table221.cellPadding = 0; 
     3510            tr221 = document.createElement("TR"); 
     3511            td221 = document.createElement("TD"); 
     3512            td221.height="15"; 
     3513            if(value > 90) { 
     3514                    if(value >= 100) 
     3515                            write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages.")); 
     3516                    else 
     3517                            write_msg(get_lang("Warning: Your Mailbox is almost full!")); 
     3518                    td221.setAttribute("background","templates/"+template+"/images/dsalert.gif"); 
     3519            } 
     3520            else if(value > 80) 
     3521                    td221.setAttribute("background","templates/"+template+"/images/dswarn.gif"); 
     3522            else 
     3523                    td221.className = 'dsused'; 
     3524 
     3525            td221.setAttribute("style","width: 100%"); 
     3526 
     3527            tr221.appendChild(td221); 
     3528            tbody221.appendChild(tr221); 
     3529            td21.appendChild(table221); 
     3530            tr2.appendChild(td21); 
     3531            tr2.appendChild(td11); 
     3532            //tr2.appendChild(td1); 
     3533        } 
     3534    tbody.appendChild(tr2); //Desenho 
     3535    //tbody.appendChild(tr1); //Letras 
     3536    div.appendChild(table); 
     3537         
    34533538} 
    34543539 
Note: See TracChangeset for help on using the changeset viewer.