Changeset 4688


Ignore:
Timestamp:
07/08/11 18:21:21 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #2083 - Melhorias no leitor de RSS do expressoMail

Location:
branches/2.2/expressoMail1_2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/class.rss.inc.php

    r3178 r4688  
    3333                exit; 
    3434        } 
    35         function getChannels(){ 
     35 
     36        private function createTableRSS() 
     37        { 
     38                $query = 'CREATE TABLE phpgw_userrss( uid INT NOT NULL,rss_url VARCHAR(1000),name varchar(50), PRIMARY KEY (uid,rss_url) );'; 
     39                 
     40                $GLOBALS['phpgw']->db->query($query); 
     41                 
     42                if ( $GLOBALS['phpgw']->db->Error ) 
     43                        return false; 
     44                else 
     45                        return true; 
     46        } 
     47         
     48        function getChannels() 
     49        { 
    3650                include('../header.inc.php'); 
    37                 $GLOBALS['phpgw']->db->query('SELECT rss_url,name FROM phpgw_userrss WHERE uid = '.$_SESSION['phpgw_session']['account_id']); 
    38                 while($GLOBALS['phpgw']->db->next_record()) 
    39                         $return[]=$GLOBALS['phpgw']->db->row(); 
    40                 return $return; 
     51                 
     52                $flag           = false; 
     53                $tableQuery = "select relname from pg_stat_user_tables order by relname;"; 
     54                 
     55                if( $GLOBALS['phpgw']->db->query( $tableQuery ) ) 
     56                { 
     57                        while( $GLOBALS['phpgw']->db->next_record() ) 
     58                        { 
     59                                $tables[] = $GLOBALS['phpgw']->db->row(); 
     60                        } 
     61                         
     62                        foreach( $tables as $tableName ) 
     63                        { 
     64                                if( strtolower( $tableName['relname'] ) === 'phpgw_userrss' ) 
     65                                { 
     66                                        $flag = true; 
     67                                } 
     68                        } 
     69                } 
     70                 
     71                if( !$flag ) 
     72                { 
     73                        $flag = $this->createTableRSS(); 
     74                } 
     75                 
     76                $query = 'SELECT rss_url,name FROM phpgw_userrss WHERE uid = '.$_SESSION['phpgw_session']['account_id'];                 
     77                 
     78                if( $GLOBALS['phpgw']->db->query($query) )  
     79                { 
     80                        while( $GLOBALS['phpgw']->db->next_record() ) 
     81                        { 
     82                                $return[] = $GLOBALS['phpgw']->db->row(); 
     83                        } 
     84                } 
     85 
     86                if( count($return) > 0 ) 
     87                        return $return; 
     88                else 
     89                        return ""; 
    4190        } 
    42         function addChannel($param){ 
     91         
     92        function addChannel($param) 
     93        { 
    4394                include('../header.inc.php'); 
    4495                $name = $GLOBALS['phpgw']->db->db_addslashes(htmlentities($param['name'])); 
     
    52103        } 
    53104 
    54         function removeChannel($param){ 
     105        function removeChannel($param) 
     106        { 
    55107                include('../header.inc.php'); 
    56108                $url = $GLOBALS['phpgw']->db->db_addslashes($param['url']); 
  • branches/2.2/expressoMail1_2/js/draw_api.js

    r4684 r4688  
    162162                { 
    163163 
    164                     if (data == null || typeof(data) == 'string') 
     164                        if ( data == null || typeof(data) == 'string') 
    165165                    {     
    166                             return; 
     166                                return false; 
    167167                    } 
    168168 
  • branches/2.2/expressoMail1_2/setup/setup.inc.php

    r4542 r4688  
    1616        $setup_info['expressoMail1_2']['tables'][]              = 'phpgw_expressomail_contacts'; 
    1717    $setup_info['expressoMail1_2']['tables'][]          = 'phpgw_certificados'; 
     18    $setup_info['expressoMail1_2']['tables'][]          = 'phpgw_userrss'; 
    1819        $setup_info['expressoMail1_2']['enable']        = 1; 
    1920 
  • branches/2.2/expressoMail1_2/setup/tables_current.inc.php

    r1035 r4688  
    3333            'ix' => array(), 
    3434            'uc' => array() 
     35                ), 
     36                'phpgw_userrss' => array( 
     37                        'fd' => array( 
     38                                'uid'           => array('type' => 'int', 'nullable' => false  ), 
     39                                'rss_url'       => array('type' => 'varchar', 'precision' => 1000 ), 
     40                                'name'          => array('type' => 'varchar', 'precision' => 50) 
     41                        ), 
     42                        'pk' => array('uid','rss_url'), 
     43                        'fk' => array(), 
     44            'ix' => array(), 
     45            'uc' => array() 
    3546                ) 
    3647        ); 
Note: See TracChangeset for help on using the changeset viewer.