source: trunk/news_admin/setup/tables_update.inc.php @ 45

Revision 45, 5.7 KB checked in by niltonneto, 17 years ago (diff)

Implementação do FCKEDITOR na edição de artigos no news_admin, para permitir texto rico.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare - Webpage news admin                                          *
4        * http://www.egroupware.org                                                *
5        * --------------------------------------------                             *
6        *  This program is free software; you can redistribute it and/or modify it *
7        *  under the terms of the GNU General Public License as published by the   *
8        *  Free Software Foundation; either version 2 of the License, or (at your  *
9        *  option) any later version.                                              *
10        * --------------------------------------------                             *
11        * This program was sponsered by Golden Glair productions                   *
12        * http://www.goldenglair.com                                               *
13        \**************************************************************************/
14
15        /* $Id$ */
16
17        $test[] = '0.0.1';
18        function news_admin_upgrade0_0_1()
19        {
20                global $setup_info;
21
22                $setup_info['news_admin']['currentver'] = '0.8.1';
23                return $setup_info['news_admin']['currentver'];
24        }
25
26        $test[] = '0.8.1';
27        function news_admin_upgrade0_8_1()
28        {
29                global $setup_info, $phpgw_setup;
30
31                $phpgw_setup->oProc->RenameTable('webpage_news','phpgw_news');
32
33                $setup_info['news_admin']['currentver'] = '0.8.1.001';
34                return $setup_info['news_admin']['currentver'];
35        }
36
37        $test[] = '0.8.1.001';
38        function news_admin_upgrade0_8_1_001()
39        {
40                global $setup_info, $phpgw_setup;
41
42                $phpgw_setup->oProc->AddColumn('phpgw_news','news_cat',array('type' => 'int','precision' => 4,'nullable' => True));
43                $phpgw_setup->oProc->query("update phpgw_news set news_cat='0'",__LINE__,__FILE__);
44
45                $setup_info['news_admin']['currentver'] = '0.8.1.002';
46                return $setup_info['news_admin']['currentver'];
47        }
48
49        $test[] = '0.8.1.002';
50        function news_admin_upgrade0_8_1_002()
51        {
52                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_teaser',array(
53                        'type' => 'varchar',
54                        'precision' => '255',
55                        'nullable' => True
56                ));
57
58
59                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.500';
60                return $GLOBALS['setup_info']['news_admin']['currentver'];
61        }
62
63        $test[] = '0.9.14.500';
64        function news_admin_upgrade0_9_14_500()
65        {
66                $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_news_export',array(
67                        'fd' => array(
68                                'cat_id' => array('type' => 'int','precision' => '4','nullable' => False),
69                                'export_type' => array('type' => 'int','precision' => '2','nullable' => True),
70                                'export_itemsyntax' => array('type' => 'int','precision' => '2','nullable' => True),
71                                'export_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
72                                'export_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
73                                'export_description' => array('type' => 'text', 'nullable' => True),
74                                'export_img_title' => array('type' => 'varchar','precision' => '255','nullable' => True),
75                                'export_img_url' => array('type' => 'varchar','precision' => '255','nullable' => True),
76                                'export_img_link' => array('type' => 'varchar','precision' => '255','nullable' => True),
77                        ),
78                        'pk' => array('cat_id'),
79                        'fk' => array(),
80                        'ix' => array(),
81                        'uc' => array()
82                ));
83
84                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.501';
85                return $GLOBALS['setup_info']['news_admin']['currentver'];
86        }
87
88        $test[] = '0.9.14.501';
89        function news_admin_upgrade0_9_14_501()
90        {
91                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_begin',array(
92                        'type' => 'int','precision' => '4','nullable' => True
93                ));
94                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','news_end',array(
95                        'type' => 'int','precision' => '4','nullable' => True
96                ));
97                $db2 = $GLOBALS['phpgw_setup']->db;
98                $GLOBALS['phpgw_setup']->oProc->query('SELECT news_id,news_status FROM phpgw_news');
99                while($GLOBALS['phpgw_setup']->oProc->next_record())
100                {
101                        $unixtimestampmax = 2147483647;
102                        $db2->query('UPDATE phpgw_news SET news_begin=news_date,news_end=' .
103                                (($GLOBALS['phpgw_setup']->oProc->f('news_status') == 'Active') ? $unixtimestampmax : 'news_date') .
104                                ' WHERE news_id=' . $GLOBALS['phpgw_setup']->oProc->f('news_id'));
105                }
106                $newtbldef = array(
107                        'fd' => array(
108                                'news_id' => array('type' => 'auto','nullable' => False),
109                                'news_date' => array('type' => 'int','precision' => '4','nullable' => True),
110                                'news_subject' => array('type' => 'varchar','precision' => '255','nullable' => True),
111                                'news_submittedby' => array('type' => 'varchar','precision' => '255','nullable' => True),
112                                'news_content' => array('type' => 'blob','nullable' => True),
113                                'news_begin' => array('type' => 'int','precision' => '4','nullable' => True),
114                                'news_end' => array('type' => 'int','precision' => '4','nullable' => True),
115                                'news_cat' => array('type' => 'int','precision' => '4','nullable' => True),
116                                'news_teaser' => array('type' => 'varchar','precision' => '255','nullable' => True)
117                        ),
118                        'pk' => array('news_id'),
119                        'fk' => array(),
120                        'ix' => array('news_date','news_subject'),
121                        'uc' => array()
122                );
123                $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_news',$newtbldef,'news_status');
124
125                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.502';
126                return $GLOBALS['setup_info']['news_admin']['currentver'];
127        }
128
129
130        $test[] = '0.9.14.502';
131        function news_admin_upgrade0_9_14_502()
132        {
133                $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_news','is_html',array(
134                        'type' => 'int',
135                        'precision' => '2',
136                        'nullable' => False,
137                        'default' => '0'
138                ));
139
140
141                $GLOBALS['setup_info']['news_admin']['currentver'] = '0.9.14.503';
142                return $GLOBALS['setup_info']['news_admin']['currentver'];
143        }
144
145
146        $test[] = '0.9.14.503';
147        function news_admin_upgrade0_9_14_503()
148        {
149                $GLOBALS['setup_info']['news_admin']['currentver'] = '1.0.0';
150                return $GLOBALS['setup_info']['news_admin']['currentver'];
151        }
152?>
Note: See TracBrowser for help on using the repository browser.