phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: sitemgr/setup default_records.inc.php,NONE,1.1 s


From: Michael Totschnig <address@hidden>
Subject: [Phpgroupware-cvs] CVS: sitemgr/setup default_records.inc.php,NONE,1.1 setup.inc.php,1.9,1.10 tables_current.inc.php,1.7,1.8 tables_update.inc.php,1.6,1.7
Date: Thu, 16 Jan 2003 22:37:55 -0500

Update of /cvsroot/phpgroupware/sitemgr/setup
In directory subversions:/tmp/cvs-serv24731/setup

Modified Files:
        setup.inc.php tables_current.inc.php tables_update.inc.php 
Added Files:
        default_records.inc.php 
Log Message:
First commit of a new modularized architecture for sitemgr 


--- NEW FILE ---
<?php
        foreach (array('html','meta','index','toc') as $module)
        {
                $oProc->query("INSERT INTO phpgw_sitemgr_modules 
(app_name,module_name) VALUES ('sitemgr','$module')",__LINE__,__FILE__);
                $module_id = 
$oProc->m_odb->get_last_insert_id('phpgw_sitemgr_modules','module_id');
                $oProc->query("INSERT INTO phpgw_sitemgr_active_modules 
(area,cat_id,module_id) VALUES ('__PAGE__',0,$module_id)",__LINE__,__FILE__);
        }
        $oProc->query("select config_value FROM phpgw_config WHERE 
config_name='webserver_url'");
        $oProc->next_record();
        $siteurl = $oProc->f('config_value') . SEP . 'sitemgr' . SEP . 
'sitemgr-site' . SEP;
        $oProc->query("INSERT INTO phpgw_sitemgr_preferences (name,value) 
VALUES ('sitemgr-site-url','$siteurl')");
        $sitedir = PHPGW_INCLUDE_ROOT . SEP . 'sitemgr' . SEP . 'sitemgr-site';
        $oProc->query("INSERT INTO phpgw_sitemgr_preferences (name,value) 
VALUES ('sitemgr-site-dir','$sitedir')");
        $oProc->query("INSERT INTO phpgw_sitemgr_preferences (name,value) 
VALUES ('themesel','phpgroupware')");
        $oProc->query("INSERT INTO phpgw_sitemgr_preferences (name,value) 
VALUES ('sitelanguages','en')");

Index: setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/setup.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** setup.inc.php       6 Dec 2002 04:56:00 -0000       1.9
--- setup.inc.php       17 Jan 2003 03:37:52 -0000      1.10
***************
*** 14,20 ****
        $setup_info['sitemgr']['name']      = 'sitemgr';
        $setup_info['sitemgr']['title']     = 'SiteMgr Web Content Manager';
!       $setup_info['sitemgr']['version']   = '0.9.14.006';
        $setup_info['sitemgr']['app_order'] = 8;
!       $setup_info['sitemgr']['tables']    = 
array('phpgw_sitemgr_pages','phpgw_sitemgr_pages_lang','phpgw_sitemgr_categories_lang','phpgw_sitemgr_blocks','phpgw_sitemgr_preferences');
        $setup_info['sitemgr']['enable']    = 1;
  
--- 14,20 ----
        $setup_info['sitemgr']['name']      = 'sitemgr';
        $setup_info['sitemgr']['title']     = 'SiteMgr Web Content Manager';
!       $setup_info['sitemgr']['version']   = '0.9.15.001';
        $setup_info['sitemgr']['app_order'] = 8;
!       $setup_info['sitemgr']['tables']    = 
array('phpgw_sitemgr_pages','phpgw_sitemgr_pages_lang','phpgw_sitemgr_categories_lang','phpgw_sitemgr_preferences','phpgw_sitemgr_modules','phpgw_sitemgr_content','phpgw_sitemgr_content_lang','phpgw_sitemgr_active_modules','phpgw_sitemgr_properties');
        $setup_info['sitemgr']['enable']    = 1;
  

Index: tables_current.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/tables_current.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** tables_current.inc.php      6 Dec 2002 04:56:00 -0000       1.7
--- tables_current.inc.php      17 Jan 2003 03:37:52 -0000      1.8
***************
*** 28,36 ****
                'phpgw_sitemgr_pages_lang' => array(
                        'fd' => array(
!                               'page_id' => array('type' => 'auto', 'nullable' 
=> false),
                                'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
!                               'title' => array('type' => 'varchar', 
'precision' => 256),
!                               'subtitle' => array('type' => 'varchar', 
'precision' => 256),
!                               'content' => array('type' => 'text')
                        ),
                        'pk' => array('page_id','lang'),
--- 28,35 ----
                'phpgw_sitemgr_pages_lang' => array(
                        'fd' => array(
!                               'page_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false),
                                'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
!                               'title' => array('type' => 'varchar', 
'precision' => 255),
!                               'subtitle' => array('type' => 'varchar', 
'precision' => 255)
                        ),
                        'pk' => array('page_id','lang'),
***************
*** 41,48 ****
                'phpgw_sitemgr_categories_lang' => array(
                        'fd' => array(
!                               'cat_id' => array('type' => 'auto', 'nullable' 
=> false),
                                'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
                                'name' => array('type' => 'varchar', 
'precision' => 100),
!                               'description' => array('type' => 'varchar', 
'precision' => 256)
                        ),
                        'pk' => array('cat_id','lang'),
--- 40,47 ----
                'phpgw_sitemgr_categories_lang' => array(
                        'fd' => array(
!                               'cat_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false),
                                'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
                                'name' => array('type' => 'varchar', 
'precision' => 100),
!                               'description' => array('type' => 'varchar', 
'precision' => 255)
                        ),
                        'pk' => array('cat_id','lang'),
***************
*** 51,62 ****
                        'uc' => array()
                ),
!               'phpgw_sitemgr_blocks' => array(
                        'fd' => array(
                                'block_id' => array('type' => 'auto', 
'nullable' => false),
!                               'side' => array('type' => 'int', 'precision' => 
4),
!                               'pos' => array('type' => 'int', 'precision' => 
4),
!                               'filename' => array('type' => 'varchar', 
'precision' => 300),
!                               'title' => array('type' => 'varchar', 
'precision' => 256),
!                               'description' => array('type' => 'varchar', 
'precision' => 256),
                                'view' => array('type' => 'int', 'precision' => 
4),
                                'actif' => array('type' => 'int', 'precision' 
=> 2)
--- 50,86 ----
                        'uc' => array()
                ),
!               'phpgw_sitemgr_preferences' => array(
!                       'fd' => array(
!                               'pref_id' => array('type' => 'auto', 'nullable' 
=> false),
!                               'name' => array('type' => 'varchar', 
'precision' => 255),
!                               'value' => array('type' => 'text')
!                       ),
!                       'pk' => array('pref_id'),
!                       'fk' => array(),
!                       'ix' => array(),
!                       'uc' => array()
!               ),
!               'phpgw_sitemgr_modules' => array(
!                       'fd' => array(
!                               'module_id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
!                               'app_name' => array('type' => 'varchar', 
'precision' => 25),
!                               'module_name' => array('type' => 'varchar', 
'precision' => 25),
!                               'description' => array('type' => 'varchar', 
'precision' => 255)
!                       ),
!                       'pk' => array('module_id'),
!                       'fk' => array(),
!                       'ix' => array(),
!                       'uc' => array()
!               ),
!               'phpgw_sitemgr_content' => array(
                        'fd' => array(
                                'block_id' => array('type' => 'auto', 
'nullable' => false),
!                               'area' => array('type' => 'varchar', 
'precision' => 50),
!                               //if page_id != NULL scope=page, elseif cat_id 
!= NULL scope=category, else scope=site
!                               'cat_id' => array('type' => 'int', 'precision' 
=> 4),
!                               'page_id' => array('type' => 'int', 'precision' 
=> 4),
!                               'module_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => false),
!                               'arguments' => array('type' => 'text'),
!                               'sort_order' => array('type' => 'int', 
'precision' => 4),
                                'view' => array('type' => 'int', 'precision' => 
4),
                                'actif' => array('type' => 'int', 'precision' 
=> 2)
***************
*** 67,81 ****
                        'uc' => array()
                ),
!               'phpgw_sitemgr_preferences' => array(
                        'fd' => array(
!                               'pref_id' => array('type' => 'auto', 'nullable' 
=> false),
!                               'name' => array('type' => 'varchar', 
'precision' => 256),
!                               'value' => array('type' => 'text')
                        ),
!                       'pk' => array('pref_id'),
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
!               )
!       );
! ?>
--- 91,132 ----
                        'uc' => array()
                ),
!               'phpgw_sitemgr_content_lang' => array(
                        'fd' => array(
!                               'block_id' => array('type' => 'auto', 
'nullable' => false),
!                               'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
!                               'arguments_lang' => array('type' => 'text'),
!                               'title' => array('type' => 'varchar', 
'precision' => 255),
                        ),
!                       'pk' => array('block_id','lang'),
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
!               ),
!               'phpgw_sitemgr_active_modules' => array(
!                       'fd' => array(
!                               // area __PAGE__ stands for master list
!                               'area' => array('type' => 'varchar', 
'precision' => 50, 'nullable' => false),
!                               // cat_id 0 stands for site wide
!                               'cat_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false),
!                               'module_id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false)
!                       ),
!                       'pk' => array('area','cat_id','module_id'),
!                       'fk' => array(),
!                       'ix' => array(),
!                       'uc' => array()
!               ),
!               'phpgw_sitemgr_properties' => array(
!                       'fd' => array(
!                               // area __PAGE__ stands for all areas
!                               'area' => array('type' => 'varchar', 
'precision' => 50, 'nullable' => false),
!                               // cat_id 0 stands for site wide 
!                               'cat_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false), 
!                               'module_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => false),
!                               'properties' => array('type' => 'text')
!                       ),
!                       'pk' => array('area','cat_id','module_id'),
!                       'fk' => array(),
!                       'ix' => array(),
!                       'uc' => array()
!               ),
!       );
\ No newline at end of file

Index: tables_update.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/sitemgr/setup/tables_update.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** tables_update.inc.php       6 Dec 2002 04:56:00 -0000       1.6
--- tables_update.inc.php       17 Jan 2003 03:37:52 -0000      1.7
***************
*** 249,251 ****
--- 249,372 ----
                return $setup_info['sitemgr']['currentver'];
        }
+       
+       $test[] = '0.9.14.006';
+       function sitemgr_upgrade0_9_14_006()
+       {
+               global $setup_info,$phpgw_setup;
+               $setup_info['sitemgr']['currentver'] = '0.9.15.001';
+ 
+               $phpgw_setup->oProc->DropTable('phpgw_sitemgr_blocks');
+               $phpgw_setup->oProc->CreateTable('phpgw_sitemgr_modules',array(
+                       'fd' => array(
+                               'module_id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
+                               'app_name' => array('type' => 'varchar', 
'precision' => 25),
+                               'module_name' => array('type' => 'varchar', 
'precision' => 25),
+                               'description' => array('type' => 'varchar', 
'precision' => 255)
+                       ),
+                       'pk' => array('module_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+               $phpgw_setup->oProc->CreateTable('phpgw_sitemgr_content',array(
+                       'fd' => array(
+                               'block_id' => array('type' => 'auto', 
'nullable' => false),
+                               'area' => array('type' => 'varchar', 
'precision' => 50),
+                               //if page_id != NULL scope=page, elseif cat_id 
!= NULL scope=category, else scope=site
+                               'cat_id' => array('type' => 'int', 'precision' 
=> 4),
+                               'page_id' => array('type' => 'int', 'precision' 
=> 4),
+                               'module_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => false),
+                               'arguments' => array('type' => 'text'),
+                               'sort_order' => array('type' => 'int', 
'precision' => 4),
+                               'view' => array('type' => 'int', 'precision' => 
4),
+                               'actif' => array('type' => 'int', 'precision' 
=> 2)
+                       ),
+                       'pk' => array('block_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+               
$phpgw_setup->oProc->CreateTable('phpgw_sitemgr_content_lang',array(
+                       'fd' => array(
+                               'block_id' => array('type' => 'auto', 
'nullable' => false),
+                               'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
+                               'arguments_lang' => array('type' => 'text'),
+                               'title' => array('type' => 'varchar', 
'precision' => 255),
+                       ),
+                       'pk' => array('block_id','lang'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+               
$phpgw_setup->oProc->CreateTable('phpgw_sitemgr_active_modules',array(
+                       'fd' => array(
+                               // area __PAGE__ stands for master list
+                               'area' => array('type' => 'varchar', 
'precision' => 50, 'nullable' => false),
+                               // cat_id 0 stands for site wide
+                               'cat_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false),
+                               'module_id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false)
+                       ),
+                       'pk' => array('area','cat_id','module_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+               
$phpgw_setup->oProc->CreateTable('phpgw_sitemgr_properties',array(
+                       'fd' => array(
+                               // area __PAGE__ stands for all areas
+                               'area' => array('type' => 'varchar', 
'precision' => 50, 'nullable' => false),
+                               // cat_id 0 stands for site wide 
+                               'cat_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false), 
+                               'module_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => false),
+                               'properties' => array('type' => 'text')
+                       ),
+                       'pk' => array('area','cat_id','module_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ));
+ 
+               //we register some standard modules so that the default site 
template works
+               $db2 = $phpgw_setup->db;
+               foreach (array('html','meta','index','toc') as $module)
+               {
+                       $db2->query("INSERT INTO phpgw_sitemgr_modules 
(app_name,module_name) VALUES ('sitemgr','$module')",__LINE__,__FILE__);
+                       $module_id = 
$db2->get_last_insert_id('phpgw_sitemgr_modules','module_id');
+                       $db2->query("INSERT INTO phpgw_sitemgr_active_modules 
(area,cat_id,module_id) VALUES ('__PAGE__',0,$module_id)",__LINE__,__FILE__);
+               }
+ 
+               //now to the difficult part: we try to put the old content 
field of phpgw_sitemgr_pages into the new phpgw_sitemgr_content table
+               $db3 = $phpgw_setup->db;
+               $GLOBALS['phpgw_setup']->oProc->query("select * from 
phpgw_sitemgr_pages",__LINE__,__FILE__);
+               $emptyarray = serialize(array());
+               while($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $page_id = $GLOBALS['phpgw_setup']->oProc->f('page_id');
+                       $cat_id = $GLOBALS['phpgw_setup']->oProc->f('cat_id');
+                       $db2->query("INSERT INTO phpgw_sitemgr_content 
(area,cat_id,page_id,module_id,arguments,sort_order,view,actif) VALUES 
('CENTER',$cat_id,$page_id,$module_id,'$emptyarray',0,0,1)",__LINE__,__FILE__);
+                       $block_id = 
$db2->get_last_insert_id('phpgw_sitemgr_content','block_id');
+                       $db2->query("select * from phpgw_sitemgr_pages_lang 
WHERE page_id = $page_id",__LINE__,__FILE__);
+                       while($db2->next_record())
+                       {
+                               $lang = $db2->f('lang');
+                               $content = serialize(array('htmlcontent' => 
$db2->f('content')));
+                               $db3->query("INSERT INTO 
phpgw_sitemgr_content_lang (block_id,lang,arguments_lang,title) VALUES 
($block_id,'$lang','$content','HTML')",__LINE__,__FILE__);
+                       }
+               }
+               //finally drop the content field
+               $newtbldef = array(
+                       'fd' => array(
+                               'page_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => false),
+                               'lang' => array('type' => 'varchar', 
'precision' => 2, 'nullable' => false),
+                               'title' => array('type' => 'varchar', 
'precision' => 255),
+                               'subtitle' => array('type' => 'varchar', 
'precision' => 255)
+                       ),
+                       'pk' => array('page_id','lang'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               );
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_sitemgr_pages_lang',$newtbldef,'content');
+               return $setup_info['sitemgr']['currentver'];
+       }
  ?>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]